Skip to content

Commit 2752614

Browse files
authored
Merge pull request #215 from bart0sh/PR018-document-spec-fields
Document fields in spec to indicate when these were added.
2 parents 16d0cd1 + 9c4f75c commit 2752614

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

SPEC.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,14 @@ The keywords "must", "must not", "required", "shall", "shall not", "should", "sh
179179
* `kind` (string, REQUIRED) field specifies a label which uniquely identifies the device vendor.
180180
It can be used to disambiguate the vendor that matches a device, e.g: `docker/podman run --device vendor.com/device=foo ...`.
181181
* The `kind` label has two segments: a prefix and a name, separated by a slash (/).
182-
* The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (\_), dots (.), and alphanumerics between.
182+
* The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (\_), dots (.), and alphanumerics between. Dots (.) are supported from v0.6.0.
183183
* The prefix must be a DNS subdomain: a series of DNS labels separated by dots (.), not longer than 253 characters in total, followed by a slash (/).
184184
* Examples (not an exhaustive list):
185185
* Valid: `vendor.com/foo`, `foo.bar.baz/foo-bar123.B_az`.
186186
* Invalid: `foo`, `vendor.com/foo/`, `vendor.com/foo/bar`.
187187

188+
* `Annotations` (string, OPTIONAL) field contains a set of key-value pairs that may be used to provide additional information to a consumer on the spec. Added in v0.6.0.
189+
188190
#### CDI Devices
189191

190192
The `devices` field describes the set of hardware devices that can be requested by the container runtime user.
@@ -197,7 +199,7 @@ Note: For a CDI file to be valid, at least one entry must be specified in this a
197199
* Entries in the array MUST use the same schema as the entry for the `name` field
198200
* `containerEdits` (object, OPTIONAL) this field is described in the next section.
199201
* This field should only be merged in the OCI spec if the device has been requested by the container runtime user.
200-
202+
* `Annotations` (string, OPTIONAL) field contains a set of key-value pairs that may be used to provide additional information to a consumer on the spec. Added in v0.6.0.
201203

202204
#### OCI Edits
203205

@@ -212,7 +214,7 @@ The `containerEdits` field has the following definition:
212214
* `env` (array of strings in the format of "VARNAME=VARVALUE", OPTIONAL) describes the environment variables that should be set. These values are appended to the container environment array.
213215
* `deviceNodes` (array of objects, OPTIONAL) describes the device nodes that should be mounted:
214216
* `path` (string, REQUIRED) path of the device within the container.
215-
* `hostPath` (string, OPTIONAL) path of the device node on the host. If not specified the value for `path` is used.
217+
* `hostPath` (string, OPTIONAL) path of the device node on the host. If not specified the value for `path` is used. Added in v0.5.0.
216218
* `type` (string, OPTIONAL) Device type: block, char, etc.
217219
* `major` (int64, OPTIONAL) Device major number.
218220
* `minor` (int64, OPTIONAL) Device minor number.
@@ -226,7 +228,7 @@ The `containerEdits` field has the following definition:
226228
* `mounts` (array of objects, OPTIONAL) describes the mounts that should be mounted:
227229
* `hostPath` (string, REQUIRED) path of the device on the host.
228230
* `containerPath` (string, REQUIRED) path of the device within the container.
229-
* `type` (string, OPTIONAL) the type of the filesystem to be mounted. For bind mounts (when options include either bind or rbind), the type is a dummy, often "none" (not listed in /proc/filesystems).
231+
* `type` (string, OPTIONAL) the type of the filesystem to be mounted. For bind mounts (when options include either bind or rbind), the type is a dummy, often "none" (not listed in /proc/filesystems). Added in v0.4.0.
230232
* `options` (array of strings, OPTIONAL) Mount options of the filesystem to be used.
231233
* `hooks` (array of objects, OPTIONAL) describes the hooks that should be ran:
232234
* `hookName` is the name of the hook to invoke, if the runtime is OCI compliant it should be one of {createRuntime, createContainer, startContainer, poststart, poststop}.
@@ -235,13 +237,13 @@ The `containerEdits` field has the following definition:
235237
* `args` (array of strings, OPTIONAL) with the same semantics as IEEE Std 1003.1-2008 execv's argv.
236238
* `env` (array of strings, OPTIONAL) with the same semantics as IEEE Std 1003.1-2008's environ.
237239
* `timeout` (int, OPTIONAL) is the number of seconds before aborting the hook. If set, timeout MUST be greater than zero. If not set container runtime will wait for the hook to return.
238-
* `intelRdt` (object, OPTIONAL) describes the Linux [resctrl][resctrl] settings for the container (object, OPTIONAL)
240+
* `intelRdt` (object, OPTIONAL) describes the Linux [resctrl][resctrl] settings for the container (object, OPTIONAL). Added in v0.7.0.
239241
* `closID` (string, OPTIONAL) name of the `CLOS` (Class of Service).
240242
* `l3CacheSchema` (string, OPTIONAL) L3 cache allocation schema for the `CLOS`.
241243
* `memBwSchema` (string, OPTIONAL) memory bandwidth allocation schema for the `CLOS`.
242244
* `enableCMT` (boolean, OPTIONAL) whether to enable cache monitoring
243245
* `enableMBM` (boolean, OPTIONAL) whether to enable memory bandwidth monitoring
244-
* `additionalGids` (array of uint32s, OPTIONAL) A list of additional group IDs to add with the container process. These values are added to the `user.additionalGids` field in the OCI runtime specification. Values of 0 are ignored.
246+
* `additionalGids` (array of uint32s, OPTIONAL) A list of additional group IDs to add with the container process. These values are added to the `user.additionalGids` field in the OCI runtime specification. Values of 0 are ignored. Added in v0.7.0.
245247

