-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Add support for .Node.Hostname templating in swarm services #34686
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
Conversation
a59836f
to
b193549
Compare
@@ -5,6 +5,8 @@ import ( | |||
"sort" | |||
"strings" | |||
|
|||
"sync" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "sync"
line doesn't need to be separated from the other standard library imports with a blank line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed that, it was the IDE automatically adding that line..
Signed-off-by: Carlo Mion <mion00@gmail.com>
b193549
to
e2f09fa
Compare
I am really looking forward to having this feature. Especially for monitoring with things like telegraf this will be very helpful. Any plans getting this merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🐯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@mion00 can you open a follow up PR to update the documentation accordingly? This new option needs to be added to the templating section here: https://github.com/docker/cli/blob/master/docs/reference/commandline/service_create.md#create-services-using-templates |
Update placeholders table and add example code Follow up to moby/moby#34686
Update placeholders table and add example code Follow up to moby/moby#34686 Signed-off-by: Carlo Mion <mion00@gmail.com>
Update placeholders table and add example code Follow up to moby/moby#34686 Signed-off-by: Carlo Mion <mion00@gmail.com>
Update placeholders table and add example code Follow up to moby/moby#34686 Signed-off-by: Carlo Mion <mion00@gmail.com>
Update placeholders table and add example code Follow up to moby/moby#34686 Signed-off-by: Carlo Mion <mion00@gmail.com>
Update placeholders table and add example code Follow up to moby/moby#34686 Signed-off-by: Carlo Mion <mion00@gmail.com>
Update placeholders table and add example code Follow up to moby/moby#34686 Signed-off-by: Carlo Mion <mion00@gmail.com> Upstream-commit: 21825b68420a9114ca2cb457fd1b7efeacfcf815 Component: cli
@andrewhsu I think this nice feature should be added to the 17.11 release notes. |
Thanks @albers - I did a quick check and it looks like it was already included in the 17.10 release https://github.com/docker/docker-ce/blame/17.10/components/engine/daemon/cluster/executor/container/adapter.go#L44, and included in those release nodes; https://github.com/docker/docker-ce/releases/tag/v17.10.0-ce |
@thaJeztah Oh yes, you're right. I was so sure I tested this against 17.10 but it must have been 17.09 then. Thanks a lot for sorting this out. |
No worries thanks! Could've been we missed it |
Is this available in 17.12.1.ce-1 |
@tgupta1419 yes it is https://github.com/docker/docker-ce/blame/v17.12.1-ce/components/engine/daemon/cluster/executor/container/adapter.go#L43 but note that Docker 17.12.x has reached EOL, and is no longer maintained |
This is a follow up on #34061 and moby/swarmkit#1951
Signed-off-by: Carlo Mion mion00@gmail.com
- What I did
Add support for templating Node.Hostname in swarm services
- How I did it
Creating a new field in the docker executor, with informations about the node
- How to verify it
I modified an already present integration test to use the templated hostname.
You can also verify manually creating a swarm service using {{.Node.Hostname}} in one of the supported fields, such as labels, env or hostname, and verify that the newly created container has the appropriate value taken from the node hostname.
- Description for the changelog
Add support for {{.Node.Hostname}} in swarm service templates
- A picture of a cute animal (not mandatory but encouraged)
