docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.62k stars 1.97k forks source link

Option to specify Swarm cluster name #1018

Open arun-gupta opened 9 years ago

arun-gupta commented 9 years ago

Created a Swarm cluster as:

docker run swarm create

Created a Swarm master as:

docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery token://f0812d65011666ba90b5787b0ce9c4fa swarm-master

Listing the machines is shown as:

docker-machine ls
NAME           ACTIVE   DRIVER       STATE     URL                         SWARM
mydocker                virtualbox   Running   tcp://192.168.99.100:2376   
swarm-master   *        virtualbox   Running   tcp://192.168.99.102:2376   swarm-master (master)

Added another node and the machine listing is shown as:

Aruns-iMac:~ arungupta$ docker-machine ls
NAME            ACTIVE   DRIVER       STATE     URL                         SWARM
mydocker                 virtualbox   Running   tcp://192.168.99.100:2376   
swarm-master             virtualbox   Running   tcp://192.168.99.102:2376   swarm-master (master)
swarm-node-01   *        virtualbox   Running   tcp://192.168.99.103:2376   swarm-master

Seems like the cluster name is swarm-master is picked up from the master's machine name. There should be an option to specify the cluster name when creating the cluster.

ehazlett commented 9 years ago

You can set the name of the cluster by changing the machine name. Since this data lives only in Machine and only shown here, I don't think there would be much benefit from having a separate option.

arun-gupta commented 9 years ago

So the machine name and cluster name are currently the same? And will continue to be so?

ehazlett commented 9 years ago

As for now unless there is a compelling reason to change (I'm open for discussion :) ) Since this only lives in Machine and only shown on the ls I'm not sure what would be the use. We could add the ability to do operations on a named cluster but that seems a bit confusing.

hairyhenderson commented 9 years ago

The trouble with the cluster name being derived from the master's name is that there seem to be plans for some sort of redundancy with master elections in swarm. If the master changes, it'd be useful for machine to be able to handle that, and it would be super-confusing if the master of the cluster named swarm-master-1 was actually swarm-master-2 :)

As well, I can think of cases where performing an operation on an entire cluster would be very useful (especially after seeing #1053 a few minutes ago), like removing, stopping, starting, or upgrading the whole cluster.

A couple user experience options could be:

$ docker-machine upgrade @myCluster
# or...
$ docker-machine upgrade --swarm-name myCluster
ehazlett commented 9 years ago

@hairyhenderson ok this sounds good. yeah when leader election comes we will definitely want to be able to detect and update the machine list. makes sense.