swarmkit icon indicating copy to clipboard operation
swarmkit copied to clipboard

Node names, labels and namespaces

Open aluzzardi opened this issue 9 years ago • 6 comments

Node is the only resource not created by users. A node has both a name (hostname) and labels (docker engine labels), but we don't want to put them in Spec.Meta since we are not supposed to touch Specs with non-user data.

Also, while other objects have name uniqueness guarantees, we cannot guarantee that for nodes (it's perfectly fine for two nodes to have the same hostname, I guess).

Another weirdness: nodes don't belong to namespaces.

Should we remove Meta altogether from NodeSpec?

aluzzardi avatar Apr 16 '16 01:04 aluzzardi

  1. Under the current namespaces proposal, nodes do not have a namespace. It doesn't really work out in any use case examples.
  2. We need to differentiate between a node's NodeSpec.Meta.Name and the hostname. The hostname is set from the agent, through NodeDescription but the NodeSpec.Meta.Name is set by the user.
  3. Node should be accessible via the hostname or name, favoring name over hostname.

stevvooe avatar Apr 19 '16 00:04 stevvooe

This is probably still relevant. It would be nice for users to be able to name their nodes and have control over that versus the hostname, which may be generic.

stevvooe avatar Aug 04 '16 20:08 stevvooe

+1 this is particularly useful on windows hosts where changing the hostname requires a restart.

campbel avatar Feb 12 '18 17:02 campbel

Would also be nice for users to be able to template node label values into a compose file, rather than the current limitation of ID, Hostname, and Platform.

jim-sheldon avatar May 14 '19 17:05 jim-sheldon

FYI. there is some work on going on about network aliases on: https://github.com/moby/moby/issues/33408#issuecomment-491499600

Similar plan is needed here. If someone is interested to implement this one you can contact me on Docker Slack about how to get started with it, etc...

olljanat avatar May 19 '19 08:05 olljanat

Hi.

I think adding support for node labels will help deploying services with tailored configuration. In my case, I'm deploying elasticsearch nodes and want to set up in a config file

node.attr.box_type: {{ .Node.Labels.es_box_type }}

as I tagged my swarm nodes as "es_box_type: hot" and "es_box_type: warm"

juanjo-s2 avatar Jul 07 '21 11:07 juanjo-s2