@@ -43,7 +43,7 @@ type Process struct {
4343 // Capabilities are Linux capabilities that are kept for the container.
4444 Capabilities []string `json:"capabilities,omitempty" platform:"linux"`
4545 // Rlimits specifies rlimit options to apply to the process.
46- Rlimits []Rlimit `json:"rlimits,omitempty" platform:"linux"`
46+ Rlimits []LinuxRlimit `json:"rlimits,omitempty" platform:"linux"`
4747 // NoNewPrivileges controls whether additional privileges could be gained by processes in the container.
4848 NoNewPrivileges bool `json:"noNewPrivileges,omitempty" platform:"linux"`
4949 // ApparmorProfile specifies the apparmor profile for the container.
@@ -116,24 +116,24 @@ type Hooks struct {
116116// Linux contains platform specific configuration for Linux based containers.
117117type Linux struct {
118118 // UIDMapping specifies user mappings for supporting user namespaces on Linux.
119- UIDMappings []IDMapping `json:"uidMappings,omitempty"`
119+ UIDMappings []LinuxIDMapping `json:"uidMappings,omitempty"`
120120 // GIDMapping specifies group mappings for supporting user namespaces on Linux.
121- GIDMappings []IDMapping `json:"gidMappings,omitempty"`
121+ GIDMappings []LinuxIDMapping `json:"gidMappings,omitempty"`
122122 // Sysctl are a set of key value pairs that are set for the container on start
123123 Sysctl map [string ]string `json:"sysctl,omitempty"`
124124 // Resources contain cgroup information for handling resource constraints
125125 // for the container
126- Resources * Resources `json:"resources,omitempty"`
126+ Resources * LinuxResources `json:"resources,omitempty"`
127127 // CgroupsPath specifies the path to cgroups that are created and/or joined by the container.
128128 // The path is expected to be relative to the cgroups mountpoint.
129129 // If resources are specified, the cgroups at CgroupsPath will be updated based on resources.
130130 CgroupsPath * string `json:"cgroupsPath,omitempty"`
131131 // Namespaces contains the namespaces that are created and/or joined by the container
132- Namespaces []Namespace `json:"namespaces,omitempty"`
132+ Namespaces []LinuxNamespace `json:"namespaces,omitempty"`
133133 // Devices are a list of device nodes that are created for the container
134- Devices []Device `json:"devices,omitempty"`
134+ Devices []LinuxDevice `json:"devices,omitempty"`
135135 // Seccomp specifies the seccomp security settings for the container.
136- Seccomp * Seccomp `json:"seccomp,omitempty"`
136+ Seccomp * LinuxSeccomp `json:"seccomp,omitempty"`
137137 // RootfsPropagation is the rootfs mount propagation mode for the container.
138138 RootfsPropagation string `json:"rootfsPropagation,omitempty"`
139139 // MaskedPaths masks over the provided paths inside the container.
@@ -144,21 +144,21 @@ type Linux struct {
144144 MountLabel string `json:"mountLabel,omitempty"`
145145}
146146
147- // Namespace is the configuration for a Linux namespace
148- type Namespace struct {
147+ // LinuxNamespace is the configuration for a Linux namespace
148+ type LinuxNamespace struct {
149149 // Type is the type of Linux namespace
150- Type NamespaceType `json:"type"`
150+ Type LinuxNamespaceType `json:"type"`
151151 // Path is a path to an existing namespace persisted on disk that can be joined
152152 // and is of the same type
153153 Path string `json:"path,omitempty"`
154154}
155155
156- // NamespaceType is one of the Linux namespaces
157- type NamespaceType string
156+ // LinuxNamespaceType is one of the Linux namespaces
157+ type LinuxNamespaceType string
158158
159159const (
160160 // PIDNamespace for isolating process IDs
161- PIDNamespace NamespaceType = "pid"
161+ PIDNamespace LinuxNamespaceType = "pid"
162162 // NetworkNamespace for isolating network devices, stacks, ports, etc
163163 NetworkNamespace = "network"
164164 // MountNamespace for isolating mount points
@@ -173,8 +173,8 @@ const (
173173 CgroupNamespace = "cgroup"
174174)
175175
176- // IDMapping specifies UID/GID mappings
177- type IDMapping struct {
176+ // LinuxIDMapping specifies UID/GID mappings
177+ type LinuxIDMapping struct {
178178 // HostID is the UID/GID of the host user or group
179179 HostID uint32 `json:"hostID"`
180180 // ContainerID is the UID/GID of the container's user or group
@@ -183,8 +183,8 @@ type IDMapping struct {
183183 Size uint32 `json:"size"`
184184}
185185
186- // Rlimit type and restrictions
187- type Rlimit struct {
186+ // LinuxRlimit type and restrictions
187+ type LinuxRlimit struct {
188188 // Type of the rlimit to set
189189 Type string `json:"type"`
190190 // Hard is the hard limit for the specified type
@@ -193,66 +193,66 @@ type Rlimit struct {
193193 Soft uint64 `json:"soft"`
194194}
195195
196- // HugepageLimit structure corresponds to limiting kernel hugepages
197- type HugepageLimit struct {
196+ // LinuxHugepageLimit structure corresponds to limiting kernel hugepages
197+ type LinuxHugepageLimit struct {
198198 // Pagesize is the hugepage size
199199 Pagesize * string `json:"pageSize,omitempty"`
200200 // Limit is the limit of "hugepagesize" hugetlb usage
201201 Limit * uint64 `json:"limit,omitempty"`
202202}
203203
204- // InterfacePriority for network interfaces
205- type InterfacePriority struct {
204+ // LinuxInterfacePriority for network interfaces
205+ type LinuxInterfacePriority struct {
206206 // Name is the name of the network interface
207207 Name string `json:"name"`
208208 // Priority for the interface
209209 Priority uint32 `json:"priority"`
210210}
211211
212- // blockIODevice holds major:minor format supported in blkio cgroup
213- type blockIODevice struct {
212+ // linuxBlockIODevice holds major:minor format supported in blkio cgroup
213+ type linuxBlockIODevice struct {
214214 // Major is the device's major number.
215215 Major int64 `json:"major"`
216216 // Minor is the device's minor number.
217217 Minor int64 `json:"minor"`
218218}
219219
220- // WeightDevice struct holds a `major:minor weight` pair for blkioWeightDevice
221- type WeightDevice struct {
222- blockIODevice
220+ // LinuxWeightDevice struct holds a `major:minor weight` pair for blkioWeightDevice
221+ type LinuxWeightDevice struct {
222+ linuxBlockIODevice
223223 // Weight is the bandwidth rate for the device, range is from 10 to 1000
224224 Weight * uint16 `json:"weight,omitempty"`
225225 // LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only
226226 LeafWeight * uint16 `json:"leafWeight,omitempty"`
227227}
228228
229- // ThrottleDevice struct holds a `major:minor rate_per_second` pair
230- type ThrottleDevice struct {
231- blockIODevice
229+ // LinuxThrottleDevice struct holds a `major:minor rate_per_second` pair
230+ type LinuxThrottleDevice struct {
231+ linuxBlockIODevice
232232 // Rate is the IO rate limit per cgroup per device
233233 Rate * uint64 `json:"rate,omitempty"`
234234}
235235
236- // BlockIO for Linux cgroup 'blkio' resource management
237- type BlockIO struct {
236+ // LinuxBlockIO for Linux cgroup 'blkio' resource management
237+ type LinuxBlockIO struct {
238238 // Specifies per cgroup weight, range is from 10 to 1000
239239 Weight * uint16 `json:"blkioWeight,omitempty"`
240240 // Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only
241241 LeafWeight * uint16 `json:"blkioLeafWeight,omitempty"`
242242 // Weight per cgroup per device, can override BlkioWeight
243- WeightDevice []WeightDevice `json:"blkioWeightDevice,omitempty"`
243+ WeightDevice []LinuxWeightDevice `json:"blkioWeightDevice,omitempty"`
244244 // IO read rate limit per cgroup per device, bytes per second
245- ThrottleReadBpsDevice []ThrottleDevice `json:"blkioThrottleReadBpsDevice,omitempty"`
245+ ThrottleReadBpsDevice []LinuxThrottleDevice `json:"blkioThrottleReadBpsDevice,omitempty"`
246246 // IO write rate limit per cgroup per device, bytes per second
247- ThrottleWriteBpsDevice []ThrottleDevice `json:"blkioThrottleWriteBpsDevice,omitempty"`
247+ ThrottleWriteBpsDevice []LinuxThrottleDevice `json:"blkioThrottleWriteBpsDevice,omitempty"`
248248 // IO read rate limit per cgroup per device, IO per second
249- ThrottleReadIOPSDevice []ThrottleDevice `json:"blkioThrottleReadIOPSDevice,omitempty"`
249+ ThrottleReadIOPSDevice []LinuxThrottleDevice `json:"blkioThrottleReadIOPSDevice,omitempty"`
250250 // IO write rate limit per cgroup per device, IO per second
251- ThrottleWriteIOPSDevice []ThrottleDevice `json:"blkioThrottleWriteIOPSDevice,omitempty"`
251+ ThrottleWriteIOPSDevice []LinuxThrottleDevice `json:"blkioThrottleWriteIOPSDevice,omitempty"`
252252}
253253
254- // Memory for Linux cgroup 'memory' resource management
255- type Memory struct {
254+ // LinuxMemory for Linux cgroup 'memory' resource management
255+ type LinuxMemory struct {
256256 // Memory limit (in bytes).
257257 Limit * uint64 `json:"limit,omitempty"`
258258 // Memory reservation or soft_limit (in bytes).
@@ -267,8 +267,8 @@ type Memory struct {
267267 Swappiness * uint64 `json:"swappiness,omitempty"`
268268}
269269
270- // CPU for Linux cgroup 'cpu' resource management
271- type CPU struct {
270+ // LinuxCPU for Linux cgroup 'cpu' resource management
271+ type LinuxCPU struct {
272272 // CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
273273 Shares * uint64 `json:"shares,omitempty"`
274274 // CPU hardcap limit (in usecs). Allowed cpu time in a given period.
@@ -285,44 +285,44 @@ type CPU struct {
285285 Mems * string `json:"mems,omitempty"`
286286}
287287
288- // Pids for Linux cgroup 'pids' resource management (Linux 4.3)
289- type Pids struct {
288+ // LinuxPids for Linux cgroup 'pids' resource management (Linux 4.3)
289+ type LinuxPids struct {
290290 // Maximum number of PIDs. Default is "no limit".
291291 Limit * int64 `json:"limit,omitempty"`
292292}
293293
294- // Network identification and priority configuration
295- type Network struct {
294+ // LinuxNetwork identification and priority configuration
295+ type LinuxNetwork struct {
296296 // Set class identifier for container's network packets
297297 ClassID * uint32 `json:"classID,omitempty"`
298298 // Set priority of network traffic for container
299- Priorities []InterfacePriority `json:"priorities,omitempty"`
299+ Priorities []LinuxInterfacePriority `json:"priorities,omitempty"`
300300}
301301
302- // Resources has container runtime resource constraints
303- type Resources struct {
302+ // LinuxResources has container runtime resource constraints
303+ type LinuxResources struct {
304304 // Devices configures the device whitelist.
305- Devices []DeviceCgroup `json:"devices,omitempty"`
305+ Devices []LinuxDeviceCgroup `json:"devices,omitempty"`
306306 // DisableOOMKiller disables the OOM killer for out of memory conditions
307307 DisableOOMKiller * bool `json:"disableOOMKiller,omitempty"`
308308 // Specify an oom_score_adj for the container.
309309 OOMScoreAdj * int `json:"oomScoreAdj,omitempty"`
310310 // Memory restriction configuration
311- Memory * Memory `json:"memory,omitempty"`
311+ Memory * LinuxMemory `json:"memory,omitempty"`
312312 // CPU resource restriction configuration
313- CPU * CPU `json:"cpu,omitempty"`
313+ CPU * LinuxCPU `json:"cpu,omitempty"`
314314 // Task resource restriction configuration.
315- Pids * Pids `json:"pids,omitempty"`
315+ Pids * LinuxPids `json:"pids,omitempty"`
316316 // BlockIO restriction configuration
317- BlockIO * BlockIO `json:"blockIO,omitempty"`
317+ BlockIO * LinuxBlockIO `json:"blockIO,omitempty"`
318318 // Hugetlb limit (in bytes)
319- HugepageLimits []HugepageLimit `json:"hugepageLimits,omitempty"`
319+ HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"`
320320 // Network restriction configuration
321- Network * Network `json:"network,omitempty"`
321+ Network * LinuxNetwork `json:"network,omitempty"`
322322}
323323
324- // Device represents the mknod information for a Linux special device file
325- type Device struct {
324+ // LinuxDevice represents the mknod information for a Linux special device file
325+ type LinuxDevice struct {
326326 // Path to the device.
327327 Path string `json:"path"`
328328 // Device type, block, char, etc.
@@ -339,8 +339,8 @@ type Device struct {
339339 GID * uint32 `json:"gid,omitempty"`
340340}
341341
342- // DeviceCgroup represents a device rule for the whitelist controller
343- type DeviceCgroup struct {
342+ // LinuxDeviceCgroup represents a device rule for the whitelist controller
343+ type LinuxDeviceCgroup struct {
344344 // Allow or deny
345345 Allow bool `json:"allow"`
346346 // Device type, block, char, etc.
@@ -353,11 +353,11 @@ type DeviceCgroup struct {
353353 Access * string `json:"access,omitempty"`
354354}
355355
356- // Seccomp represents syscall restrictions
357- type Seccomp struct {
358- DefaultAction Action `json:"defaultAction"`
359- Architectures []Arch `json:"architectures"`
360- Syscalls []Syscall `json:"syscalls,omitempty"`
356+ // LinuxSeccomp represents syscall restrictions
357+ type LinuxSeccomp struct {
358+ DefaultAction LinuxSeccompAction `json:"defaultAction"`
359+ Architectures []Arch `json:"architectures"`
360+ Syscalls []LinuxSyscall `json:"syscalls,omitempty"`
361361}
362362
363363// Solaris contains platform specific configuration for Solaris application containers.
@@ -369,26 +369,26 @@ type Solaris struct {
369369 // The maximum amount of shared memory allowed for this container.
370370 MaxShmMemory string `json:"maxShmMemory,omitempty"`
371371 // Specification for automatic creation of network resources for this container.
372- Anet []Anet `json:"anet,omitempty"`
372+ Anet []SolarisAnet `json:"anet,omitempty"`
373373 // Set limit on the amount of CPU time that can be used by container.
374- CappedCPU * CappedCPU `json:"cappedCPU,omitempty"`
374+ CappedCPU * SolarisCappedCPU `json:"cappedCPU,omitempty"`
375375 // The physical and swap caps on the memory that can be used by this container.
376- CappedMemory * CappedMemory `json:"cappedMemory,omitempty"`
376+ CappedMemory * SolarisCappedMemory `json:"cappedMemory,omitempty"`
377377}
378378
379- // CappedCPU allows users to set limit on the amount of CPU time that can be used by container.
380- type CappedCPU struct {
379+ // SolarisCappedCPU allows users to set limit on the amount of CPU time that can be used by container.
380+ type SolarisCappedCPU struct {
381381 Ncpus string `json:"ncpus,omitempty"`
382382}
383383
384- // CappedMemory allows users to set the physical and swap caps on the memory that can be used by this container.
385- type CappedMemory struct {
384+ // SolarisCappedMemory allows users to set the physical and swap caps on the memory that can be used by this container.
385+ type SolarisCappedMemory struct {
386386 Physical string `json:"physical,omitempty"`
387387 Swap string `json:"swap,omitempty"`
388388}
389389
390- // Anet provides the specification for automatic creation of network resources for this container.
391- type Anet struct {
390+ // SolarisAnet provides the specification for automatic creation of network resources for this container.
391+ type SolarisAnet struct {
392392 // Specify a name for the automatically created VNIC datalink.
393393 Linkname string `json:"linkname,omitempty"`
394394 // Specify the link over which the VNIC will be created.
@@ -429,43 +429,43 @@ const (
429429 ArchS390X Arch = "SCMP_ARCH_S390X"
430430)
431431
432- // Action taken upon Seccomp rule match
433- type Action string
432+ // LinuxSeccompAction taken upon Seccomp rule match
433+ type LinuxSeccompAction string
434434
435435// Define actions for Seccomp rules
436436const (
437- ActKill Action = "SCMP_ACT_KILL"
438- ActTrap Action = "SCMP_ACT_TRAP"
439- ActErrno Action = "SCMP_ACT_ERRNO"
440- ActTrace Action = "SCMP_ACT_TRACE"
441- ActAllow Action = "SCMP_ACT_ALLOW"
437+ ActKill LinuxSeccompAction = "SCMP_ACT_KILL"
438+ ActTrap LinuxSeccompAction = "SCMP_ACT_TRAP"
439+ ActErrno LinuxSeccompAction = "SCMP_ACT_ERRNO"
440+ ActTrace LinuxSeccompAction = "SCMP_ACT_TRACE"
441+ ActAllow LinuxSeccompAction = "SCMP_ACT_ALLOW"
442442)
443443
444- // Operator used to match syscall arguments in Seccomp
445- type Operator string
444+ // LinuxOperatorOperator used to match syscall arguments in Seccomp
445+ type LinuxSeccompOperator string
446446
447447// Define operators for syscall arguments in Seccomp
448448const (
449- OpNotEqual Operator = "SCMP_CMP_NE"
450- OpLessThan Operator = "SCMP_CMP_LT"
451- OpLessEqual Operator = "SCMP_CMP_LE"
452- OpEqualTo Operator = "SCMP_CMP_EQ"
453- OpGreaterEqual Operator = "SCMP_CMP_GE"
454- OpGreaterThan Operator = "SCMP_CMP_GT"
455- OpMaskedEqual Operator = "SCMP_CMP_MASKED_EQ"
449+ OpNotEqual LinuxSeccompOperator = "SCMP_CMP_NE"
450+ OpLessThan LinuxSeccompOperator = "SCMP_CMP_LT"
451+ OpLessEqual LinuxSeccompOperator = "SCMP_CMP_LE"
452+ OpEqualTo LinuxSeccompOperator = "SCMP_CMP_EQ"
453+ OpGreaterEqual LinuxSeccompOperator = "SCMP_CMP_GE"
454+ OpGreaterThan LinuxSeccompOperator = "SCMP_CMP_GT"
455+ OpMaskedEqual LinuxSeccompOperator = "SCMP_CMP_MASKED_EQ"
456456)
457457
458458// Arg used for matching specific syscall arguments in Seccomp
459- type Arg struct {
460- Index uint `json:"index"`
461- Value uint64 `json:"value"`
462- ValueTwo uint64 `json:"valueTwo"`
463- Op Operator `json:"op"`
464- }
465-
466- // Syscall is used to match a syscall in Seccomp
467- type Syscall struct {
468- Name string `json:"name"`
469- Action Action `json:"action"`
470- Args []Arg `json:"args,omitempty"`
459+ type LinuxSeccompArg struct {
460+ Index uint `json:"index"`
461+ Value uint64 `json:"value"`
462+ ValueTwo uint64 `json:"valueTwo"`
463+ Op LinuxSeccompOperator `json:"op"`
464+ }
465+
466+ // LinuxSyscall is used to match a syscall in Seccomp
467+ type LinuxSyscall struct {
468+ Name string `json:"name"`
469+ Action LinuxSeccompAction `json:"action"`
470+ Args []LinuxSeccompArg `json:"args,omitempty"`
471471}
0 commit comments