Services: use ServiceStatus on API v1.41 and up
API v1.41 adds a new option to get the number of desired and running tasks when listing services. This patch enables this functionality, and provides a fallback mechanism when the ServiceStatus is not available, which would be when using an older API version. Now that the swarm.Service struct captures this information, the `ListInfo` type is no longer needed, so it is removed, and the related list- and formatting functions have been modified accordingly. To reduce repetition, sorting the services has been moved to the formatter. This is a slight change in behavior, but all calls to the formatter performed this sort first, so the change will not lead to user-facing changes. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -1,14 +1,28 @@
|
||||
id: id_baz
|
||||
name: baz
|
||||
mode: global
|
||||
replicas: 2/4
|
||||
image:
|
||||
ports: *:80->8080/tcp
|
||||
|
||||
id: id_bar
|
||||
id: 02_bar
|
||||
name: bar
|
||||
mode: replicated
|
||||
replicas: 2/4
|
||||
image:
|
||||
ports: *:80->8090/udp
|
||||
|
||||
id: 01_baz
|
||||
name: baz
|
||||
mode: global
|
||||
replicas: 1/3
|
||||
image:
|
||||
ports: *:80->8080/tcp
|
||||
|
||||
id: 04_qux2
|
||||
name: qux2
|
||||
mode: replicated
|
||||
replicas: 3/3 (max 2 per node)
|
||||
image:
|
||||
ports:
|
||||
|
||||
id: 03_qux10
|
||||
name: qux10
|
||||
mode: replicated
|
||||
replicas: 2/3 (max 1 per node)
|
||||
image:
|
||||
ports:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user