246248
## Error Handling
247249
* Kind requested is not present in any CDI file.

specs-go/config.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type Spec struct {
77
Version string `json:"cdiVersion"`
88
Kind string `json:"kind"`
99
// Annotations add meta information per CDI spec. Note these are CDI-specific and do not affect container metadata.
10+
// Added in v0.6.0.
1011
Annotations map[string]string `json:"annotations,omitempty"`
1112
Devices []Device `json:"devices"`
1213
ContainerEdits ContainerEdits `json:"containerEdits,omitempty"`
@@ -16,6 +17,7 @@ type Spec struct {
1617
type Device struct {
1718
Name string `json:"name"`
1819
// Annotations add meta information per device. Note these are CDI-specific and do not affect container metadata.
20+
// Added in v0.6.0.
1921
Annotations map[string]string `json:"annotations,omitempty"`
2022
ContainerEdits ContainerEdits `json:"containerEdits"`
2123
}
@@ -26,14 +28,14 @@ type ContainerEdits struct {
2628
DeviceNodes []*DeviceNode `json:"deviceNodes,omitempty"`
2729
Hooks []*Hook `json:"hooks,omitempty"`
2830
Mounts []*Mount `json:"mounts,omitempty"`
29-
IntelRdt *IntelRdt `json:"intelRdt,omitempty"`
30-
AdditionalGIDs []uint32 `json:"additionalGids,omitempty"`
31+
IntelRdt *IntelRdt `json:"intelRdt,omitempty"` // Added in v0.7.0
32+
AdditionalGIDs []uint32 `json:"additionalGids,omitempty"` // Added in v0.7.0
3133
}
3234

3335
// DeviceNode represents a device node that needs to be added to the OCI spec.
3436
type DeviceNode struct {
3537
Path string `json:"path"`
36-
HostPath string `json:"hostPath,omitempty"`
38+
HostPath string `json:"hostPath,omitempty"` // Added in v0.5.0
3739
Type string `json:"type,omitempty"`
3840
Major int64 `json:"major,omitempty"`
3941
Minor int64 `json:"minor,omitempty"`
@@ -48,7 +50,7 @@ type Mount struct {
4850
HostPath string `json:"hostPath"`
4951
ContainerPath string `json:"containerPath"`
5052
Options []string `json:"options,omitempty"`
51-
Type string `json:"type,omitempty"`
53+
Type string `json:"type,omitempty"` // Added in v0.4.0
5254
}
5355

5456
// Hook represents a hook that needs to be added to the OCI spec.

0 commit comments

Comments
 (0)