Browse code

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>

Sebastiaan van Stijn authored on 2020/02/10 20:07:07
Showing 2 changed files
... ...
@@ -3046,7 +3046,27 @@ definitions:
3046 3046
         type: "object"
3047 3047
         properties:
3048 3048
           Constraints:
3049
-            description: "An array of constraints."
3049
+            description: |
3050
+              An array of constraint expressions to limit the set of nodes where
3051
+              a task can be scheduled. Constraint expressions can either use a
3052
+              _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find
3053
+              nodes that satisfy every expression (AND match). Constraints can
3054
+              match node or Docker Engine labels as follows:
3055
+
3056
+              node attribute       | matches                        | example
3057
+              ---------------------|--------------------------------|-----------------------------------------------
3058
+              `node.id`            | Node ID                        | `node.id==2ivku8v2gvtg4`
3059
+              `node.hostname`      | Node hostname                  | `node.hostname!=node-2`
3060
+              `node.role`          | Node role (`manager`/`worker`) | `node.role==manager`
3061
+              `node.platform.os`   | Node operating system          | `node.platform.os==windows`
3062
+              `node.platform.arch` | Node architecture              | `node.platform.arch==x86_64`
3063
+              `node.labels`        | User-defined node labels       | `node.labels.security==high`
3064
+              `engine.labels`      | Docker Engine's labels         | `engine.labels.operatingsystem==ubuntu-14.04`
3065
+
3066
+              `engine.labels` apply to Docker Engine labels like operating system,
3067
+              drivers, etc. Swarm administrators add `node.labels` for operational
3068
+              purposes by using the [`node update endpoint`](#operation/NodeUpdate).
3069
+
3050 3070
             type: "array"
3051 3071
             items:
3052 3072
               type: "string"
... ...
@@ -3054,6 +3074,8 @@ definitions:
3054 3054
               - "node.hostname!=node3.corp.example.com"
3055 3055
               - "node.role!=manager"
3056 3056
               - "node.labels.type==production"
3057
+              - "node.platform.os==linux"
3058
+              - "node.platform.arch==x86_64"
3057 3059
           Preferences:
3058 3060
             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."
3059 3061
             type: "array"
... ...
@@ -357,6 +357,9 @@ keywords: "API, Docker, rcli, REST, documentation"
357 357
 * The `HostConfig` field now includes `CpuCount` that represents the number of CPUs available for execution by the container. Windows daemon only.
358 358
 * `POST /services/create` and `POST /services/(id or name)/update` now accept the `TTY` parameter, which allocate a pseudo-TTY in container.
359 359
 * `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`.
360
+* `POST /services/create` and `POST /services/(id or name)/update` now support
361
+  `node.platform.arch` and `node.platform.os` constraints in the services 
362
+  `TaskSpec.Placement.Constraints` field.
360 363
 * `GET /networks/(id or name)` now includes IP and name of all peers nodes for swarm mode overlay networks.
361 364
 * `GET /plugins` list plugins.
362 365
 * `POST /plugins/pull?name=<plugin name>` pulls a plugin.