Add verbose flag to network inspect to show all services & tasks in swarm mode#31710
Add verbose flag to network inspect to show all services & tasks in swarm mode#31710mavenugo merged 2 commits intomoby:masterfrom
Conversation
|
There is a gofmt issue preventing CI from running. |
api/types/types.go
Outdated
There was a problem hiding this comment.
I believe you will need a documentation comment here to get golint to succeed.
api/types/types.go
Outdated
|
Rather than changing the API to include this information, could we do this on the client side by adding |
7a8f807 to
b29326b
Compare
|
@aaronlehmann One of the reasons for implementing this is to have a quick way to check if the network control plane state distributed by gossip is consistent across all nodes. So this has to work on all nodes, mainly the workers. I am working on a diagnostics container which will probe the kernel state and make sure its consistent (for ex: LB entries in IPVS matches the number of tasks for a given service). So using the swarm control api will not work in this case. The service/task information presented here is fetched from libnetwork's networkDB. |
There was a problem hiding this comment.
I wonder we can return map[string]string here (or json string maybe)
There was a problem hiding this comment.
We want the driver to return the endpointID and a string that can be presented to the user. The reason for this is the way networkDB API is currently designed. NetworkDB is a service provided by the libnetwork and the network drivers use it. But libnetwork is not aware of what exactly is the key used by the driver. Please see this moby/libnetwork#1674 (comment).
There was a problem hiding this comment.
Sorry for confusion, what I meant was converting a human-friendly string returned as the 2nd retvalue here to a machine-friendly map.
i.e.
return key, map[string]string{"HostIP": peer.TunnelEndpointIP}There was a problem hiding this comment.
Ok, I think its a good idea. If the driver wants to return more info in future a map would be better than cramming it all into one string. Will change it in the libnetwork PR.
0f28505 to
401fd76
Compare
|
Thanks @sanimej . Yes, this is a very useful addition. @aaronlehmann as @sanimej suggested, the main purpose of this change is provide a way to perform consistency check between the distributed control-plane (via Gossip) and the distributed data-plane that is built using various tools such as iptables, l2/l3 table, ipvs, etc... |
api/types/types.go
Outdated
There was a problem hiding this comment.
Can you pls move these network specific Task and Service info to api/types/network/network.go ?
api/types/types.go
Outdated
|
@mavenugo Addressed the comments. PTAL. |
vendor.conf
Outdated
There was a problem hiding this comment.
Since this is being vendored to the master, should we also consider picking up 4610dd67c7b9828bb4719d8aa2ac53a7f1f739d2 ?
@aboch can you share your opinion ?
There was a problem hiding this comment.
We need it in 17.04.
But I was hoping to bring it in along with moby/libnetwork#1678 if that one and moby/swarmkit#2028 get merged in time.
Maybe better be safe and carry it in now along with this vendoring.
There was a problem hiding this comment.
@sanimej btw, this is not a mandatory request for this PR :-) ... so i will approve this PR for its own merits. If you can update to the above vendor, its a icing on the cake. thanks
There was a problem hiding this comment.
@mavenugo Updated the vendoring to libnetwork SHA 4610dd67c7b9828bb4719d8aa2ac53a7f1f739d2 (brings moby/libnetwork#1354)
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
|
Vendoring also fixes docker #30727 |
1cb8ced to
ffa17d4
Compare
There was a problem hiding this comment.
Maybe "...like the service's VIP"? Sorry to keep nitpicking this. The sentence just doesn't sound correct without something between "like" and "VIP".
There was a problem hiding this comment.
Does this sound better ?
docker network inspect --verbose for swarm mode overlay networks shows service-specific details like its VIP and port mappings.
There was a problem hiding this comment.
If I didn't have the context of this conversation, I would read that its as meaning that the network's VIP and port mappings are shown.
There was a problem hiding this comment.
How about this ?
docker network inspect --verbose for swarm mode overlay networks shows service-specific details such as service's VIP and port mappings.
There was a problem hiding this comment.
That's good if you change service's to a service's or the service's.
|
LGTM |
man/src/network/inspect.md
Outdated
There was a problem hiding this comment.
If youre still updating, can you wrap these paragraphs to 80-chars?
|
Left some small nits, but no show-stoppers |
…m mode Signed-off-by: Santhosh Manohar <santhosh@docker.com>
|
@thaJeztah Updated the PR. |
Add verbose flag to network inspect to show all services & tasks in swarm mode
Add verbose flag to network inspect to show all services & tasks in swarm mode
For swarm mode networks currently
network inspectonly shows endpoints local to that host. Service Discovery and overlay network reachability information gets exchanged through the gossip channel between the nodes. There have been issues where failures in the gossip channel can lead to inconsistent state across clusters. But there was no easy way to identify it.This change adds a
verboseflag to thenetwork inspectoutput to display all services on that network with all the task IPs and host IP where the container is running. This will be very useful to quickly identify any inconsistent state across hosts (this can show up stale or incorrect IPs in DNS queries).Edit: libnetwork PR has been merged. Updated the vendoring.
Fixes docker #24186
Example output from a 3 node cluster.
s1has 3 replicas ands2has 1 replica.