-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support creating a Cluster
from a DC/OS url (i.e., Cluster.from_url
).
#1576
Comments
Thanks @jieyu ! I imagine that this would look like With On an implementation level -
We can construct a With that, we have to also provide the default user, SSH key path and default transport, and those must be the same for all nodes. I imagine therefore that the interface may look something like: Cluster.from_url(url, default_user, ssh_key_path, default_transport) I do not want to think too deeply about this before I know the specifics of the DC/OS API endpoints you are referring to - please could you like me to those? Assuming that these API endpoints are not open to the world, we would likely run the I guess the method would do something like: def from_url
one_master_public_ip = socket.gethostbyname(url)
one_master_node = Node(
public_ip_address=one_master_public_ip,
private_ip_address=one_master_public_ip,
default_user=default_user,
ssh_key_path=ssh_key_path,
default_transport=default_transport,
)
path = url + '/some/dcos/api/endpoint'
endpoint_json = one_master_node.run(args=['curl', path]).stdout
...
masters = agents = public_agents = {}
for item in loaded_endpoint_json['masters']:
node = Node(public_ip=...)
masters.add(node)
...
cluster = Cluster.from_nodes(
masters=masters,
agents=agents,
public_agents=public_agents,
)
return cluster |
@adamtheturtle the dcos-test-utils package has some helpers to get master/agent ips Maybe you can directly use those? |
Looking under the hood at how those are retrieved if they are not set by the user we can see
To keep in mind when considering this:
I think better is to use |
Just a thought to consider later - maybe this is better as |
When creating a
Cluster
for an existing DC/OS cluster, the most convenient way is to create it from a single DC/OS url, instead of asking users to manually specifying master/agents node information which is tedious. Technically, the library can use DC/OS APIs to get all the master/agents, and populate the necessary information inCluster
object.The text was updated successfully, but these errors were encountered: