Node names, labels and namespaces
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?
- Under the current namespaces proposal, nodes do not have a namespace. It doesn't really work out in any use case examples.
- We need to differentiate between a node's
NodeSpec.Meta.Nameand the hostname. The hostname is set from the agent, throughNodeDescriptionbut theNodeSpec.Meta.Nameis set by the user. - Node should be accessible via the hostname or name, favoring name over hostname.
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.
+1 this is particularly useful on windows hosts where changing the hostname requires a restart.
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.
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...
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"