Merge pull request #27910 from dperny/node_ip_in_raft

Auto-detect node IP address
This commit is contained in:
Sebastiaan van Stijn 2016-11-03 10:30:55 -07:00 committed by GitHub
commit b2641bd9df
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