moby / moby/swarmkit

[Proposal] docker service create template support for Node labels

Open
#2,942 4 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3.7k
Forks
676
Avg merge
4d 9h
Merged PRs (30d)
6

Description

Currently supported Templates regarding the Nodes
Currently only two templates {{ .Node.ID }} and {{ .Node.Hostname }} are supported. This is nice, but labels would put these templates on another level in terms of possibilities.

How could this look
The template could be something like {{ .Node.Spec.Labels.[label name] }}.
If the label is not found the value "", "null" or "<no value>" (as it's currently done using docker node inspect) should be used.

Summary
Dockers templates for service creation should support node labels.
The result of the template {{ .Node.Spec.Labels.example_label }} should be the same as the output of docker node inspect -f="{{ .Spec.Labels.example_label }}" node_name.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the existing service-creation template handling for .Node.ID and .Node.Hostname, then find its related tests or entry point. Compare the proposed .Node.Spec.Labels.example_label behavior with docker node inspect; done means node labels render correctly and missing labels produce an agreed empty or placeholder value.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.