Skip to content

Commit 87f66dc

Browse files
committed
glossary: Define "set" and "unset"
There seems to be confusion about whether the empty string (and possible other values that match Go's zero values) qualifies as "set" or not [1]. This commit clarifies that Go zero values are not relevant to the spec, but it does not address how they should be handled (I'm leaving that to follow-up work). [1]: opencontainers#823 (comment) Signed-off-by: W. Trevor King <[email protected]>
1 parent f79b61d commit 87f66dc

File tree

6 files changed

+35
-31
lines changed

6 files changed

+35
-31
lines changed

config-linux.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The following parameters can be specified to set up namespaces:
3939
The runtime MUST place the container process in the namespace associated with that `path`.
4040
The runtime MUST [generate an error](runtime.md#errors) if `path` is not associated with a namespace of type `type`.
4141

42-
If `path` is not specified, the runtime MUST create a new [container namespace](glossary.md#container-namespace) of type `type`.
42+
If `path` is [unset](glossary.md#set), the runtime MUST create a new [container namespace](glossary.md#container-namespace) of type `type`.
4343

4444
If a namespace type is not specified in the `namespaces` array, the container MUST inherit the [runtime namespace](glossary.md#runtime-namespace) of that type.
4545
If a `namespaces` field contains duplicated namespaces with same `type`, the runtime MUST [generate an error](runtime.md#errors).
@@ -176,18 +176,18 @@ The path to the cgroups can be specified in the Spec via `cgroupsPath`.
176176
If `cgroupsPath` is:
177177
* ... an absolute path (starting with `/`), the runtime MUST take the path to be relative to the cgroup mount point.
178178
* ... a relative path (not starting with `/`), the runtime MAY interpret the path relative to a runtime-determined location in the cgroup hierarchy.
179-
* ... not specified, the runtime MAY define the default cgroup path.
179+
* ... [unset](glossary.md#set), the runtime MAY define the default cgroup path.
180180
Runtimes MAY consider certain `cgroupsPath` values to be invalid, and MUST generate an error if this is the case.
181-
If a `cgroupsPath` value is specified, the runtime MUST consistently attach to the same place in the cgroup hierarchy given the same value of `cgroupsPath`.
181+
If a `cgroupsPath` value is [set](glossary.md#set), the runtime MUST consistently attach to the same place in the cgroup hierarchy given the same value of `cgroupsPath`.
182182

183183
Implementations of the Spec can choose to name cgroups in any manner.
184184
The Spec does not include naming schema for cgroups.
185185
The Spec does not support per-controller paths for the reasons discussed in the [cgroupv2 documentation][cgroup-v2].
186186
The cgroups will be created if they don't exist.
187187

188188
You can configure a container's cgroups via the `resources` field of the Linux configuration.
189-
Do not specify `resources` unless limits have to be updated.
190-
For example, to run a new process in an existing container without updating limits, `resources` need not be specified.
189+
Do not [set](glossary.md#set) `resources` unless limits have to be updated.
190+
To run a new process in an existing container without updating limits, `resources` SHOULD be [unset](glossary.md#set).
191191

192192
Runtimes MAY attach the container process to additional cgroup controllers beyond those necessary to fulfill the `resources` settings.
193193

@@ -218,9 +218,9 @@ Each entry has the following structure:
218218

219219
* **`allow`** *(boolean, REQUIRED)* - whether the entry is allowed or denied.
220220
* **`type`** *(string, OPTIONAL)* - type of device: `a` (all), `c` (char), or `b` (block).
221-
Unset values mean "all", mapping to `a`.
221+
Defaults to `a`.
222222
* **`major, minor`** *(int64, OPTIONAL)* - [major, minor numbers][devices] for the device.
223-
Unset values mean "all", mapping to [`*` in the filesystem API][cgroup-v1-devices].
223+
Defaults to `*`, the semantics of which are documented [in the filesystem API][cgroup-v1-devices].
224224
* **`access`** *(string, OPTIONAL)* - cgroup permissions for device.
225225
A composition of `r` (read), `w` (write), and `m` (mknod).
226226

@@ -335,7 +335,7 @@ The following parameters can be specified to set up the controller:
335335
* **`weight`** *(uint16, OPTIONAL)* - bandwidth rate for the device.
336336
* **`leafWeight`** *(uint16, OPTIONAL)* - bandwidth rate for the device while competing with the cgroup's child cgroups, CFQ scheduler only
337337

338-
You MUST specify at least one of `weight` or `leafWeight` in a given entry, and MAY specify both.
338+
You MUST [set](glossary.md#set) at least one of `weight` or `leafWeight` in a given entry, and MAY [set](glossary.md#set) both.
339339

340340
* **`blkioThrottleReadBpsDevice`**, **`blkioThrottleWriteBpsDevice`**, **`blkioThrottleReadIOPSDevice`**, **`blkioThrottleWriteIOPSDevice`** *(array of objects, OPTIONAL)* - specify the list of devices which will be IO rate limited.
341341
The following parameters can be specified per-device:
@@ -451,17 +451,17 @@ The following parameters can be specified to set up the controller:
451451
## <a name="configLinuxIntelRdt" />IntelRdt
452452

453453
**`intelRdt`** (object, OPTIONAL) represents the [Intel Resource Director Technology][intel-rdt-cat-kernel-interface].
454-
If `intelRdt` is set, the runtime MUST write the container process ID to the `<container-id>/tasks` file in a mounted `resctrl` pseudo-filesystem, using the container ID from [`start`](runtime.md#start) and creating the `<container-id>` directory if necessary.
454+
If `intelRdt` is [set](glossary.md#set), the runtime MUST write the container process ID to the `<container-id>/tasks` file in a mounted `resctrl` pseudo-filesystem, using the container ID from [`start`](runtime.md#start) and creating the `<container-id>` directory if necessary.
455455
If no mounted `resctrl` pseudo-filesystem is available in the [runtime mount namespace](glossary.md#runtime-namespace), the runtime MUST [generate an error](runtime.md#errors).
456456

457-
If `intelRdt` is not set, the runtime MUST NOT manipulate any `resctrl` psuedo-filesystems.
457+
If `intelRdt` is [unset](glossary.md#set), the runtime MUST NOT manipulate any `resctrl` psuedo-filesystems.
458458

459459
The following parameters can be specified for the container:
460460

461461
* **`l3CacheSchema`** *(string, OPTIONAL)* - specifies the schema for L3 cache id and capacity bitmask (CBM).
462-
If `l3CacheSchema` is set, runtimes MUST write the value to the `schemata` file in the `<container-id>` directory discussed in `intelRdt`.
462+
If `l3CacheSchema` is [set](glossary.md#set), runtimes MUST write the value to the `schemata` file in the `<container-id>` directory discussed in `intelRdt`.
463463

464-
If `l3CacheSchema` is not set, runtimes MUST NOT write to `schemata` files in any `resctrl` psuedo-filesystems.
464+
If `l3CacheSchema` is [unset](glossary.md#set), runtimes MUST NOT write to `schemata` files in any `resctrl` psuedo-filesystems.
465465

466466
### Example
467467

@@ -528,7 +528,7 @@ The following parameters can be specified to set up seccomp:
528528
* **`syscalls`** *(array of objects, OPTIONAL)* - match a syscall in seccomp.
529529

530530
While this property is OPTIONAL, some values of `defaultAction` are not useful without `syscalls` entries.
531-
For example, if `defaultAction` is `SCMP_ACT_KILL` and `syscalls` is empty or unset, the kernel will kill the container process on its first syscall.
531+
For example, if `defaultAction` is `SCMP_ACT_KILL` and `syscalls` is empty or [unset](glossary.md#set), the kernel will kill the container process on its first syscall.
532532

533533
Each entry has the following structure:
534534

config-solaris.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ For additional information on properties, check the [zonecfg(1M)][zonecfg.1m_2]
8484
* **`lowerLink`** *(string, OPTIONAL)* Specify the link over which the VNIC will be created.
8585
Mapped to `lower-link` in the [zonecfg(1M)][zonecfg.1m_2] man page.
8686
* **`allowedAddress`** *(string, OPTIONAL)* The set of IP addresses that the container can use might be constrained by specifying the `allowedAddress` property.
87-
If `allowedAddress` has not been specified, then they can use any IP address on the associated physical interface for the network resource.
88-
Otherwise, when `allowedAddress` is specified, the container cannot use IP addresses that are not in the `allowedAddress` list for the physical address.
87+
If `allowedAddress` is [unset](glossary.md#set), then they can use any IP address on the associated physical interface for the network resource.
88+
Otherwise, when `allowedAddress` is [set](glossary.md#set), the container cannot use IP addresses that are not in the `allowedAddress` list for the physical address.
8989
Mapped to `allowed-address` in the [zonecfg(1M)][zonecfg.1m_2] man page.
90-
* **`configureAllowedAddress`** *(string, OPTIONAL)* If `configureAllowedAddress` is set to true, the addresses specified by `allowedAddress` are automatically configured on the interface each time the container starts.
91-
When it is set to false, the `allowedAddress` will not be configured on container start.
90+
* **`configureAllowedAddress`** *(string, OPTIONAL)* If `configureAllowedAddress` is `true`, the addresses specified by `allowedAddress` are automatically configured on the interface each time the container starts.
91+
When it is `false`, the `allowedAddress` will not be configured on container start.
9292
Mapped to `configure-allowed-address` in the [zonecfg(1M)][zonecfg.1m_2] man page.
9393
* **`defrouter`** *(string, OPTIONAL)* The value for the OPTIONAL default router.
9494
* **`macAddress`** *(string, OPTIONAL)* Set the VNIC's MAC addresses based on the specified value or keyword.

config-windows.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,14 @@ You can indicate that a container should be started in an a mode where disk flus
155155
## <a name="configWindowsHyperV" />HyperV
156156

157157
`hyperv` is an OPTIONAL field of the Windows configuration.
158-
If present, the container MUST be run with Hyper-V isolation.
159-
If omitted, the container MUST be run as a Windows Server container.
158+
If [set](glossary.md#set), the container MUST be run with Hyper-V isolation.
159+
If [unset](glossary.md#set), the container MUST be run as a Windows Server container.
160160

161161
The following parameters can be specified:
162162

163163
* **`utilityVMPath`** *(string, OPTIONAL)* - specifies the path to the image used for the utility VM.
164164
This would be specified if using a base image which does not contain a utility VM image.
165-
If not supplied, the runtime will search the container filesystem layers from the bottom-most layer upwards, until it locates "UtilityVM", and default to that path.
165+
If [unset](glossary.md#set), the runtime MUST search the container filesystem layers from the bottom-most layer upwards, until it locates "UtilityVM", and default to that path.
166166

167167
### Example
168168

config.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ For all platform-specific configuration values, the scope defined below in the [
3232
The path is either an absolute path or a relative path to the bundle.
3333
Users SHOULD consider using a conventional name, such as `rootfs`.
3434

35-
* On Windows, for Windows Server Containers, this field is REQUIRED and MUST be specified as a [volume GUID path][naming-a-volume].
36-
For Hyper-V Containers, this field MUST be omitted.
35+
* On Windows, for Windows Server Containers, this field is REQUIRED and MUST be a [volume GUID path][naming-a-volume].
36+
For Hyper-V Containers, this field MUST be [unset](glossary.md#set).
3737
* On all other platforms, this field is REQUIRED.
3838
* On Linux, for example, with a bundle at `/to/bundle` and a root filesystem at `/to/bundle/rootfs`, the `path` value can be either `/to/bundle/rootfs` or `rootfs`.
3939

4040
If defined, a directory MUST exist at the path declared by the field.
41-
* **`readonly`** (bool, OPTIONAL) If true then the root filesystem MUST be read-only inside the container, defaults to false.
42-
* On Windows, this field MUST be omitted or false.
41+
* **`readonly`** (bool, OPTIONAL) If true then the root filesystem MUST be read-only inside the container.
42+
Defaults to `false`.
43+
* On Windows, this field MUST be [unset](glossary.md#set) or `false`.
4344

4445
### Example (POSIX)
4546

@@ -173,8 +174,8 @@ For Linux-based systems the process structure supports the following process-spe
173174
* **`apparmorProfile`** (string, OPTIONAL) specifies the name of the AppArmor profile to be applied to processes in the container.
174175
For more information about AppArmor, see [AppArmor documentation][apparmor].
175176
* **`oomScoreAdj`** *(int, OPTIONAL)* adjusts the oom-killer score in `[pid]/oom_score_adj` for the container process's `[pid]` in a [proc pseudo-filesystem][procfs].
176-
If `oomScoreAdj` is set, the runtime MUST set `oom_score_adj` to the given value.
177-
If `oomScoreAdj` is not set, the runtime MUST NOT change the value of `oom_score_adj`.
177+
If `oomScoreAdj` is [set](glossary.md#set), the runtime MUST set `oom_score_adj` to the given value.
178+
If `oomScoreAdj` is [unset](glossary.md#set), the runtime MUST NOT change the value of `oom_score_adj`.
178179

179180
This is a per-process setting, where as [`disableOOMKiller`](config-linux.md#disable-out-of-memory-killer) is scoped for a memory cgroup.
180181
For more information on how these two settings work together, see [the memory cgroup documentation section 10. OOM Contol][cgroup-v1-memory_2].
@@ -343,11 +344,11 @@ For Windows based systems the user structure has the following fields:
343344
Runtime implementations MAY support any valid values for platform-specific fields as part of this configuration.
344345

345346
* **`linux`** (object, OPTIONAL) [Linux-specific configuration](config-linux.md).
346-
This MAY be set if **`platform.os`** is `linux` and MUST NOT be set otherwise.
347+
This MAY be [set](glossary.md#set) if **`platform.os`** is `linux` and MUST be [unset](glossary.md#set) otherwise.
347348
* **`windows`** (object, OPTIONAL) [Windows-specific configuration](config-windows.md).
348-
This MUST be set if **`platform.os`** is `windows` and MUST NOT be set otherwise.
349+
This MUST be [set](glossary.md#set) if **`platform.os`** is `windows` and MUST NOT be set otherwise.
349350
* **`solaris`** (object, OPTIONAL) [Solaris-specific configuration](config-solaris.md).
350-
This MAY be set if **`platform.os`** is `solaris` and MUST NOT be set otherwise.
351+
This MAY be [set](glossary.md#set) if **`platform.os`** is `solaris` and MUST be [unset](glossary.md#set) otherwise.
351352

352353
### Example (Linux)
353354

@@ -380,7 +381,7 @@ On Linux, they are run after the container namespaces are created.
380381
* **`args`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2001 `execv`'s *argv*][ieee-1003.1-2001-xsh-exec].
381382
* **`env`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2001's `environ`][ieee-1003.1-2001-xbd-c8.1].
382383
* **`timeout`** (int, OPTIONAL) is the number of seconds before aborting the hook.
383-
If set, `timeout` MUST be greater than zero.
384+
If [set](glossary.md#set), `timeout` MUST be greater than zero.
384385
* **`poststart`** (array of objects, OPTIONAL) is an array of [post-start hooks](#poststart).
385386
Entries in the array have the same schema as pre-start entries.
386387
* **`poststop`** (array of objects, OPTIONAL) is an array of [post-stop hooks](#poststop).

glossary.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ It reads the [configuration files](#configuration) from a [bundle](#bundle), use
3333
On Linux, a leaf in the [namespace][namespaces.7] hierarchy from which the [runtime](#runtime) process is executed.
3434
New container namespaces will be created as children of the runtime namespaces.
3535

36+
## <a name="glossarySet" />Set
37+
38+
A property is "set" if its key appears in the parent JSON object and "unset" if its key does not appear in the parent JSON object.
3639

3740
[JSON]: https://tools.ietf.org/html/rfc7159
3841
[UTF-8]: http://www.unicode.org/versions/Unicode8.0.0/ch03.pdf

runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ This operation MUST [generate an error](#errors) if it is not provided the conta
117117
Attempting to start a container that does not exist MUST [generate an error](#errors).
118118
Attempting to start an already started container MUST have no effect on the container and MUST [generate an error](#errors).
119119
This operation MUST run the user-specified program as specified by [`process`](config.md#process).
120-
This operation MUST generate an error if `process` was not set.
120+
This operation MUST generate an error if `process` was [unset](glossary.md#set).
121121

122122
### <a name="runtimeKill" />Kill
123123
`kill <container-id> <signal>`

0 commit comments

Comments
 (0)