@@ -4,69 +4,69 @@ import "os"
4
4
5
5
// Spec is the base configuration for CDI
6
6
type Spec struct {
7
- Version string `json:"cdiVersion"`
8
- Kind string `json:"kind"`
7
+ Version string `json:"cdiVersion" yaml:"cdiVersion" `
8
+ Kind string `json:"kind" yaml:"kind" `
9
9
// Annotations add meta information per CDI spec. Note these are CDI-specific and do not affect container metadata.
10
10
// Added in v0.6.0.
11
- Annotations map [string ]string `json:"annotations,omitempty"`
12
- Devices []Device `json:"devices"`
13
- ContainerEdits ContainerEdits `json:"containerEdits,omitempty"`
11
+ Annotations map [string ]string `json:"annotations,omitempty" yaml:"annotations,omitempty" `
12
+ Devices []Device `json:"devices" yaml:"devices" `
13
+ ContainerEdits ContainerEdits `json:"containerEdits,omitempty" yaml:"containerEdits,omitempty" `
14
14
}
15
15
16
16
// Device is a "Device" a container runtime can add to a container
17
17
type Device struct {
18
- Name string `json:"name"`
18
+ Name string `json:"name" yaml:"name" `
19
19
// Annotations add meta information per device. Note these are CDI-specific and do not affect container metadata.
20
20
// Added in v0.6.0.
21
- Annotations map [string ]string `json:"annotations,omitempty"`
22
- ContainerEdits ContainerEdits `json:"containerEdits"`
21
+ Annotations map [string ]string `json:"annotations,omitempty" yaml:"annotations,omitempty" `
22
+ ContainerEdits ContainerEdits `json:"containerEdits" yaml:"containerEdits" `
23
23
}
24
24
25
25
// ContainerEdits are edits a container runtime must make to the OCI spec to expose the device.
26
26
type ContainerEdits struct {
27
- Env []string `json:"env,omitempty"`
28
- DeviceNodes []* DeviceNode `json:"deviceNodes,omitempty"`
29
- Hooks []* Hook `json:"hooks,omitempty"`
30
- Mounts []* Mount `json:"mounts,omitempty"`
31
- IntelRdt * IntelRdt `json:"intelRdt,omitempty"` // Added in v0.7.0
32
- AdditionalGIDs []uint32 `json:"additionalGids,omitempty"` // Added in v0.7.0
27
+ Env []string `json:"env,omitempty" yaml:"env,omitempty" `
28
+ DeviceNodes []* DeviceNode `json:"deviceNodes,omitempty" yaml:"deviceNodes,omitempty" `
29
+ Hooks []* Hook `json:"hooks,omitempty" yaml:"hooks,omitempty" `
30
+ Mounts []* Mount `json:"mounts,omitempty" yaml:"mounts,omitempty" `
31
+ IntelRdt * IntelRdt `json:"intelRdt,omitempty" yaml:"intelRdt,omitempty" ` // Added in v0.7.0
32
+ AdditionalGIDs []uint32 `json:"additionalGids,omitempty" yaml:"additionalGids,omitempty" ` // Added in v0.7.0
33
33
}
34
34
35
35
// DeviceNode represents a device node that needs to be added to the OCI spec.
36
36
type DeviceNode struct {
37
- Path string `json:"path"`
38
- HostPath string `json:"hostPath,omitempty"` // Added in v0.5.0
39
- Type string `json:"type,omitempty"`
40
- Major int64 `json:"major,omitempty"`
41
- Minor int64 `json:"minor,omitempty"`
42
- FileMode * os.FileMode `json:"fileMode,omitempty"`
43
- Permissions string `json:"permissions,omitempty"`
44
- UID * uint32 `json:"uid,omitempty"`
45
- GID * uint32 `json:"gid,omitempty"`
37
+ Path string `json:"path" yaml:"path" `
38
+ HostPath string `json:"hostPath,omitempty" yaml:"hostPath,omitempty" ` // Added in v0.5.0
39
+ Type string `json:"type,omitempty" yaml:"type,omitempty" `
40
+ Major int64 `json:"major,omitempty" yaml:"major,omitempty" `
41
+ Minor int64 `json:"minor,omitempty" yaml:"minor,omitempty" `
42
+ FileMode * os.FileMode `json:"fileMode,omitempty" yaml:"fileMode,omitempty" `
43
+ Permissions string `json:"permissions,omitempty" yaml:"permissions,omitempty" `
44
+ UID * uint32 `json:"uid,omitempty" yaml:"uid,omitempty" `
45
+ GID * uint32 `json:"gid,omitempty" yaml:"gid,omitempty" `
46
46
}
47
47
48
48
// Mount represents a mount that needs to be added to the OCI spec.
49
49
type Mount struct {
50
- HostPath string `json:"hostPath"`
51
- ContainerPath string `json:"containerPath"`
52
- Options []string `json:"options,omitempty"`
53
- Type string `json:"type,omitempty"` // Added in v0.4.0
50
+ HostPath string `json:"hostPath" yaml:"hostPath" `
51
+ ContainerPath string `json:"containerPath" yaml:"containerPath" `
52
+ Options []string `json:"options,omitempty" yaml:"options,omitempty" `
53
+ Type string `json:"type,omitempty" yaml:"type,omitempty" ` // Added in v0.4.0
54
54
}
55
55
56
56
// Hook represents a hook that needs to be added to the OCI spec.
57
57
type Hook struct {
58
- HookName string `json:"hookName"`
59
- Path string `json:"path"`
60
- Args []string `json:"args,omitempty"`
61
- Env []string `json:"env,omitempty"`
62
- Timeout * int `json:"timeout,omitempty"`
58
+ HookName string `json:"hookName" yaml:"hookName" `
59
+ Path string `json:"path" yaml:"path" `
60
+ Args []string `json:"args,omitempty" yaml:"args,omitempty" `
61
+ Env []string `json:"env,omitempty" yaml:"env,omitempty" `
62
+ Timeout * int `json:"timeout,omitempty" yaml:"timeout,omitempty" `
63
63
}
64
64
65
65
// IntelRdt describes the Linux IntelRdt parameters to set in the OCI spec.
66
66
type IntelRdt struct {
67
- ClosID string `json:"closID,omitempty"`
68
- L3CacheSchema string `json:"l3CacheSchema,omitempty"`
69
- MemBwSchema string `json:"memBwSchema,omitempty"`
70
- EnableCMT bool `json:"enableCMT,omitempty"`
71
- EnableMBM bool `json:"enableMBM,omitempty"`
67
+ ClosID string `json:"closID,omitempty" yaml:"closID,omitempty" `
68
+ L3CacheSchema string `json:"l3CacheSchema,omitempty" yaml:"l3CacheSchema,omitempty" `
69
+ MemBwSchema string `json:"memBwSchema,omitempty" yaml:"memBwSchema,omitempty" `
70
+ EnableCMT bool `json:"enableCMT,omitempty" yaml:"enableCMT,omitempty" `
71
+ EnableMBM bool `json:"enableMBM,omitempty" yaml:"enableMBM,omitempty" `
72
72
}
0 commit comments