Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Fix use of Peer list #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix use of Peer list #3

wants to merge 1 commit into from

Conversation

fcrisciani
Copy link

  • If peer list is not available, consider 25% of the cluster using the
    network and adjust the output message
  • retab the file

Signed-off-by: Flavio Crisciani flavio.crisciani@docker.com

- If peer list is not available, consider 25% of the cluster using the
network and adjust the output message
- retab the file

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
@fcrisciani
Copy link
Author

to test this PR: docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock fcrisciani/test-network:ip-check
Tested on:

docker@ddebroy-ub-2:~$ docker version
Client:
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:35:31 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:02:44 2019
  OS/Arch:          linux/amd64
  Experimental:     false

2 overlay networks:
ymxgbtznlk2q net1 overlay swarm
v7dm9b2te5zt net2 overlay swarm

net1 has IPAM and Peers:

"IPAM": {                                                                                                                                                                                                                             
            "Driver": "default",                                                                 
            "Options": null,                      
            "Config": [                          
                {                
                    "Subnet": "192.168.0.0/24",
                    "Gateway": "192.168.0.1"
                }                       
            ]                                                                                    
        }
[...]
"Peers": [
            {
                "Name": "42af184e4ff2",
                "IP": "172.16.21.4"
            },
            {
                "Name": "8c75bc6a727e",
                "IP": "172.16.21.5"
            },
            {
                "Name": "199cbf341477",
                "IP": "172.16.21.6"
            },
            {
                "Name": "4f2607d59176",
                "IP": "172.16.21.9"
            }
        ]

Net2 has only IPAM:

"IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.0.0.0/24",
                    "Gateway": "10.0.0.1"
                }
            ]
        },

Output:

docker@ddebroy-ub-2:~$ docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock fcrisciani/test-network:ip-check 
Gathering basic cluster state
Gathering overlay network information
Counting container IP allocations per network
Counting service VIP allocations per network

Overlay IP Utilization Report
----
Network net1/ymxgbtznlk2q has an IP address capacity of 253 and uses 8 addresses spanning over 4 nodes
  Network OK: network will have 177 available IPs before passing the 75% subnet use
----
Network net2/v7dm9b2te5zt has an IP address capacity of 253 and an estimate use of 5 addresses
  Network OK: network will have 183 available IPs before passing the 75% subnet use

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant