Description
Right now docker info will return if a node is a swarm manager, but it doesn't say if that node is the leader node or not.
Swarm: active
NodeID: 2bf7ukd8dj209nbepgyvg3ngh
Is Manager: true
Managers: 3
Nodes: 4
Node Address: 192.168.33.216
There is a way to find out by doing docker node inspect self -f "{{ .ManagerStatus.Leader }}"
but this will not work on worker nodes, only manager nodes, since the node inspect isn't available on worker nodes.
So you need to make two calls, find out if the node is a manager, and if so, then make the second call to find out if the node is a leader. Adding it to Docker info, will make it only one call, and it will work for both workers and managers.
End result would look like this.
Swarm: active
NodeID: 2bf7ukd8dj209nbepgyvg3ngh
Is Manager: true
Is Leader: false
Managers: 3
Nodes: 4
Node Address: 192.168.33.216
If this seems reasonable, I can submit a PR, but I will need a little help to point me in the right direction for where the change needs to happen, I'm guessing there might need to be a swarmkit change as well?