Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit d4c418d

Browse files
committed
swagger: document "node.platform.(arch|os)" constraints
Support for these constraints was added in docker 1.13.0 (API v1.25), but never documented. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit ed439e4a31caaebf32c657e4063a77aa7af87bc0) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 5e23653130a65e90b7296c70f9230d9f09374efb Component: engine
1 parent 789f1ad commit d4c418d

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

components/engine/api/swagger.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3021,14 +3021,36 @@ definitions:
30213021
type: "object"
30223022
properties:
30233023
Constraints:
3024-
description: "An array of constraints."
3024+
description: |
3025+
An array of constraint expressions to limit the set of nodes where
3026+
a task can be scheduled. Constraint expressions can either use a
3027+
_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find
3028+
nodes that satisfy every expression (AND match). Constraints can
3029+
match node or Docker Engine labels as follows:
3030+
3031+
node attribute | matches | example
3032+
---------------------|--------------------------------|-----------------------------------------------
3033+
`node.id` | Node ID | `node.id==2ivku8v2gvtg4`
3034+
`node.hostname` | Node hostname | `node.hostname!=node-2`
3035+
`node.role` | Node role (`manager`/`worker`) | `node.role==manager`
3036+
`node.platform.os` | Node operating system | `node.platform.os==windows`
3037+
`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`
3038+
`node.labels` | User-defined node labels | `node.labels.security==high`
3039+
`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`
3040+
3041+
`engine.labels` apply to Docker Engine labels like operating system,
3042+
drivers, etc. Swarm administrators add `node.labels` for operational
3043+
purposes by using the [`node update endpoint`](#operation/NodeUpdate).
3044+
30253045
type: "array"
30263046
items:
30273047
type: "string"
30283048
example:
30293049
- "node.hostname!=node3.corp.example.com"
30303050
- "node.role!=manager"
30313051
- "node.labels.type==production"
3052+
- "node.platform.os==linux"
3053+
- "node.platform.arch==x86_64"
30323054
Preferences:
30333055
description: "Preferences provide a way to make the scheduler aware of factors such as topology. They are provided in order from highest to lowest precedence."
30343056
type: "array"

components/engine/docs/api/version-history.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ keywords: "API, Docker, rcli, REST, documentation"
315315
* The `HostConfig` field now includes `CpuCount` that represents the number of CPUs available for execution by the container. Windows daemon only.
316316
* `POST /services/create` and `POST /services/(id or name)/update` now accept the `TTY` parameter, which allocate a pseudo-TTY in container.
317317
* `POST /services/create` and `POST /services/(id or name)/update` now accept the `DNSConfig` parameter, which specifies DNS related configurations in resolver configuration file (resolv.conf) through `Nameservers`, `Search`, and `Options`.
318+
* `POST /services/create` and `POST /services/(id or name)/update` now support
319+
`node.platform.arch` and `node.platform.os` constraints in the services
320+
`TaskSpec.Placement.Constraints` field.
318321
* `GET /networks/(id or name)` now includes IP and name of all peers nodes for swarm mode overlay networks.
319322
* `GET /plugins` list plugins.
320323
* `POST /plugins/pull?name=<plugin name>` pulls a plugin.

0 commit comments

Comments
 (0)