1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

added node ip autodetection

Manager now auto-detects the address that an agent connects to the cluster
from and stores it. This is useful for many kinds of internal cluster
management tools.

Signed-off-by: Drew Erny <drew.erny@docker.com>
This commit is contained in:
Drew Erny 2016-10-24 16:11:25 -07:00
parent 4a955dc4d4
commit 9bcf623719
6 changed files with 11 additions and 3 deletions

View file

@ -77,6 +77,7 @@ type PluginDescription struct {
type NodeStatus struct {
State NodeState `json:",omitempty"`
Message string `json:",omitempty"`
Addr string `json:",omitempty"`
}
// Reachability represents the reachability of a node.

View file

@ -95,6 +95,7 @@ func printNode(out io.Writer, node swarm.Node) {
fmt.Fprintf(out, " State:\t\t\t%s\n", command.PrettyPrint(node.Status.State))
ioutils.FprintfIfNotEmpty(out, " Message:\t\t%s\n", command.PrettyPrint(node.Status.Message))
fmt.Fprintf(out, " Availability:\t\t%s\n", command.PrettyPrint(node.Spec.Availability))
ioutils.FprintfIfNotEmpty(out, " Address:\t\t%s\n", command.PrettyPrint(node.Status.Addr))
if node.ManagerStatus != nil {
fmt.Fprintln(out, "Manager Status:")

View file

@ -20,6 +20,7 @@ func NodeFromGRPC(n swarmapi.Node) types.Node {
Status: types.NodeStatus{
State: types.NodeState(strings.ToLower(n.Status.State.String())),
Message: n.Status.Message,
Addr: n.Status.Addr,
},
}

View file

@ -163,6 +163,7 @@ This section lists each version from latest to oldest. Each listing includes a
* Every API response now includes a `Docker-Experimental` header specifying if experimental features are enabled (value can be `true` or `false`).
* The `hostConfig` option now accepts the fields `CpuRealtimePeriod` and `CpuRtRuntime` to allocate cpu runtime to rt tasks when `CONFIG_RT_GROUP_SCHED` is enabled in the kernel.
* The `SecurityOptions` field within the `GET /info` response now includes `userns` if user namespaces are enabled in the daemon.
* `GET /nodes` and `GET /node/(id or name)` now return `Addr` as part of a node's `Status`, which is the address that that node connects to the manager from.
### v1.24 API changes

View file

@ -4464,7 +4464,8 @@ List nodes
}
},
"Status": {
"State": "ready"
"State": "ready",
"Addr": "172.17.0.2"
},
"ManagerStatus": {
"Leader": true,
@ -4555,7 +4556,8 @@ Return low-level information on the node `id`
}
},
"Status": {
"State": "ready"
"State": "ready",
"Addr": "172.17.0.2"
},
"ManagerStatus": {
"Leader": true,

View file

@ -88,7 +88,8 @@ Example output:
}
},
"Status": {
"State": "ready"
"State": "ready",
"Addr": "168.0.32.137"
},
"ManagerStatus": {
"Leader": true,
@ -110,6 +111,7 @@ Example output:
Status:
State: Ready
Availability: Active
Address: 172.17.0.2
Manager Status:
Address: 172.17.0.2:2377
Raft Status: Reachable