config.go 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. package specs
  2. import "os"
  3. // Spec is the base configuration for the container.
  4. type Spec struct {
  5. // Version of the Open Container Runtime Specification with which the bundle complies.
  6. Version string `json:"ociVersion"`
  7. // Process configures the container process.
  8. Process *Process `json:"process,omitempty"`
  9. // Root configures the container's root filesystem.
  10. Root *Root `json:"root,omitempty"`
  11. // Hostname configures the container's hostname.
  12. Hostname string `json:"hostname,omitempty"`
  13. // Mounts configures additional mounts (on top of Root).
  14. Mounts []Mount `json:"mounts,omitempty"`
  15. // Hooks configures callbacks for container lifecycle events.
  16. Hooks *Hooks `json:"hooks,omitempty" platform:"linux,solaris"`
  17. // Annotations contains arbitrary metadata for the container.
  18. Annotations map[string]string `json:"annotations,omitempty"`
  19. // Linux is platform-specific configuration for Linux based containers.
  20. Linux *Linux `json:"linux,omitempty" platform:"linux"`
  21. // Solaris is platform-specific configuration for Solaris based containers.
  22. Solaris *Solaris `json:"solaris,omitempty" platform:"solaris"`
  23. // Windows is platform-specific configuration for Windows based containers.
  24. Windows *Windows `json:"windows,omitempty" platform:"windows"`
  25. }
  26. // Process contains information to start a specific application inside the container.
  27. type Process struct {
  28. // Terminal creates an interactive terminal for the container.
  29. Terminal bool `json:"terminal,omitempty"`
  30. // ConsoleSize specifies the size of the console.
  31. ConsoleSize *Box `json:"consoleSize,omitempty"`
  32. // User specifies user information for the process.
  33. User User `json:"user"`
  34. // Args specifies the binary and arguments for the application to execute.
  35. Args []string `json:"args"`
  36. // Env populates the process environment for the process.
  37. Env []string `json:"env,omitempty"`
  38. // Cwd is the current working directory for the process and must be
  39. // relative to the container's root.
  40. Cwd string `json:"cwd"`
  41. // Capabilities are Linux capabilities that are kept for the process.
  42. Capabilities *LinuxCapabilities `json:"capabilities,omitempty" platform:"linux"`
  43. // Rlimits specifies rlimit options to apply to the process.
  44. Rlimits []POSIXRlimit `json:"rlimits,omitempty" platform:"linux,solaris"`
  45. // NoNewPrivileges controls whether additional privileges could be gained by processes in the container.
  46. NoNewPrivileges bool `json:"noNewPrivileges,omitempty" platform:"linux"`
  47. // ApparmorProfile specifies the apparmor profile for the container.
  48. ApparmorProfile string `json:"apparmorProfile,omitempty" platform:"linux"`
  49. // Specify an oom_score_adj for the container.
  50. OOMScoreAdj *int `json:"oomScoreAdj,omitempty" platform:"linux"`
  51. // SelinuxLabel specifies the selinux context that the container process is run as.
  52. SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"`
  53. }
  54. // LinuxCapabilities specifies the whitelist of capabilities that are kept for a process.
  55. // http://man7.org/linux/man-pages/man7/capabilities.7.html
  56. type LinuxCapabilities struct {
  57. // Bounding is the set of capabilities checked by the kernel.
  58. Bounding []string `json:"bounding,omitempty" platform:"linux"`
  59. // Effective is the set of capabilities checked by the kernel.
  60. Effective []string `json:"effective,omitempty" platform:"linux"`
  61. // Inheritable is the capabilities preserved across execve.
  62. Inheritable []string `json:"inheritable,omitempty" platform:"linux"`
  63. // Permitted is the limiting superset for effective capabilities.
  64. Permitted []string `json:"permitted,omitempty" platform:"linux"`
  65. // Ambient is the ambient set of capabilities that are kept.
  66. Ambient []string `json:"ambient,omitempty" platform:"linux"`
  67. }
  68. // Box specifies dimensions of a rectangle. Used for specifying the size of a console.
  69. type Box struct {
  70. // Height is the vertical dimension of a box.
  71. Height uint `json:"height"`
  72. // Width is the horizontal dimension of a box.
  73. Width uint `json:"width"`
  74. }
  75. // User specifies specific user (and group) information for the container process.
  76. type User struct {
  77. // UID is the user id.
  78. UID uint32 `json:"uid" platform:"linux,solaris"`
  79. // GID is the group id.
  80. GID uint32 `json:"gid" platform:"linux,solaris"`
  81. // AdditionalGids are additional group ids set for the container's process.
  82. AdditionalGids []uint32 `json:"additionalGids,omitempty" platform:"linux,solaris"`
  83. // Username is the user name.
  84. Username string `json:"username,omitempty" platform:"windows"`
  85. }
  86. // Root contains information about the container's root filesystem on the host.
  87. type Root struct {
  88. // Path is the absolute path to the container's root filesystem.
  89. Path string `json:"path"`
  90. // Readonly makes the root filesystem for the container readonly before the process is executed.
  91. Readonly bool `json:"readonly,omitempty"`
  92. }
  93. // Mount specifies a mount for a container.
  94. type Mount struct {
  95. // Destination is the absolute path where the mount will be placed in the container.
  96. Destination string `json:"destination"`
  97. // Type specifies the mount kind.
  98. Type string `json:"type,omitempty" platform:"linux,solaris"`
  99. // Source specifies the source path of the mount.
  100. Source string `json:"source,omitempty"`
  101. // Options are fstab style mount options.
  102. Options []string `json:"options,omitempty"`
  103. }
  104. // Hook specifies a command that is run at a particular event in the lifecycle of a container
  105. type Hook struct {
  106. Path string `json:"path"`
  107. Args []string `json:"args,omitempty"`
  108. Env []string `json:"env,omitempty"`
  109. Timeout *int `json:"timeout,omitempty"`
  110. }
  111. // Hooks for container setup and teardown
  112. type Hooks struct {
  113. // Prestart is a list of hooks to be run before the container process is executed.
  114. Prestart []Hook `json:"prestart,omitempty"`
  115. // Poststart is a list of hooks to be run after the container process is started.
  116. Poststart []Hook `json:"poststart,omitempty"`
  117. // Poststop is a list of hooks to be run after the container process exits.
  118. Poststop []Hook `json:"poststop,omitempty"`
  119. }
  120. // Linux contains platform-specific configuration for Linux based containers.
  121. type Linux struct {
  122. // UIDMapping specifies user mappings for supporting user namespaces.
  123. UIDMappings []LinuxIDMapping `json:"uidMappings,omitempty"`
  124. // GIDMapping specifies group mappings for supporting user namespaces.
  125. GIDMappings []LinuxIDMapping `json:"gidMappings,omitempty"`
  126. // Sysctl are a set of key value pairs that are set for the container on start
  127. Sysctl map[string]string `json:"sysctl,omitempty"`
  128. // Resources contain cgroup information for handling resource constraints
  129. // for the container
  130. Resources *LinuxResources `json:"resources,omitempty"`
  131. // CgroupsPath specifies the path to cgroups that are created and/or joined by the container.
  132. // The path is expected to be relative to the cgroups mountpoint.
  133. // If resources are specified, the cgroups at CgroupsPath will be updated based on resources.
  134. CgroupsPath string `json:"cgroupsPath,omitempty"`
  135. // Namespaces contains the namespaces that are created and/or joined by the container
  136. Namespaces []LinuxNamespace `json:"namespaces,omitempty"`
  137. // Devices are a list of device nodes that are created for the container
  138. Devices []LinuxDevice `json:"devices,omitempty"`
  139. // Seccomp specifies the seccomp security settings for the container.
  140. Seccomp *LinuxSeccomp `json:"seccomp,omitempty"`
  141. // RootfsPropagation is the rootfs mount propagation mode for the container.
  142. RootfsPropagation string `json:"rootfsPropagation,omitempty"`
  143. // MaskedPaths masks over the provided paths inside the container.
  144. MaskedPaths []string `json:"maskedPaths,omitempty"`
  145. // ReadonlyPaths sets the provided paths as RO inside the container.
  146. ReadonlyPaths []string `json:"readonlyPaths,omitempty"`
  147. // MountLabel specifies the selinux context for the mounts in the container.
  148. MountLabel string `json:"mountLabel,omitempty"`
  149. // IntelRdt contains Intel Resource Director Technology (RDT) information
  150. // for handling resource constraints (e.g., L3 cache) for the container
  151. IntelRdt *LinuxIntelRdt `json:"intelRdt,omitempty"`
  152. }
  153. // LinuxNamespace is the configuration for a Linux namespace
  154. type LinuxNamespace struct {
  155. // Type is the type of namespace
  156. Type LinuxNamespaceType `json:"type"`
  157. // Path is a path to an existing namespace persisted on disk that can be joined
  158. // and is of the same type
  159. Path string `json:"path,omitempty"`
  160. }
  161. // LinuxNamespaceType is one of the Linux namespaces
  162. type LinuxNamespaceType string
  163. const (
  164. // PIDNamespace for isolating process IDs
  165. PIDNamespace LinuxNamespaceType = "pid"
  166. // NetworkNamespace for isolating network devices, stacks, ports, etc
  167. NetworkNamespace = "network"
  168. // MountNamespace for isolating mount points
  169. MountNamespace = "mount"
  170. // IPCNamespace for isolating System V IPC, POSIX message queues
  171. IPCNamespace = "ipc"
  172. // UTSNamespace for isolating hostname and NIS domain name
  173. UTSNamespace = "uts"
  174. // UserNamespace for isolating user and group IDs
  175. UserNamespace = "user"
  176. // CgroupNamespace for isolating cgroup hierarchies
  177. CgroupNamespace = "cgroup"
  178. )
  179. // LinuxIDMapping specifies UID/GID mappings
  180. type LinuxIDMapping struct {
  181. // HostID is the starting UID/GID on the host to be mapped to 'ContainerID'
  182. HostID uint32 `json:"hostID"`
  183. // ContainerID is the starting UID/GID in the container
  184. ContainerID uint32 `json:"containerID"`
  185. // Size is the number of IDs to be mapped
  186. Size uint32 `json:"size"`
  187. }
  188. // POSIXRlimit type and restrictions
  189. type POSIXRlimit struct {
  190. // Type of the rlimit to set
  191. Type string `json:"type"`
  192. // Hard is the hard limit for the specified type
  193. Hard uint64 `json:"hard"`
  194. // Soft is the soft limit for the specified type
  195. Soft uint64 `json:"soft"`
  196. }
  197. // LinuxHugepageLimit structure corresponds to limiting kernel hugepages
  198. type LinuxHugepageLimit struct {
  199. // Pagesize is the hugepage size
  200. Pagesize string `json:"pageSize"`
  201. // Limit is the limit of "hugepagesize" hugetlb usage
  202. Limit uint64 `json:"limit"`
  203. }
  204. // LinuxInterfacePriority for network interfaces
  205. type LinuxInterfacePriority struct {
  206. // Name is the name of the network interface
  207. Name string `json:"name"`
  208. // Priority for the interface
  209. Priority uint32 `json:"priority"`
  210. }
  211. // linuxBlockIODevice holds major:minor format supported in blkio cgroup
  212. type linuxBlockIODevice struct {
  213. // Major is the device's major number.
  214. Major int64 `json:"major"`
  215. // Minor is the device's minor number.
  216. Minor int64 `json:"minor"`
  217. }
  218. // LinuxWeightDevice struct holds a `major:minor weight` pair for weightDevice
  219. type LinuxWeightDevice struct {
  220. linuxBlockIODevice
  221. // Weight is the bandwidth rate for the device.
  222. Weight *uint16 `json:"weight,omitempty"`
  223. // LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, CFQ scheduler only
  224. LeafWeight *uint16 `json:"leafWeight,omitempty"`
  225. }
  226. // LinuxThrottleDevice struct holds a `major:minor rate_per_second` pair
  227. type LinuxThrottleDevice struct {
  228. linuxBlockIODevice
  229. // Rate is the IO rate limit per cgroup per device
  230. Rate uint64 `json:"rate"`
  231. }
  232. // LinuxBlockIO for Linux cgroup 'blkio' resource management
  233. type LinuxBlockIO struct {
  234. // Specifies per cgroup weight
  235. Weight *uint16 `json:"weight,omitempty"`
  236. // Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, CFQ scheduler only
  237. LeafWeight *uint16 `json:"leafWeight,omitempty"`
  238. // Weight per cgroup per device, can override BlkioWeight
  239. WeightDevice []LinuxWeightDevice `json:"weightDevice,omitempty"`
  240. // IO read rate limit per cgroup per device, bytes per second
  241. ThrottleReadBpsDevice []LinuxThrottleDevice `json:"throttleReadBpsDevice,omitempty"`
  242. // IO write rate limit per cgroup per device, bytes per second
  243. ThrottleWriteBpsDevice []LinuxThrottleDevice `json:"throttleWriteBpsDevice,omitempty"`
  244. // IO read rate limit per cgroup per device, IO per second
  245. ThrottleReadIOPSDevice []LinuxThrottleDevice `json:"throttleReadIOPSDevice,omitempty"`
  246. // IO write rate limit per cgroup per device, IO per second
  247. ThrottleWriteIOPSDevice []LinuxThrottleDevice `json:"throttleWriteIOPSDevice,omitempty"`
  248. }
  249. // LinuxMemory for Linux cgroup 'memory' resource management
  250. type LinuxMemory struct {
  251. // Memory limit (in bytes).
  252. Limit *int64 `json:"limit,omitempty"`
  253. // Memory reservation or soft_limit (in bytes).
  254. Reservation *int64 `json:"reservation,omitempty"`
  255. // Total memory limit (memory + swap).
  256. Swap *int64 `json:"swap,omitempty"`
  257. // Kernel memory limit (in bytes).
  258. Kernel *int64 `json:"kernel,omitempty"`
  259. // Kernel memory limit for tcp (in bytes)
  260. KernelTCP *int64 `json:"kernelTCP,omitempty"`
  261. // How aggressive the kernel will swap memory pages.
  262. Swappiness *uint64 `json:"swappiness,omitempty"`
  263. // DisableOOMKiller disables the OOM killer for out of memory conditions
  264. DisableOOMKiller *bool `json:"disableOOMKiller,omitempty"`
  265. }
  266. // LinuxCPU for Linux cgroup 'cpu' resource management
  267. type LinuxCPU struct {
  268. // CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
  269. Shares *uint64 `json:"shares,omitempty"`
  270. // CPU hardcap limit (in usecs). Allowed cpu time in a given period.
  271. Quota *int64 `json:"quota,omitempty"`
  272. // CPU period to be used for hardcapping (in usecs).
  273. Period *uint64 `json:"period,omitempty"`
  274. // How much time realtime scheduling may use (in usecs).
  275. RealtimeRuntime *int64 `json:"realtimeRuntime,omitempty"`
  276. // CPU period to be used for realtime scheduling (in usecs).
  277. RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"`
  278. // CPUs to use within the cpuset. Default is to use any CPU available.
  279. Cpus string `json:"cpus,omitempty"`
  280. // List of memory nodes in the cpuset. Default is to use any available memory node.
  281. Mems string `json:"mems,omitempty"`
  282. }
  283. // LinuxPids for Linux cgroup 'pids' resource management (Linux 4.3)
  284. type LinuxPids struct {
  285. // Maximum number of PIDs. Default is "no limit".
  286. Limit int64 `json:"limit"`
  287. }
  288. // LinuxNetwork identification and priority configuration
  289. type LinuxNetwork struct {
  290. // Set class identifier for container's network packets
  291. ClassID *uint32 `json:"classID,omitempty"`
  292. // Set priority of network traffic for container
  293. Priorities []LinuxInterfacePriority `json:"priorities,omitempty"`
  294. }
  295. // LinuxResources has container runtime resource constraints
  296. type LinuxResources struct {
  297. // Devices configures the device whitelist.
  298. Devices []LinuxDeviceCgroup `json:"devices,omitempty"`
  299. // Memory restriction configuration
  300. Memory *LinuxMemory `json:"memory,omitempty"`
  301. // CPU resource restriction configuration
  302. CPU *LinuxCPU `json:"cpu,omitempty"`
  303. // Task resource restriction configuration.
  304. Pids *LinuxPids `json:"pids,omitempty"`
  305. // BlockIO restriction configuration
  306. BlockIO *LinuxBlockIO `json:"blockIO,omitempty"`
  307. // Hugetlb limit (in bytes)
  308. HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"`
  309. // Network restriction configuration
  310. Network *LinuxNetwork `json:"network,omitempty"`
  311. }
  312. // LinuxDevice represents the mknod information for a Linux special device file
  313. type LinuxDevice struct {
  314. // Path to the device.
  315. Path string `json:"path"`
  316. // Device type, block, char, etc.
  317. Type string `json:"type"`
  318. // Major is the device's major number.
  319. Major int64 `json:"major"`
  320. // Minor is the device's minor number.
  321. Minor int64 `json:"minor"`
  322. // FileMode permission bits for the device.
  323. FileMode *os.FileMode `json:"fileMode,omitempty"`
  324. // UID of the device.
  325. UID *uint32 `json:"uid,omitempty"`
  326. // Gid of the device.
  327. GID *uint32 `json:"gid,omitempty"`
  328. }
  329. // LinuxDeviceCgroup represents a device rule for the whitelist controller
  330. type LinuxDeviceCgroup struct {
  331. // Allow or deny
  332. Allow bool `json:"allow"`
  333. // Device type, block, char, etc.
  334. Type string `json:"type,omitempty"`
  335. // Major is the device's major number.
  336. Major *int64 `json:"major,omitempty"`
  337. // Minor is the device's minor number.
  338. Minor *int64 `json:"minor,omitempty"`
  339. // Cgroup access permissions format, rwm.
  340. Access string `json:"access,omitempty"`
  341. }
  342. // Solaris contains platform-specific configuration for Solaris application containers.
  343. type Solaris struct {
  344. // SMF FMRI which should go "online" before we start the container process.
  345. Milestone string `json:"milestone,omitempty"`
  346. // Maximum set of privileges any process in this container can obtain.
  347. LimitPriv string `json:"limitpriv,omitempty"`
  348. // The maximum amount of shared memory allowed for this container.
  349. MaxShmMemory string `json:"maxShmMemory,omitempty"`
  350. // Specification for automatic creation of network resources for this container.
  351. Anet []SolarisAnet `json:"anet,omitempty"`
  352. // Set limit on the amount of CPU time that can be used by container.
  353. CappedCPU *SolarisCappedCPU `json:"cappedCPU,omitempty"`
  354. // The physical and swap caps on the memory that can be used by this container.
  355. CappedMemory *SolarisCappedMemory `json:"cappedMemory,omitempty"`
  356. }
  357. // SolarisCappedCPU allows users to set limit on the amount of CPU time that can be used by container.
  358. type SolarisCappedCPU struct {
  359. Ncpus string `json:"ncpus,omitempty"`
  360. }
  361. // SolarisCappedMemory allows users to set the physical and swap caps on the memory that can be used by this container.
  362. type SolarisCappedMemory struct {
  363. Physical string `json:"physical,omitempty"`
  364. Swap string `json:"swap,omitempty"`
  365. }
  366. // SolarisAnet provides the specification for automatic creation of network resources for this container.
  367. type SolarisAnet struct {
  368. // Specify a name for the automatically created VNIC datalink.
  369. Linkname string `json:"linkname,omitempty"`
  370. // Specify the link over which the VNIC will be created.
  371. Lowerlink string `json:"lowerLink,omitempty"`
  372. // The set of IP addresses that the container can use.
  373. Allowedaddr string `json:"allowedAddress,omitempty"`
  374. // Specifies whether allowedAddress limitation is to be applied to the VNIC.
  375. Configallowedaddr string `json:"configureAllowedAddress,omitempty"`
  376. // The value of the optional default router.
  377. Defrouter string `json:"defrouter,omitempty"`
  378. // Enable one or more types of link protection.
  379. Linkprotection string `json:"linkProtection,omitempty"`
  380. // Set the VNIC's macAddress
  381. Macaddress string `json:"macAddress,omitempty"`
  382. }
  383. // Windows defines the runtime configuration for Windows based containers, including Hyper-V containers.
  384. type Windows struct {
  385. // LayerFolders contains a list of absolute paths to directories containing image layers.
  386. LayerFolders []string `json:"layerFolders"`
  387. // Resources contains information for handling resource constraints for the container.
  388. Resources *WindowsResources `json:"resources,omitempty"`
  389. // CredentialSpec contains a JSON object describing a group Managed Service Account (gMSA) specification.
  390. CredentialSpec interface{} `json:"credentialSpec,omitempty"`
  391. // Servicing indicates if the container is being started in a mode to apply a Windows Update servicing operation.
  392. Servicing bool `json:"servicing,omitempty"`
  393. // IgnoreFlushesDuringBoot indicates if the container is being started in a mode where disk writes are not flushed during its boot process.
  394. IgnoreFlushesDuringBoot bool `json:"ignoreFlushesDuringBoot,omitempty"`
  395. // HyperV contains information for running a container with Hyper-V isolation.
  396. HyperV *WindowsHyperV `json:"hyperv,omitempty"`
  397. // Network restriction configuration.
  398. Network *WindowsNetwork `json:"network,omitempty"`
  399. }
  400. // WindowsResources has container runtime resource constraints for containers running on Windows.
  401. type WindowsResources struct {
  402. // Memory restriction configuration.
  403. Memory *WindowsMemoryResources `json:"memory,omitempty"`
  404. // CPU resource restriction configuration.
  405. CPU *WindowsCPUResources `json:"cpu,omitempty"`
  406. // Storage restriction configuration.
  407. Storage *WindowsStorageResources `json:"storage,omitempty"`
  408. }
  409. // WindowsMemoryResources contains memory resource management settings.
  410. type WindowsMemoryResources struct {
  411. // Memory limit in bytes.
  412. Limit *uint64 `json:"limit,omitempty"`
  413. }
  414. // WindowsCPUResources contains CPU resource management settings.
  415. type WindowsCPUResources struct {
  416. // Number of CPUs available to the container.
  417. Count *uint64 `json:"count,omitempty"`
  418. // CPU shares (relative weight to other containers with cpu shares).
  419. Shares *uint16 `json:"shares,omitempty"`
  420. // Specifies the portion of processor cycles that this container can use as a percentage times 100.
  421. Maximum *uint16 `json:"maximum,omitempty"`
  422. }
  423. // WindowsStorageResources contains storage resource management settings.
  424. type WindowsStorageResources struct {
  425. // Specifies maximum Iops for the system drive.
  426. Iops *uint64 `json:"iops,omitempty"`
  427. // Specifies maximum bytes per second for the system drive.
  428. Bps *uint64 `json:"bps,omitempty"`
  429. // Sandbox size specifies the minimum size of the system drive in bytes.
  430. SandboxSize *uint64 `json:"sandboxSize,omitempty"`
  431. }
  432. // WindowsNetwork contains network settings for Windows containers.
  433. type WindowsNetwork struct {
  434. // List of HNS endpoints that the container should connect to.
  435. EndpointList []string `json:"endpointList,omitempty"`
  436. // Specifies if unqualified DNS name resolution is allowed.
  437. AllowUnqualifiedDNSQuery bool `json:"allowUnqualifiedDNSQuery,omitempty"`
  438. // Comma separated list of DNS suffixes to use for name resolution.
  439. DNSSearchList []string `json:"DNSSearchList,omitempty"`
  440. // Name (ID) of the container that we will share with the network stack.
  441. NetworkSharedContainerName string `json:"networkSharedContainerName,omitempty"`
  442. }
  443. // WindowsHyperV contains information for configuring a container to run with Hyper-V isolation.
  444. type WindowsHyperV struct {
  445. // UtilityVMPath is an optional path to the image used for the Utility VM.
  446. UtilityVMPath string `json:"utilityVMPath,omitempty"`
  447. }
  448. // LinuxSeccomp represents syscall restrictions
  449. type LinuxSeccomp struct {
  450. DefaultAction LinuxSeccompAction `json:"defaultAction"`
  451. Architectures []Arch `json:"architectures,omitempty"`
  452. Syscalls []LinuxSyscall `json:"syscalls,omitempty"`
  453. }
  454. // Arch used for additional architectures
  455. type Arch string
  456. // Additional architectures permitted to be used for system calls
  457. // By default only the native architecture of the kernel is permitted
  458. const (
  459. ArchX86 Arch = "SCMP_ARCH_X86"
  460. ArchX86_64 Arch = "SCMP_ARCH_X86_64"
  461. ArchX32 Arch = "SCMP_ARCH_X32"
  462. ArchARM Arch = "SCMP_ARCH_ARM"
  463. ArchAARCH64 Arch = "SCMP_ARCH_AARCH64"
  464. ArchMIPS Arch = "SCMP_ARCH_MIPS"
  465. ArchMIPS64 Arch = "SCMP_ARCH_MIPS64"
  466. ArchMIPS64N32 Arch = "SCMP_ARCH_MIPS64N32"
  467. ArchMIPSEL Arch = "SCMP_ARCH_MIPSEL"
  468. ArchMIPSEL64 Arch = "SCMP_ARCH_MIPSEL64"
  469. ArchMIPSEL64N32 Arch = "SCMP_ARCH_MIPSEL64N32"
  470. ArchPPC Arch = "SCMP_ARCH_PPC"
  471. ArchPPC64 Arch = "SCMP_ARCH_PPC64"
  472. ArchPPC64LE Arch = "SCMP_ARCH_PPC64LE"
  473. ArchS390 Arch = "SCMP_ARCH_S390"
  474. ArchS390X Arch = "SCMP_ARCH_S390X"
  475. ArchPARISC Arch = "SCMP_ARCH_PARISC"
  476. ArchPARISC64 Arch = "SCMP_ARCH_PARISC64"
  477. )
  478. // LinuxSeccompAction taken upon Seccomp rule match
  479. type LinuxSeccompAction string
  480. // Define actions for Seccomp rules
  481. const (
  482. ActKill LinuxSeccompAction = "SCMP_ACT_KILL"
  483. ActTrap LinuxSeccompAction = "SCMP_ACT_TRAP"
  484. ActErrno LinuxSeccompAction = "SCMP_ACT_ERRNO"
  485. ActTrace LinuxSeccompAction = "SCMP_ACT_TRACE"
  486. ActAllow LinuxSeccompAction = "SCMP_ACT_ALLOW"
  487. )
  488. // LinuxSeccompOperator used to match syscall arguments in Seccomp
  489. type LinuxSeccompOperator string
  490. // Define operators for syscall arguments in Seccomp
  491. const (
  492. OpNotEqual LinuxSeccompOperator = "SCMP_CMP_NE"
  493. OpLessThan LinuxSeccompOperator = "SCMP_CMP_LT"
  494. OpLessEqual LinuxSeccompOperator = "SCMP_CMP_LE"
  495. OpEqualTo LinuxSeccompOperator = "SCMP_CMP_EQ"
  496. OpGreaterEqual LinuxSeccompOperator = "SCMP_CMP_GE"
  497. OpGreaterThan LinuxSeccompOperator = "SCMP_CMP_GT"
  498. OpMaskedEqual LinuxSeccompOperator = "SCMP_CMP_MASKED_EQ"
  499. )
  500. // LinuxSeccompArg used for matching specific syscall arguments in Seccomp
  501. type LinuxSeccompArg struct {
  502. Index uint `json:"index"`
  503. Value uint64 `json:"value"`
  504. ValueTwo uint64 `json:"valueTwo,omitempty"`
  505. Op LinuxSeccompOperator `json:"op"`
  506. }
  507. // LinuxSyscall is used to match a syscall in Seccomp
  508. type LinuxSyscall struct {
  509. Names []string `json:"names"`
  510. Action LinuxSeccompAction `json:"action"`
  511. Args []LinuxSeccompArg `json:"args,omitempty"`
  512. }
  513. // LinuxIntelRdt has container runtime resource constraints
  514. // for Intel RDT/CAT which introduced in Linux 4.10 kernel
  515. type LinuxIntelRdt struct {
  516. // The schema for L3 cache id and capacity bitmask (CBM)
  517. // Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
  518. L3CacheSchema string `json:"l3CacheSchema,omitempty"`
  519. }