@@ -47,7 +47,7 @@ type Process struct {
4747 // Capabilities are Linux capabilities that are kept for the container.
4848 Capabilities []string `json:"capabilities,omitempty" platform:"linux"`
4949 // Rlimits specifies rlimit options to apply to the process.
50- Rlimits []Rlimit `json:"rlimits,omitempty" platform:"linux"`
50+ Rlimits []LinuxRlimit `json:"rlimits,omitempty" platform:"linux"`
5151 // NoNewPrivileges controls whether additional privileges could be gained by processes in the container.
5252 NoNewPrivileges bool `json:"noNewPrivileges,omitempty" platform:"linux"`
5353 // ApparmorProfile specifies the apparmor profile for the container.
@@ -128,24 +128,24 @@ type Hooks struct {
128128// Linux contains platform specific configuration for Linux based containers.
129129type Linux struct {
130130 // UIDMapping specifies user mappings for supporting user namespaces on Linux.
131- UIDMappings []IDMapping `json:"uidMappings,omitempty"`
131+ UIDMappings []LinuxIDMapping `json:"uidMappings,omitempty"`
132132 // GIDMapping specifies group mappings for supporting user namespaces on Linux.
133- GIDMappings []IDMapping `json:"gidMappings,omitempty"`
133+ GIDMappings []LinuxIDMapping `json:"gidMappings,omitempty"`
134134 // Sysctl are a set of key value pairs that are set for the container on start
135135 Sysctl map [string ]string `json:"sysctl,omitempty"`
136136 // Resources contain cgroup information for handling resource constraints
137137 // for the container
138- Resources * Resources `json:"resources,omitempty"`
138+ Resources * LinuxResources `json:"resources,omitempty"`
139139 // CgroupsPath specifies the path to cgroups that are created and/or joined by the container.
140140 // The path is expected to be relative to the cgroups mountpoint.
141141 // If resources are specified, the cgroups at CgroupsPath will be updated based on resources.
142142 CgroupsPath * string `json:"cgroupsPath,omitempty"`
143143 // Namespaces contains the namespaces that are created and/or joined by the container
144- Namespaces []Namespace `json:"namespaces,omitempty"`
144+ Namespaces []LinuxNamespace `json:"namespaces,omitempty"`
145145 // Devices are a list of device nodes that are created for the container
146- Devices []Device `json:"devices,omitempty"`
146+ Devices []LinuxDevice `json:"devices,omitempty"`
147147 // Seccomp specifies the seccomp security settings for the container.
148- Seccomp * Seccomp `json:"seccomp,omitempty"`
148+ Seccomp * LinuxSeccomp `json:"seccomp,omitempty"`
149149 // RootfsPropagation is the rootfs mount propagation mode for the container.
150150 RootfsPropagation string `json:"rootfsPropagation,omitempty"`
151151 // MaskedPaths masks over the provided paths inside the container.
@@ -156,21 +156,21 @@ type Linux struct {
156156 MountLabel string `json:"mountLabel,omitempty"`
157157}
158158
159- // Namespace is the configuration for a Linux namespace
160- type Namespace struct {
159+ // LinuxNamespace is the configuration for a Linux namespace
160+ type LinuxNamespace struct {
161161 // Type is the type of Linux namespace
162- Type NamespaceType `json:"type"`
162+ Type LinuxNamespaceType `json:"type"`
163163 // Path is a path to an existing namespace persisted on disk that can be joined
164164 // and is of the same type
165165 Path string `json:"path,omitempty"`
166166}
167167
168- // NamespaceType is one of the Linux namespaces
169- type NamespaceType string
168+ // LinuxNamespaceType is one of the Linux namespaces
169+ type LinuxNamespaceType string
170170
171171const (
172172 // PIDNamespace for isolating process IDs
173- PIDNamespace NamespaceType = "pid"
173+ PIDNamespace LinuxNamespaceType = "pid"
174174 // NetworkNamespace for isolating network devices, stacks, ports, etc
175175 NetworkNamespace = "network"
176176 // MountNamespace for isolating mount points
@@ -185,8 +185,8 @@ const (
185185 CgroupNamespace = "cgroup"
186186)
187187
188- // IDMapping specifies UID/GID mappings
189- type IDMapping struct {
188+ // LinuxIDMapping specifies UID/GID mappings
189+ type LinuxIDMapping struct {
190190 // HostID is the UID/GID of the host user or group
191191 HostID uint32 `json:"hostID"`
192192 // ContainerID is the UID/GID of the container's user or group
@@ -195,8 +195,8 @@ type IDMapping struct {
195195 Size uint32 `json:"size"`
196196}
197197
198- // Rlimit type and restrictions
199- type Rlimit struct {
198+ // LinuxRlimit type and restrictions
199+ type LinuxRlimit struct {
200200 // Type of the rlimit to set
201201 Type string `json:"type"`
202202 // Hard is the hard limit for the specified type
@@ -205,66 +205,66 @@ type Rlimit struct {
205205 Soft uint64 `json:"soft"`
206206}
207207
208- // HugepageLimit structure corresponds to limiting kernel hugepages
209- type HugepageLimit struct {
208+ // LinuxHugepageLimit structure corresponds to limiting kernel hugepages
209+ type LinuxHugepageLimit struct {
210210 // Pagesize is the hugepage size
211211 Pagesize * string `json:"pageSize,omitempty"`
212212 // Limit is the limit of "hugepagesize" hugetlb usage
213213 Limit * uint64 `json:"limit,omitempty"`
214214}
215215
216- // InterfacePriority for network interfaces
217- type InterfacePriority struct {
216+ // LinuxInterfacePriority for network interfaces
217+ type LinuxInterfacePriority struct {
218218 // Name is the name of the network interface
219219 Name string `json:"name"`
220220 // Priority for the interface
221221 Priority uint32 `json:"priority"`
222222}
223223
224- // blockIODevice holds major:minor format supported in blkio cgroup
225- type blockIODevice struct {
224+ // linuxBlockIODevice holds major:minor format supported in blkio cgroup
225+ type linuxBlockIODevice struct {
226226 // Major is the device's major number.
227227 Major int64 `json:"major"`
228228 // Minor is the device's minor number.
229229 Minor int64 `json:"minor"`
230230}
231231
232- // WeightDevice struct holds a `major:minor weight` pair for blkioWeightDevice
233- type WeightDevice struct {
234- blockIODevice
232+ // LinuxWeightDevice struct holds a `major:minor weight` pair for blkioWeightDevice
233+ type LinuxWeightDevice struct {
234+ linuxBlockIODevice
235235 // Weight is the bandwidth rate for the device, range is from 10 to 1000
236236 Weight * uint16 `json:"weight,omitempty"`
237237 // 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
238238 LeafWeight * uint16 `json:"leafWeight,omitempty"`
239239}
240240
241- // ThrottleDevice struct holds a `major:minor rate_per_second` pair
242- type ThrottleDevice struct {
243- blockIODevice
241+ // LinuxThrottleDevice struct holds a `major:minor rate_per_second` pair
242+ type LinuxThrottleDevice struct {
243+ linuxBlockIODevice
244244 // Rate is the IO rate limit per cgroup per device
245245 Rate * uint64 `json:"rate,omitempty"`
246246}
247247
248- // BlockIO for Linux cgroup 'blkio' resource management
249- type BlockIO struct {
248+ // LinuxBlockIO for Linux cgroup 'blkio' resource management
249+ type LinuxBlockIO struct {
250250 // Specifies per cgroup weight, range is from 10 to 1000
251251 Weight * uint16 `json:"blkioWeight,omitempty"`
252252 // Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only
253253 LeafWeight * uint16 `json:"blkioLeafWeight,omitempty"`
254254 // Weight per cgroup per device, can override BlkioWeight
255- WeightDevice []WeightDevice `json:"blkioWeightDevice,omitempty"`
255+ WeightDevice []LinuxWeightDevice `json:"blkioWeightDevice,omitempty"`
256256 // IO read rate limit per cgroup per device, bytes per second
257- ThrottleReadBpsDevice []ThrottleDevice `json:"blkioThrottleReadBpsDevice,omitempty"`
257+ ThrottleReadBpsDevice []LinuxThrottleDevice `json:"blkioThrottleReadBpsDevice,omitempty"`
258258 // IO write rate limit per cgroup per device, bytes per second
259- ThrottleWriteBpsDevice []ThrottleDevice `json:"blkioThrottleWriteBpsDevice,omitempty"`
259+ ThrottleWriteBpsDevice []LinuxThrottleDevice `json:"blkioThrottleWriteBpsDevice,omitempty"`
260260 // IO read rate limit per cgroup per device, IO per second
261- ThrottleReadIOPSDevice []ThrottleDevice `json:"blkioThrottleReadIOPSDevice,omitempty"`
261+ ThrottleReadIOPSDevice []LinuxThrottleDevice `json:"blkioThrottleReadIOPSDevice,omitempty"`
262262 // IO write rate limit per cgroup per device, IO per second
263- ThrottleWriteIOPSDevice []ThrottleDevice `json:"blkioThrottleWriteIOPSDevice,omitempty"`
263+ ThrottleWriteIOPSDevice []LinuxThrottleDevice `json:"blkioThrottleWriteIOPSDevice,omitempty"`
264264}
265265
266- // Memory for Linux cgroup 'memory' resource management
267- type Memory struct {
266+ // LinuxMemory for Linux cgroup 'memory' resource management
267+ type LinuxMemory struct {
268268 // Memory limit (in bytes).
269269 Limit * uint64 `json:"limit,omitempty"`
270270 // Memory reservation or soft_limit (in bytes).
@@ -279,8 +279,8 @@ type Memory struct {
279279 Swappiness * uint64 `json:"swappiness,omitempty"`
280280}
281281
282- // CPU for Linux cgroup 'cpu' resource management
283- type CPU struct {
282+ // LinuxCPU for Linux cgroup 'cpu' resource management
283+ type LinuxCPU struct {
284284 // CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
285285 Shares * uint64 `json:"shares,omitempty"`
286286 // CPU hardcap limit (in usecs). Allowed cpu time in a given period.
@@ -297,44 +297,44 @@ type CPU struct {
297297 Mems * string `json:"mems,omitempty"`
298298}
299299
300- // Pids for Linux cgroup 'pids' resource management (Linux 4.3)
301- type Pids struct {
300+ // LinuxPids for Linux cgroup 'pids' resource management (Linux 4.3)
301+ type LinuxPids struct {
302302 // Maximum number of PIDs. Default is "no limit".
303303 Limit * int64 `json:"limit,omitempty"`
304304}
305305
306- // Network identification and priority configuration
307- type Network struct {
306+ // LinuxNetwork identification and priority configuration
307+ type LinuxNetwork struct {
308308 // Set class identifier for container's network packets
309309 ClassID * uint32 `json:"classID,omitempty"`
310310 // Set priority of network traffic for container
311- Priorities []InterfacePriority `json:"priorities,omitempty"`
311+ Priorities []LinuxInterfacePriority `json:"priorities,omitempty"`
312312}
313313
314- // Resources has container runtime resource constraints
315- type Resources struct {
314+ // LinuxResources has container runtime resource constraints
315+ type LinuxResources struct {
316316 // Devices configures the device whitelist.
317- Devices []DeviceCgroup `json:"devices,omitempty"`
317+ Devices []LinuxDeviceCgroup `json:"devices,omitempty"`
318318 // DisableOOMKiller disables the OOM killer for out of memory conditions
319319 DisableOOMKiller * bool `json:"disableOOMKiller,omitempty"`
320320 // Specify an oom_score_adj for the container.
321321 OOMScoreAdj * int `json:"oomScoreAdj,omitempty"`
322322 // Memory restriction configuration
323- Memory * Memory `json:"memory,omitempty"`
323+ Memory * LinuxMemory `json:"memory,omitempty"`
324324 // CPU resource restriction configuration
325- CPU * CPU `json:"cpu,omitempty"`
325+ CPU * LinuxCPU `json:"cpu,omitempty"`
326326 // Task resource restriction configuration.
327- Pids * Pids `json:"pids,omitempty"`
327+ Pids * LinuxPids `json:"pids,omitempty"`
328328 // BlockIO restriction configuration
329- BlockIO * BlockIO `json:"blockIO,omitempty"`
329+ BlockIO * LinuxBlockIO `json:"blockIO,omitempty"`
330330 // Hugetlb limit (in bytes)
331- HugepageLimits []HugepageLimit `json:"hugepageLimits,omitempty"`
331+ HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"`
332332 // Network restriction configuration
333- Network * Network `json:"network,omitempty"`
333+ Network * LinuxNetwork `json:"network,omitempty"`
334334}
335335
336- // Device represents the mknod information for a Linux special device file
337- type Device struct {
336+ // LinuxDevice represents the mknod information for a Linux special device file
337+ type LinuxDevice struct {
338338 // Path to the device.
339339 Path string `json:"path"`
340340 // Device type, block, char, etc.
@@ -351,8 +351,8 @@ type Device struct {
351351 GID * uint32 `json:"gid,omitempty"`
352352}
353353
354- // DeviceCgroup represents a device rule for the whitelist controller
355- type DeviceCgroup struct {
354+ // LinuxDeviceCgroup represents a device rule for the whitelist controller
355+ type LinuxDeviceCgroup struct {
356356 // Allow or deny
357357 Allow bool `json:"allow"`
358358 // Device type, block, char, etc.
@@ -365,11 +365,11 @@ type DeviceCgroup struct {
365365 Access * string `json:"access,omitempty"`
366366}
367367
368- // Seccomp represents syscall restrictions
369- type Seccomp struct {
370- DefaultAction Action `json:"defaultAction"`
371- Architectures []Arch `json:"architectures"`
372- Syscalls []Syscall `json:"syscalls,omitempty"`
368+ // LinuxSeccomp represents syscall restrictions
369+ type LinuxSeccomp struct {
370+ DefaultAction LinuxSeccompAction `json:"defaultAction"`
371+ Architectures []Arch `json:"architectures"`
372+ Syscalls []LinuxSyscall `json:"syscalls,omitempty"`
373373}
374374
375375// Solaris contains platform specific configuration for Solaris application containers.
@@ -381,26 +381,26 @@ type Solaris struct {
381381 // The maximum amount of shared memory allowed for this container.
382382 MaxShmMemory string `json:"maxShmMemory,omitempty"`
383383 // Specification for automatic creation of network resources for this container.
384- Anet []Anet `json:"anet,omitempty"`
384+ Anet []SolarisAnet `json:"anet,omitempty"`
385385 // Set limit on the amount of CPU time that can be used by container.
386- CappedCPU * CappedCPU `json:"cappedCPU,omitempty"`
386+ CappedCPU * SolarisCappedCPU `json:"cappedCPU,omitempty"`
387387 // The physical and swap caps on the memory that can be used by this container.
388- CappedMemory * CappedMemory `json:"cappedMemory,omitempty"`
388+ CappedMemory * SolarisCappedMemory `json:"cappedMemory,omitempty"`
389389}
390390
391- // CappedCPU allows users to set limit on the amount of CPU time that can be used by container.
392- type CappedCPU struct {
391+ // SolarisCappedCPU allows users to set limit on the amount of CPU time that can be used by container.
392+ type SolarisCappedCPU struct {
393393 Ncpus string `json:"ncpus,omitempty"`
394394}
395395
396- // CappedMemory allows users to set the physical and swap caps on the memory that can be used by this container.
397- type CappedMemory struct {
396+ // SolarisCappedMemory allows users to set the physical and swap caps on the memory that can be used by this container.
397+ type SolarisCappedMemory struct {
398398 Physical string `json:"physical,omitempty"`
399399 Swap string `json:"swap,omitempty"`
400400}
401401
402- // Anet provides the specification for automatic creation of network resources for this container.
403- type Anet struct {
402+ // SolarisAnet provides the specification for automatic creation of network resources for this container.
403+ type SolarisAnet struct {
404404 // Specify a name for the automatically created VNIC datalink.
405405 Linkname string `json:"linkname,omitempty"`
406406 // Specify the link over which the VNIC will be created.
@@ -493,43 +493,43 @@ const (
493493 ArchS390X Arch = "SCMP_ARCH_S390X"
494494)
495495
496- // Action taken upon Seccomp rule match
497- type Action string
496+ // LinuxSeccompAction taken upon Seccomp rule match
497+ type LinuxSeccompAction string
498498
499499// Define actions for Seccomp rules
500500const (
501- ActKill Action = "SCMP_ACT_KILL"
502- ActTrap Action = "SCMP_ACT_TRAP"
503- ActErrno Action = "SCMP_ACT_ERRNO"
504- ActTrace Action = "SCMP_ACT_TRACE"
505- ActAllow Action = "SCMP_ACT_ALLOW"
501+ ActKill LinuxSeccompAction = "SCMP_ACT_KILL"
502+ ActTrap LinuxSeccompAction = "SCMP_ACT_TRAP"
503+ ActErrno LinuxSeccompAction = "SCMP_ACT_ERRNO"
504+ ActTrace LinuxSeccompAction = "SCMP_ACT_TRACE"
505+ ActAllow LinuxSeccompAction = "SCMP_ACT_ALLOW"
506506)
507507
508- // Operator used to match syscall arguments in Seccomp
509- type Operator string
508+ // LinuxOperatorOperator used to match syscall arguments in Seccomp
509+ type LinuxSeccompOperator string
510510
511511// Define operators for syscall arguments in Seccomp
512512const (
513- OpNotEqual Operator = "SCMP_CMP_NE"
514- OpLessThan Operator = "SCMP_CMP_LT"
515- OpLessEqual Operator = "SCMP_CMP_LE"
516- OpEqualTo Operator = "SCMP_CMP_EQ"
517- OpGreaterEqual Operator = "SCMP_CMP_GE"
518- OpGreaterThan Operator = "SCMP_CMP_GT"
519- OpMaskedEqual Operator = "SCMP_CMP_MASKED_EQ"
513+ OpNotEqual LinuxSeccompOperator = "SCMP_CMP_NE"
514+ OpLessThan LinuxSeccompOperator = "SCMP_CMP_LT"
515+ OpLessEqual LinuxSeccompOperator = "SCMP_CMP_LE"
516+ OpEqualTo LinuxSeccompOperator = "SCMP_CMP_EQ"
517+ OpGreaterEqual LinuxSeccompOperator = "SCMP_CMP_GE"
518+ OpGreaterThan LinuxSeccompOperator = "SCMP_CMP_GT"
519+ OpMaskedEqual LinuxSeccompOperator = "SCMP_CMP_MASKED_EQ"
520520)
521521
522522// Arg used for matching specific syscall arguments in Seccomp
523- type Arg struct {
524- Index uint `json:"index"`
525- Value uint64 `json:"value"`
526- ValueTwo uint64 `json:"valueTwo"`
527- Op Operator `json:"op"`
528- }
529-
530- // Syscall is used to match a syscall in Seccomp
531- type Syscall struct {
532- Name string `json:"name"`
533- Action Action `json:"action"`
534- Args []Arg `json:"args,omitempty"`
523+ type LinuxSeccompArg struct {
524+ Index uint `json:"index"`
525+ Value uint64 `json:"value"`
526+ ValueTwo uint64 `json:"valueTwo"`
527+ Op LinuxSeccompOperator `json:"op"`
528+ }
529+
530+ // LinuxSyscall is used to match a syscall in Seccomp
531+ type LinuxSyscall struct {
532+ Name string `json:"name"`
533+ Action LinuxSeccompAction `json:"action"`
534+ Args []LinuxSeccompArg `json:"args,omitempty"`
535535}
0 commit comments