Skip to content

Commit

Permalink
Adds an "lan" tagged address so we have a way to get them all.
Browse files Browse the repository at this point in the history
If we didn't have this, then there would be no way to know the LAN
address if address translation was turned on.
  • Loading branch information
slackpad committed Aug 16, 2016
1 parent 1d5eb36 commit fbdd021
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions command/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ func Create(config *Config, logOutput io.Writer) (*Agent, error) {

// Create the default set of tagged addresses.
config.TaggedAddresses = map[string]string{
"lan": config.AdvertiseAddr,
"wan": config.AdvertiseAddrWan,
}

Expand Down
1 change: 1 addition & 0 deletions command/agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func TestAgent_CheckAdvertiseAddrsSettings(t *testing.T) {
t.Fatalf("RPC is not properly set to %v: %s", c.AdvertiseAddrs.RPC, rpc)
}
expected := map[string]string{
"lan": agent.config.AdvertiseAddr,
"wan": agent.config.AdvertiseAddrWan,
}
if !reflect.DeepEqual(agent.config.TaggedAddresses, expected) {
Expand Down
9 changes: 7 additions & 2 deletions website/source/docs/agent/http/catalog.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ body must look something like:
"Node": "foobar",
"Address": "192.168.10.10",
"TaggedAddresses": {
"wan": "127.0.0.1"
"lan": "192.168.10.10",
"wan": "10.0.10.10"
},
"Service": {
"ID": "redis1",
Expand Down Expand Up @@ -69,7 +70,8 @@ requires `Node` and `Address` to be provided while `Datacenter` will be defaulte
to match that of the agent. If only those are provided, the endpoint will register
the node with the catalog. `TaggedAddresses` can be used in conjunction with the
[`translate_wan_addrs`](/docs/agent/options.html#translate_wan_addrs) configuration
option. Currently only the "wan" tag is supported.
option and the "wan" address. The "lan" address was added in Consul 0.7 to help find
the LAN address if address translation is enabled.

If the `Service` key is provided, the service will also be registered. If
`ID` is not provided, it will be defaulted to the value of the `Service.Service` property.
Expand Down Expand Up @@ -200,13 +202,15 @@ It returns a JSON body like this:
"Node": "baz",
"Address": "10.1.10.11",
"TaggedAddresses": {
"lan": "10.1.10.11",
"wan": "10.1.10.11"
}
},
{
"Node": "foobar",
"Address": "10.1.10.12",
"TaggedAddresses": {
"lan": "10.1.10.11",
"wan": "10.1.10.12"
}
}
Expand Down Expand Up @@ -287,6 +291,7 @@ It returns a JSON body like this:
"Node": "foobar",
"Address": "10.1.10.12",
"TaggedAddresses": {
"lan": "10.1.10.12",
"wan": "10.1.10.12"
}
},
Expand Down
1 change: 1 addition & 0 deletions website/source/docs/agent/http/health.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ It returns a JSON body like this:
"Node": "foobar",
"Address": "10.1.10.12",
"TaggedAddresses": {
"lan": "10.1.10.12",
"wan": "10.1.10.12"
}
},
Expand Down
6 changes: 5 additions & 1 deletion website/source/docs/agent/http/query.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,11 @@ a JSON body will be returned like this:
{
"Node": {
"Node": "foobar",
"Address": "10.1.10.12"
"Address": "10.1.10.12",
"TaggedAddresses": {
"lan": "10.1.10.12",
"wan": "10.1.10.12"
}
},
"Service": {
"ID": "redis",
Expand Down

0 comments on commit fbdd021

Please sign in to comment.