diff --git a/command/agent/agent.go b/command/agent/agent.go index 79b94d55dbd3..d22cc92f1ce2 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -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, } diff --git a/command/agent/agent_test.go b/command/agent/agent_test.go index bab39a7d0888..6b94c119d6cd 100644 --- a/command/agent/agent_test.go +++ b/command/agent/agent_test.go @@ -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) { diff --git a/website/source/docs/agent/http/catalog.html.markdown b/website/source/docs/agent/http/catalog.html.markdown index 55879a8ba6e4..327daf935961 100644 --- a/website/source/docs/agent/http/catalog.html.markdown +++ b/website/source/docs/agent/http/catalog.html.markdown @@ -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", @@ -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. @@ -200,6 +202,7 @@ 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" } }, @@ -207,6 +210,7 @@ It returns a JSON body like this: "Node": "foobar", "Address": "10.1.10.12", "TaggedAddresses": { + "lan": "10.1.10.11", "wan": "10.1.10.12" } } @@ -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" } }, diff --git a/website/source/docs/agent/http/health.html.markdown b/website/source/docs/agent/http/health.html.markdown index 6f0c4a99ef65..0825a1f47dfe 100644 --- a/website/source/docs/agent/http/health.html.markdown +++ b/website/source/docs/agent/http/health.html.markdown @@ -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" } }, diff --git a/website/source/docs/agent/http/query.html.markdown b/website/source/docs/agent/http/query.html.markdown index d2737384d939..5eaccdb11d3e 100644 --- a/website/source/docs/agent/http/query.html.markdown +++ b/website/source/docs/agent/http/query.html.markdown @@ -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",