-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Service registration for IPv6 docker addresses (Fixes #3785) #3790
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
795d84e
Service registration for IPv6 docker addresses
42wim dea460b
* Change use_ipv6_address to advertise_ipv6_address.
42wim cdd55e4
Update documentation
42wim d0dd6ef
Add IPv6 support to travis docker
42wim 51bf06f
Add AdvertiseIPv6Address test
42wim e486a27
docker: Skip IPv6 test if IPv6 disabled
schmichael 5ff86f0
Add changelog entry for #3790
schmichael File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -463,6 +463,109 @@ In this case Nomad doesn't need to assign Redis any host ports. The `service` | |
and `check` stanzas can both specify the port number to advertise and check | ||
directly since Nomad isn't managing any port assignments. | ||
|
||
### IPv6 Docker containers | ||
|
||
The [Docker](/docs/drivers/docker.html#advertise_ipv6_address) driver supports the | ||
`advertise_ipv6_address` parameter in it's configuration. | ||
|
||
For the `service`stanza is no explicit `address_mode` required. | ||
Services default to the `auto` address mode. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
Unlike services, checks do not have an `auto` address mode as there's no way | ||
for Nomad to know which is the best address to use for checks. Consul needs | ||
access to the address for any HTTP or TCP checks. | ||
|
||
So you have to set `address_mode` parameter in the `check` stanza to `driver`. | ||
|
||
For example using `auto` address mode: | ||
|
||
```hcl | ||
job "example" { | ||
datacenters = ["dc1"] | ||
group "cache" { | ||
|
||
task "redis" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "redis:3.2" | ||
advertise_ipv6_address = true | ||
port_map { | ||
db = 6379 | ||
} | ||
} | ||
|
||
resources { | ||
cpu = 500 # 500 MHz | ||
memory = 256 # 256MB | ||
network { | ||
mbits = 10 | ||
port "db" {} | ||
} | ||
} | ||
|
||
service { | ||
name = "ipv6-redis" | ||
port = db | ||
check { | ||
name = "ipv6-redis-check" | ||
type = "tcp" | ||
interval = "10s" | ||
timeout = "2s" | ||
port = db | ||
address_mode = "driver" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Or using `address_mode=driver` for `service` and `check` with numeric ports: | ||
|
||
```hcl | ||
job "example" { | ||
datacenters = ["dc1"] | ||
group "cache" { | ||
|
||
task "redis" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "redis:3.2" | ||
advertise_ipv6_address = true | ||
# No port map required! | ||
} | ||
|
||
resources { | ||
cpu = 500 # 500 MHz | ||
memory = 256 # 256MB | ||
network { | ||
mbits = 10 | ||
} | ||
} | ||
|
||
service { | ||
name = "ipv6-redis" | ||
port = 6379 | ||
address_mode = "driver" | ||
check { | ||
name = "ipv6-redis-check" | ||
type = "tcp" | ||
interval = "10s" | ||
timeout = "2s" | ||
port = 6379 | ||
address_mode = "driver" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
The `service` and `check` stanzas can both specify the port number to | ||
advertise and check directly since Nomad isn't managing any port assignments. | ||
|
||
|
||
- - - | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hm, it seems like we probably want to set
auto = true
here as well. While this complicates the already unfortunately confusingadvertise = "auto"
logic, I think it will do what users expect by automatically advertising the routable address for the container when it's possible to discover it.Perhaps a better question is: It should be exceedingly rare that someone wants
use_ipv6_address = true
andadvertise = "host"
, correct?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 has been addressed; leaving for historical purposes)