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:
parent
4a955dc4d4
commit
9bcf623719
6 changed files with 11 additions and 3 deletions
|
@ -77,6 +77,7 @@ type PluginDescription struct {
|
||||||
type NodeStatus struct {
|
type NodeStatus struct {
|
||||||
State NodeState `json:",omitempty"`
|
State NodeState `json:",omitempty"`
|
||||||
Message string `json:",omitempty"`
|
Message string `json:",omitempty"`
|
||||||
|
Addr string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reachability represents the reachability of a node.
|
// Reachability represents the reachability of a node.
|
||||||
|
|
|
@ -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))
|
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))
|
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))
|
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 {
|
if node.ManagerStatus != nil {
|
||||||
fmt.Fprintln(out, "Manager Status:")
|
fmt.Fprintln(out, "Manager Status:")
|
||||||
|
|
|
@ -20,6 +20,7 @@ func NodeFromGRPC(n swarmapi.Node) types.Node {
|
||||||
Status: types.NodeStatus{
|
Status: types.NodeStatus{
|
||||||
State: types.NodeState(strings.ToLower(n.Status.State.String())),
|
State: types.NodeState(strings.ToLower(n.Status.State.String())),
|
||||||
Message: n.Status.Message,
|
Message: n.Status.Message,
|
||||||
|
Addr: n.Status.Addr,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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`).
|
* 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 `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.
|
* 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
|
### v1.24 API changes
|
||||||
|
|
||||||
|
|
|
@ -4464,7 +4464,8 @@ List nodes
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Status": {
|
"Status": {
|
||||||
"State": "ready"
|
"State": "ready",
|
||||||
|
"Addr": "172.17.0.2"
|
||||||
},
|
},
|
||||||
"ManagerStatus": {
|
"ManagerStatus": {
|
||||||
"Leader": true,
|
"Leader": true,
|
||||||
|
@ -4555,7 +4556,8 @@ Return low-level information on the node `id`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Status": {
|
"Status": {
|
||||||
"State": "ready"
|
"State": "ready",
|
||||||
|
"Addr": "172.17.0.2"
|
||||||
},
|
},
|
||||||
"ManagerStatus": {
|
"ManagerStatus": {
|
||||||
"Leader": true,
|
"Leader": true,
|
||||||
|
|
|
@ -88,7 +88,8 @@ Example output:
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Status": {
|
"Status": {
|
||||||
"State": "ready"
|
"State": "ready",
|
||||||
|
"Addr": "168.0.32.137"
|
||||||
},
|
},
|
||||||
"ManagerStatus": {
|
"ManagerStatus": {
|
||||||
"Leader": true,
|
"Leader": true,
|
||||||
|
@ -110,6 +111,7 @@ Example output:
|
||||||
Status:
|
Status:
|
||||||
State: Ready
|
State: Ready
|
||||||
Availability: Active
|
Availability: Active
|
||||||
|
Address: 172.17.0.2
|
||||||
Manager Status:
|
Manager Status:
|
||||||
Address: 172.17.0.2:2377
|
Address: 172.17.0.2:2377
|
||||||
Raft Status: Reachable
|
Raft Status: Reachable
|
||||||
|
|
Loading…
Add table
Reference in a new issue