Skip to content

Commit

Permalink
Changes to cluster/filter, swagger.yaml, version-history.md for filte…
Browse files Browse the repository at this point in the history
…ring on node labels.

Signed-off-by: Anshul Pundir <anshul.pundir@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
anshulpundir authored and thaJeztah committed Aug 21, 2018
1 parent 2629fe9 commit 514ce73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8609,6 +8609,7 @@ paths:
- `label=<engine label>`
- `membership=`(`accepted`|`pending`)`
- `name=<node name>`
- `node.label=<node label>`
- `role=`(`manager`|`worker`)`
type: "string"
tags: ["Node"]
Expand Down
2 changes: 2 additions & 0 deletions daemon/cluster/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func newListNodesFilters(filter filters.Args) (*swarmapi.ListNodesRequest_Filter
"label": true,
"role": true,
"membership": true,
"node.label": true,
}
if err := filter.Validate(accepted); err != nil {
return nil, err
Expand All @@ -24,6 +25,7 @@ func newListNodesFilters(filter filters.Args) (*swarmapi.ListNodesRequest_Filter
NamePrefixes: filter.Get("name"),
IDPrefixes: filter.Get("id"),
Labels: runconfigopts.ConvertKVStringsToMap(filter.Get("label")),
NodeLabels: runconfigopts.ConvertKVStringsToMap(filter.Get("node.label")),
}

for _, r := range filter.Get("role") {
Expand Down
4 changes: 4 additions & 0 deletions docs/api/version-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ keywords: "API, Docker, rcli, REST, documentation"
* `POST /swarm/init` now accepts a `DefaultAddrPool` property to set global scope default address pool
* `POST /swarm/init` now accepts a `SubnetSize` property to set global scope networks by giving the
length of the subnet masks for every such network
* `GET /nodes` now supports a filter type `node.label` filter to filter nodes based
on the node.label. The format of the label filter is `node.label=<key>`/`node.label=<key>=<value>`
to return those with the specified labels, or `node.label!=<key>`/`node.label!=<key>=<value>`
to return those without the specified labels.

## V1.38 API changes

Expand Down

0 comments on commit 514ce73

Please sign in to comment.