change node ls and service ls api and docs

Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
allencloud 2016-11-09 12:06:00 +08:00 committed by Tibor Vass
parent 8342baa829
commit c6ea37860f
2 changed files with 53 additions and 25 deletions

View File

@ -49,24 +49,13 @@ than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "b
The currently supported filters are: The currently supported filters are:
* name * [id](node_ls.md#id)
* id * [label](node_ls.md#label)
* label * [membership](node_ls.md#membership)
* [name](node_ls.md#name)
* [role](node_ls.md#role)
### name #### ID
The `name` filter matches on all or part of a node name.
The following filter matches the node with a name equal to `swarm-master` string.
```bash
$ docker node ls -f name=swarm-manager1
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader
```
### id
The `id` filter matches all or part of a node's id. The `id` filter matches all or part of a node's id.
@ -77,12 +66,11 @@ ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active 1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active
``` ```
#### label #### Label
The `label` filter matches tasks based on the presence of a `label` alone or a `label` and a The `label` filter matches nodes based on engine labels and on the presence of a `label` alone or a `label` and a value. Node labels are currently not used for filtering.
value.
The following filter matches nodes with the `usage` label regardless of its value. The following filter matches nodes with the `foo` label regardless of its value.
```bash ```bash
$ docker node ls -f "label=foo" $ docker node ls -f "label=foo"
@ -91,6 +79,46 @@ ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active 1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active
``` ```
#### Membership
The `membership` filter matches nodes based on the presence of a `membership` and a value
`accepted` or `pending`.
The following filter matches nodes with the `membership` of `accepted`.
```bash
$ docker node ls -f "membership=accepted"
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active
38ciaotwjuritcdtn9npbnkuz swarm-worker1 Ready Active
```
#### Name
The `name` filter matches on all or part of a node hostname.
The following filter matches the nodes with a name equal to `swarm-master` string.
```bash
$ docker node ls -f name=swarm-manager1
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader
```
#### Role
The `role` filter matches nodes based on the presence of a `role` and a value `worker` or `manager`.
The following filter matches nodes with the `manager` role.
```bash
$ docker node ls -f "role=manager"
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader
```
## Related information ## Related information

View File

@ -51,9 +51,9 @@ than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "b
The currently supported filters are: The currently supported filters are:
* [id](#id) * [id](service_ls.md#id)
* [label](#label) * [label](service_ls.md#label)
* [name](#name) * [name](service_ls.md#name)
#### ID #### ID
@ -93,7 +93,7 @@ ID NAME MODE REPLICAS IMAGE
#### Name #### Name
The `name` filter matches on all or part of a tasks's name. The `name` filter matches on all or part of a service's name.
The following filter matches services with a name containing `redis`. The following filter matches services with a name containing `redis`.