mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #37650 from anshulpundir/vndr
Add support for filtering on node labels
This commit is contained in:
commit
a0385f7ad7
3 changed files with 7 additions and 0 deletions
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
@ -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") {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue