2016-09-20 08:16:59 +00:00
package specs
import "os"
// Spec is the base configuration for the container.
type Spec struct {
2017-04-12 23:12:04 +00:00
// Version of the Open Container Runtime Specification with which the bundle complies.
2016-09-20 08:16:59 +00:00
Version string ` json:"ociVersion" `
2017-04-12 23:12:04 +00:00
// Platform specifies the configuration's target platform.
2016-09-20 08:16:59 +00:00
Platform Platform ` json:"platform" `
2017-04-12 23:12:04 +00:00
// Process configures the container process.
2016-09-20 08:16:59 +00:00
Process Process ` json:"process" `
2017-04-12 23:12:04 +00:00
// Root configures the container's root filesystem.
2016-09-20 08:16:59 +00:00
Root Root ` json:"root" `
2017-04-12 23:12:04 +00:00
// Hostname configures the container's hostname.
2016-09-20 08:16:59 +00:00
Hostname string ` json:"hostname,omitempty" `
2017-04-12 23:12:04 +00:00
// Mounts configures additional mounts (on top of Root).
2016-09-20 08:16:59 +00:00
Mounts [ ] Mount ` json:"mounts,omitempty" `
2017-04-12 23:12:04 +00:00
// Hooks configures callbacks for container lifecycle events.
Hooks * Hooks ` json:"hooks,omitempty" `
// Annotations contains arbitrary metadata for the container.
2016-09-20 08:16:59 +00:00
Annotations map [ string ] string ` json:"annotations,omitempty" `
// Linux is platform specific configuration for Linux based containers.
Linux * Linux ` json:"linux,omitempty" platform:"linux" `
// Solaris is platform specific configuration for Solaris containers.
Solaris * Solaris ` json:"solaris,omitempty" platform:"solaris" `
2017-04-12 23:12:04 +00:00
// Windows is platform specific configuration for Windows based containers, including Hyper-V containers.
Windows * Windows ` json:"windows,omitempty" platform:"windows" `
2016-09-20 08:16:59 +00:00
}
// Process contains information to start a specific application inside the container.
type Process struct {
// Terminal creates an interactive terminal for the container.
Terminal bool ` json:"terminal,omitempty" `
2017-04-12 23:12:04 +00:00
// ConsoleSize specifies the size of the console.
ConsoleSize Box ` json:"consoleSize,omitempty" `
2016-09-20 08:16:59 +00:00
// User specifies user information for the process.
User User ` json:"user" `
// Args specifies the binary and arguments for the application to execute.
Args [ ] string ` json:"args" `
// Env populates the process environment for the process.
Env [ ] string ` json:"env,omitempty" `
// Cwd is the current working directory for the process and must be
// relative to the container's root.
Cwd string ` json:"cwd" `
2017-04-12 23:12:04 +00:00
// Capabilities are Linux capabilities that are kept for the process.
Capabilities * LinuxCapabilities ` json:"capabilities,omitempty" platform:"linux" `
2016-09-20 08:16:59 +00:00
// Rlimits specifies rlimit options to apply to the process.
2017-04-12 23:12:04 +00:00
Rlimits [ ] LinuxRlimit ` json:"rlimits,omitempty" platform:"linux" `
2016-09-20 08:16:59 +00:00
// NoNewPrivileges controls whether additional privileges could be gained by processes in the container.
2017-04-12 23:12:04 +00:00
NoNewPrivileges bool ` json:"noNewPrivileges,omitempty" platform:"linux" `
// ApparmorProfile specifies the apparmor profile for the container.
2016-09-20 08:16:59 +00:00
ApparmorProfile string ` json:"apparmorProfile,omitempty" platform:"linux" `
2017-04-12 23:12:04 +00:00
// SelinuxLabel specifies the selinux context that the container process is run as.
2016-09-20 08:16:59 +00:00
SelinuxLabel string ` json:"selinuxLabel,omitempty" platform:"linux" `
}
2017-04-12 23:12:04 +00:00
// LinuxCapabilities specifies the whitelist of capabilities that are kept for a process.
// http://man7.org/linux/man-pages/man7/capabilities.7.html
type LinuxCapabilities struct {
// Bounding is the set of capabilities checked by the kernel.
Bounding [ ] string ` json:"bounding,omitempty" platform:"linux" `
// Effective is the set of capabilities checked by the kernel.
Effective [ ] string ` json:"effective,omitempty" platform:"linux" `
// Inheritable is the capabilities preserved across execve.
Inheritable [ ] string ` json:"inheritable,omitempty" platform:"linux" `
// Permitted is the limiting superset for effective capabilities.
Permitted [ ] string ` json:"permitted,omitempty" platform:"linux" `
// Ambient is the ambient set of capabilities that are kept.
Ambient [ ] string ` json:"ambient,omitempty" platform:"linux" `
}
// Box specifies dimensions of a rectangle. Used for specifying the size of a console.
type Box struct {
// Height is the vertical dimension of a box.
Height uint ` json:"height" `
// Width is the horizontal dimension of a box.
Width uint ` json:"width" `
}
// User specifies specific user (and group) information for the container process.
2016-09-20 08:16:59 +00:00
type User struct {
2017-04-12 23:12:04 +00:00
// UID is the user id.
2016-09-20 08:16:59 +00:00
UID uint32 ` json:"uid" platform:"linux,solaris" `
2017-04-12 23:12:04 +00:00
// GID is the group id.
2016-09-20 08:16:59 +00:00
GID uint32 ` json:"gid" platform:"linux,solaris" `
2017-04-12 23:12:04 +00:00
// AdditionalGids are additional group ids set for the container's process.
2016-09-20 08:16:59 +00:00
AdditionalGids [ ] uint32 ` json:"additionalGids,omitempty" platform:"linux,solaris" `
2017-04-12 23:12:04 +00:00
// Username is the user name.
Username string ` json:"username,omitempty" platform:"windows" `
2016-09-20 08:16:59 +00:00
}
// Root contains information about the container's root filesystem on the host.
type Root struct {
// Path is the absolute path to the container's root filesystem.
Path string ` json:"path" `
// Readonly makes the root filesystem for the container readonly before the process is executed.
Readonly bool ` json:"readonly,omitempty" `
}
// Platform specifies OS and arch information for the host system that the container
// is created for.
type Platform struct {
// OS is the operating system.
OS string ` json:"os" `
// Arch is the architecture
Arch string ` json:"arch" `
}
// Mount specifies a mount for a container.
type Mount struct {
// Destination is the path where the mount will be placed relative to the container's root. The path and child directories MUST exist, a runtime MUST NOT create directories automatically to a mount point.
Destination string ` json:"destination" `
// Type specifies the mount kind.
2017-04-12 23:12:04 +00:00
Type string ` json:"type,omitempty" `
2016-09-20 08:16:59 +00:00
// Source specifies the source path of the mount. In the case of bind mounts on
// Linux based systems this would be the file on the host.
2017-04-12 23:12:04 +00:00
Source string ` json:"source,omitempty" `
2016-09-20 08:16:59 +00:00
// Options are fstab style mount options.
Options [ ] string ` json:"options,omitempty" `
}
// Hook specifies a command that is run at a particular event in the lifecycle of a container
type Hook struct {
Path string ` json:"path" `
Args [ ] string ` json:"args,omitempty" `
Env [ ] string ` json:"env,omitempty" `
Timeout * int ` json:"timeout,omitempty" `
}
// Hooks for container setup and teardown
type Hooks struct {
// Prestart is a list of hooks to be run before the container process is executed.
// On Linux, they are run after the container namespaces are created.
Prestart [ ] Hook ` json:"prestart,omitempty" `
// Poststart is a list of hooks to be run after the container process is started.
Poststart [ ] Hook ` json:"poststart,omitempty" `
// Poststop is a list of hooks to be run after the container process exits.
Poststop [ ] Hook ` json:"poststop,omitempty" `
}
// Linux contains platform specific configuration for Linux based containers.
type Linux struct {
// UIDMapping specifies user mappings for supporting user namespaces on Linux.
2017-04-12 23:12:04 +00:00
UIDMappings [ ] LinuxIDMapping ` json:"uidMappings,omitempty" `
2016-09-20 08:16:59 +00:00
// GIDMapping specifies group mappings for supporting user namespaces on Linux.
2017-04-12 23:12:04 +00:00
GIDMappings [ ] LinuxIDMapping ` json:"gidMappings,omitempty" `
2016-09-20 08:16:59 +00:00
// Sysctl are a set of key value pairs that are set for the container on start
Sysctl map [ string ] string ` json:"sysctl,omitempty" `
// Resources contain cgroup information for handling resource constraints
// for the container
2017-04-12 23:12:04 +00:00
Resources * LinuxResources ` json:"resources,omitempty" `
2016-09-20 08:16:59 +00:00
// CgroupsPath specifies the path to cgroups that are created and/or joined by the container.
// The path is expected to be relative to the cgroups mountpoint.
// If resources are specified, the cgroups at CgroupsPath will be updated based on resources.
2017-04-12 23:12:04 +00:00
CgroupsPath string ` json:"cgroupsPath,omitempty" `
2016-09-20 08:16:59 +00:00
// Namespaces contains the namespaces that are created and/or joined by the container
2017-04-12 23:12:04 +00:00
Namespaces [ ] LinuxNamespace ` json:"namespaces,omitempty" `
2016-09-20 08:16:59 +00:00
// Devices are a list of device nodes that are created for the container
2017-04-12 23:12:04 +00:00
Devices [ ] LinuxDevice ` json:"devices,omitempty" `
2016-09-20 08:16:59 +00:00
// Seccomp specifies the seccomp security settings for the container.
2017-04-12 23:12:04 +00:00
Seccomp * LinuxSeccomp ` json:"seccomp,omitempty" `
2016-09-20 08:16:59 +00:00
// RootfsPropagation is the rootfs mount propagation mode for the container.
RootfsPropagation string ` json:"rootfsPropagation,omitempty" `
// MaskedPaths masks over the provided paths inside the container.
MaskedPaths [ ] string ` json:"maskedPaths,omitempty" `
// ReadonlyPaths sets the provided paths as RO inside the container.
ReadonlyPaths [ ] string ` json:"readonlyPaths,omitempty" `
// MountLabel specifies the selinux context for the mounts in the container.
MountLabel string ` json:"mountLabel,omitempty" `
}
2017-04-12 23:12:04 +00:00
// LinuxNamespace is the configuration for a Linux namespace
type LinuxNamespace struct {
2016-09-20 08:16:59 +00:00
// Type is the type of Linux namespace
2017-04-12 23:12:04 +00:00
Type LinuxNamespaceType ` json:"type" `
2016-09-20 08:16:59 +00:00
// Path is a path to an existing namespace persisted on disk that can be joined
// and is of the same type
Path string ` json:"path,omitempty" `
}
2017-04-12 23:12:04 +00:00
// LinuxNamespaceType is one of the Linux namespaces
type LinuxNamespaceType string
2016-09-20 08:16:59 +00:00
const (
// PIDNamespace for isolating process IDs
2017-04-12 23:12:04 +00:00
PIDNamespace LinuxNamespaceType = "pid"
2016-09-20 08:16:59 +00:00
// NetworkNamespace for isolating network devices, stacks, ports, etc
NetworkNamespace = "network"
// MountNamespace for isolating mount points
MountNamespace = "mount"
// IPCNamespace for isolating System V IPC, POSIX message queues
IPCNamespace = "ipc"
// UTSNamespace for isolating hostname and NIS domain name
UTSNamespace = "uts"
// UserNamespace for isolating user and group IDs
UserNamespace = "user"
// CgroupNamespace for isolating cgroup hierarchies
CgroupNamespace = "cgroup"
)
2017-04-12 23:12:04 +00:00
// LinuxIDMapping specifies UID/GID mappings
type LinuxIDMapping struct {
// HostID is the starting UID/GID on the host to be mapped to 'ContainerID'
2016-09-20 08:16:59 +00:00
HostID uint32 ` json:"hostID" `
2017-04-12 23:12:04 +00:00
// ContainerID is the starting UID/GID in the container
2016-09-20 08:16:59 +00:00
ContainerID uint32 ` json:"containerID" `
2017-04-12 23:12:04 +00:00
// Size is the number of IDs to be mapped
2016-09-20 08:16:59 +00:00
Size uint32 ` json:"size" `
}
2017-04-12 23:12:04 +00:00
// LinuxRlimit type and restrictions
type LinuxRlimit struct {
2016-09-20 08:16:59 +00:00
// Type of the rlimit to set
Type string ` json:"type" `
// Hard is the hard limit for the specified type
Hard uint64 ` json:"hard" `
// Soft is the soft limit for the specified type
Soft uint64 ` json:"soft" `
}
2017-04-12 23:12:04 +00:00
// LinuxHugepageLimit structure corresponds to limiting kernel hugepages
type LinuxHugepageLimit struct {
2016-09-20 08:16:59 +00:00
// Pagesize is the hugepage size
2017-04-12 23:12:04 +00:00
Pagesize string ` json:"pageSize" `
2016-09-20 08:16:59 +00:00
// Limit is the limit of "hugepagesize" hugetlb usage
2017-04-12 23:12:04 +00:00
Limit uint64 ` json:"limit" `
2016-09-20 08:16:59 +00:00
}
2017-04-12 23:12:04 +00:00
// LinuxInterfacePriority for network interfaces
type LinuxInterfacePriority struct {
2016-09-20 08:16:59 +00:00
// Name is the name of the network interface
Name string ` json:"name" `
// Priority for the interface
Priority uint32 ` json:"priority" `
}
2017-04-12 23:12:04 +00:00
// linuxBlockIODevice holds major:minor format supported in blkio cgroup
type linuxBlockIODevice struct {
2016-09-20 08:16:59 +00:00
// Major is the device's major number.
Major int64 ` json:"major" `
// Minor is the device's minor number.
Minor int64 ` json:"minor" `
}
2017-04-12 23:12:04 +00:00
// LinuxWeightDevice struct holds a `major:minor weight` pair for blkioWeightDevice
type LinuxWeightDevice struct {
linuxBlockIODevice
2016-09-20 08:16:59 +00:00
// Weight is the bandwidth rate for the device, range is from 10 to 1000
Weight * uint16 ` json:"weight,omitempty" `
// 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
LeafWeight * uint16 ` json:"leafWeight,omitempty" `
}
2017-04-12 23:12:04 +00:00
// LinuxThrottleDevice struct holds a `major:minor rate_per_second` pair
type LinuxThrottleDevice struct {
linuxBlockIODevice
2016-09-20 08:16:59 +00:00
// Rate is the IO rate limit per cgroup per device
2017-04-12 23:12:04 +00:00
Rate uint64 ` json:"rate" `
2016-09-20 08:16:59 +00:00
}
2017-04-12 23:12:04 +00:00
// LinuxBlockIO for Linux cgroup 'blkio' resource management
type LinuxBlockIO struct {
2016-09-20 08:16:59 +00:00
// Specifies per cgroup weight, range is from 10 to 1000
Weight * uint16 ` json:"blkioWeight,omitempty" `
// Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only
LeafWeight * uint16 ` json:"blkioLeafWeight,omitempty" `
// Weight per cgroup per device, can override BlkioWeight
2017-04-12 23:12:04 +00:00
WeightDevice [ ] LinuxWeightDevice ` json:"blkioWeightDevice,omitempty" `
2016-09-20 08:16:59 +00:00
// IO read rate limit per cgroup per device, bytes per second
2017-04-12 23:12:04 +00:00
ThrottleReadBpsDevice [ ] LinuxThrottleDevice ` json:"blkioThrottleReadBpsDevice,omitempty" `
2016-09-20 08:16:59 +00:00
// IO write rate limit per cgroup per device, bytes per second
2017-04-12 23:12:04 +00:00
ThrottleWriteBpsDevice [ ] LinuxThrottleDevice ` json:"blkioThrottleWriteBpsDevice,omitempty" `
2016-09-20 08:16:59 +00:00
// IO read rate limit per cgroup per device, IO per second
2017-04-12 23:12:04 +00:00
ThrottleReadIOPSDevice [ ] LinuxThrottleDevice ` json:"blkioThrottleReadIOPSDevice,omitempty" `
2016-09-20 08:16:59 +00:00
// IO write rate limit per cgroup per device, IO per second
2017-04-12 23:12:04 +00:00
ThrottleWriteIOPSDevice [ ] LinuxThrottleDevice ` json:"blkioThrottleWriteIOPSDevice,omitempty" `
2016-09-20 08:16:59 +00:00
}
2017-04-12 23:12:04 +00:00
// LinuxMemory for Linux cgroup 'memory' resource management
type LinuxMemory struct {
2016-09-20 08:16:59 +00:00
// Memory limit (in bytes).
Limit * uint64 ` json:"limit,omitempty" `
// Memory reservation or soft_limit (in bytes).
Reservation * uint64 ` json:"reservation,omitempty" `
// Total memory limit (memory + swap).
Swap * uint64 ` json:"swap,omitempty" `
// Kernel memory limit (in bytes).
Kernel * uint64 ` json:"kernel,omitempty" `
// Kernel memory limit for tcp (in bytes)
2017-04-12 23:12:04 +00:00
KernelTCP * uint64 ` json:"kernelTCP,omitempty" `
2016-09-20 08:16:59 +00:00
// How aggressive the kernel will swap memory pages. Range from 0 to 100.
Swappiness * uint64 ` json:"swappiness,omitempty" `
}
2017-04-12 23:12:04 +00:00
// LinuxCPU for Linux cgroup 'cpu' resource management
type LinuxCPU struct {
2016-09-20 08:16:59 +00:00
// CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
Shares * uint64 ` json:"shares,omitempty" `
// CPU hardcap limit (in usecs). Allowed cpu time in a given period.
2017-04-12 23:12:04 +00:00
Quota * int64 ` json:"quota,omitempty" `
2016-09-20 08:16:59 +00:00
// CPU period to be used for hardcapping (in usecs).
Period * uint64 ` json:"period,omitempty" `
// How much time realtime scheduling may use (in usecs).
2017-04-12 23:12:04 +00:00
RealtimeRuntime * int64 ` json:"realtimeRuntime,omitempty" `
2016-09-20 08:16:59 +00:00
// CPU period to be used for realtime scheduling (in usecs).
RealtimePeriod * uint64 ` json:"realtimePeriod,omitempty" `
// CPUs to use within the cpuset. Default is to use any CPU available.
2017-04-12 23:12:04 +00:00
Cpus string ` json:"cpus,omitempty" `
2016-09-20 08:16:59 +00:00
// List of memory nodes in the cpuset. Default is to use any available memory node.
2017-04-12 23:12:04 +00:00
Mems string ` json:"mems,omitempty" `
2016-09-20 08:16:59 +00:00
}
2017-04-12 23:12:04 +00:00
// LinuxPids for Linux cgroup 'pids' resource management (Linux 4.3)
type LinuxPids struct {
2016-09-20 08:16:59 +00:00
// Maximum number of PIDs. Default is "no limit".
2017-04-12 23:12:04 +00:00
Limit int64 ` json:"limit" `
2016-09-20 08:16:59 +00:00
}
2017-04-12 23:12:04 +00:00
// LinuxNetwork identification and priority configuration
type LinuxNetwork struct {
2016-09-20 08:16:59 +00:00
// Set class identifier for container's network packets
2017-04-12 23:12:04 +00:00
ClassID * uint32 ` json:"classID,omitempty" `
2016-09-20 08:16:59 +00:00
// Set priority of network traffic for container
2017-04-12 23:12:04 +00:00
Priorities [ ] LinuxInterfacePriority ` json:"priorities,omitempty" `
2016-09-20 08:16:59 +00:00
}
2017-04-12 23:12:04 +00:00
// LinuxResources has container runtime resource constraints
type LinuxResources struct {
// Devices configures the device whitelist.
Devices [ ] LinuxDeviceCgroup ` json:"devices,omitempty" `
2016-09-20 08:16:59 +00:00
// DisableOOMKiller disables the OOM killer for out of memory conditions
DisableOOMKiller * bool ` json:"disableOOMKiller,omitempty" `
// Specify an oom_score_adj for the container.
OOMScoreAdj * int ` json:"oomScoreAdj,omitempty" `
// Memory restriction configuration
2017-04-12 23:12:04 +00:00
Memory * LinuxMemory ` json:"memory,omitempty" `
2016-09-20 08:16:59 +00:00
// CPU resource restriction configuration
2017-04-12 23:12:04 +00:00
CPU * LinuxCPU ` json:"cpu,omitempty" `
2016-09-20 08:16:59 +00:00
// Task resource restriction configuration.
2017-04-12 23:12:04 +00:00
Pids * LinuxPids ` json:"pids,omitempty" `
2016-09-20 08:16:59 +00:00
// BlockIO restriction configuration
2017-04-12 23:12:04 +00:00
BlockIO * LinuxBlockIO ` json:"blockIO,omitempty" `
2016-09-20 08:16:59 +00:00
// Hugetlb limit (in bytes)
2017-04-12 23:12:04 +00:00
HugepageLimits [ ] LinuxHugepageLimit ` json:"hugepageLimits,omitempty" `
2016-09-20 08:16:59 +00:00
// Network restriction configuration
2017-04-12 23:12:04 +00:00
Network * LinuxNetwork ` json:"network,omitempty" `
2016-09-20 08:16:59 +00:00
}
2017-04-12 23:12:04 +00:00
// LinuxDevice represents the mknod information for a Linux special device file
type LinuxDevice struct {
2016-09-20 08:16:59 +00:00
// Path to the device.
Path string ` json:"path" `
// Device type, block, char, etc.
Type string ` json:"type" `
// Major is the device's major number.
Major int64 ` json:"major" `
// Minor is the device's minor number.
Minor int64 ` json:"minor" `
// FileMode permission bits for the device.
FileMode * os . FileMode ` json:"fileMode,omitempty" `
// UID of the device.
UID * uint32 ` json:"uid,omitempty" `
// Gid of the device.
GID * uint32 ` json:"gid,omitempty" `
}
2017-04-12 23:12:04 +00:00
// LinuxDeviceCgroup represents a device rule for the whitelist controller
type LinuxDeviceCgroup struct {
2016-09-20 08:16:59 +00:00
// Allow or deny
Allow bool ` json:"allow" `
// Device type, block, char, etc.
2017-04-12 23:12:04 +00:00
Type string ` json:"type,omitempty" `
2016-09-20 08:16:59 +00:00
// Major is the device's major number.
Major * int64 ` json:"major,omitempty" `
// Minor is the device's minor number.
Minor * int64 ` json:"minor,omitempty" `
// Cgroup access permissions format, rwm.
2017-04-12 23:12:04 +00:00
Access string ` json:"access,omitempty" `
2016-09-20 08:16:59 +00:00
}
// Solaris contains platform specific configuration for Solaris application containers.
type Solaris struct {
// SMF FMRI which should go "online" before we start the container process.
Milestone string ` json:"milestone,omitempty" `
// Maximum set of privileges any process in this container can obtain.
LimitPriv string ` json:"limitpriv,omitempty" `
// The maximum amount of shared memory allowed for this container.
MaxShmMemory string ` json:"maxShmMemory,omitempty" `
// Specification for automatic creation of network resources for this container.
2017-04-12 23:12:04 +00:00
Anet [ ] SolarisAnet ` json:"anet,omitempty" `
2016-09-20 08:16:59 +00:00
// Set limit on the amount of CPU time that can be used by container.
2017-04-12 23:12:04 +00:00
CappedCPU * SolarisCappedCPU ` json:"cappedCPU,omitempty" `
2016-09-20 08:16:59 +00:00
// The physical and swap caps on the memory that can be used by this container.
2017-04-12 23:12:04 +00:00
CappedMemory * SolarisCappedMemory ` json:"cappedMemory,omitempty" `
2016-09-20 08:16:59 +00:00
}
2017-04-12 23:12:04 +00:00
// SolarisCappedCPU allows users to set limit on the amount of CPU time that can be used by container.
type SolarisCappedCPU struct {
2016-09-20 08:16:59 +00:00
Ncpus string ` json:"ncpus,omitempty" `
}
2017-04-12 23:12:04 +00:00
// SolarisCappedMemory allows users to set the physical and swap caps on the memory that can be used by this container.
type SolarisCappedMemory struct {
2016-09-20 08:16:59 +00:00
Physical string ` json:"physical,omitempty" `
Swap string ` json:"swap,omitempty" `
}
2017-04-12 23:12:04 +00:00
// SolarisAnet provides the specification for automatic creation of network resources for this container.
type SolarisAnet struct {
2016-09-20 08:16:59 +00:00
// Specify a name for the automatically created VNIC datalink.
Linkname string ` json:"linkname,omitempty" `
// Specify the link over which the VNIC will be created.
Lowerlink string ` json:"lowerLink,omitempty" `
// The set of IP addresses that the container can use.
Allowedaddr string ` json:"allowedAddress,omitempty" `
// Specifies whether allowedAddress limitation is to be applied to the VNIC.
Configallowedaddr string ` json:"configureAllowedAddress,omitempty" `
// The value of the optional default router.
Defrouter string ` json:"defrouter,omitempty" `
// Enable one or more types of link protection.
Linkprotection string ` json:"linkProtection,omitempty" `
// Set the VNIC's macAddress
Macaddress string ` json:"macAddress,omitempty" `
}
2017-04-12 23:12:04 +00:00
// Windows defines the runtime configuration for Windows based containers, including Hyper-V containers.
type Windows struct {
// Resources contains information for handling resource constraints for the container.
Resources * WindowsResources ` json:"resources,omitempty" `
}
// WindowsResources has container runtime resource constraints for containers running on Windows.
type WindowsResources struct {
// Memory restriction configuration.
Memory * WindowsMemoryResources ` json:"memory,omitempty" `
// CPU resource restriction configuration.
CPU * WindowsCPUResources ` json:"cpu,omitempty" `
// Storage restriction configuration.
Storage * WindowsStorageResources ` json:"storage,omitempty" `
// Network restriction configuration.
Network * WindowsNetworkResources ` json:"network,omitempty" `
}
// WindowsMemoryResources contains memory resource management settings.
type WindowsMemoryResources struct {
// Memory limit in bytes.
Limit * uint64 ` json:"limit,omitempty" `
// Memory reservation in bytes.
Reservation * uint64 ` json:"reservation,omitempty" `
}
// WindowsCPUResources contains CPU resource management settings.
type WindowsCPUResources struct {
// Number of CPUs available to the container.
Count * uint64 ` json:"count,omitempty" `
// CPU shares (relative weight to other containers with cpu shares). Range is from 1 to 10000.
Shares * uint16 ` json:"shares,omitempty" `
// Percent of available CPUs usable by the container.
Percent * uint8 ` json:"percent,omitempty" `
}
// WindowsStorageResources contains storage resource management settings.
type WindowsStorageResources struct {
// Specifies maximum Iops for the system drive.
Iops * uint64 ` json:"iops,omitempty" `
// Specifies maximum bytes per second for the system drive.
Bps * uint64 ` json:"bps,omitempty" `
// Sandbox size specifies the minimum size of the system drive in bytes.
SandboxSize * uint64 ` json:"sandboxSize,omitempty" `
}
// WindowsNetworkResources contains network resource management settings.
type WindowsNetworkResources struct {
// EgressBandwidth is the maximum egress bandwidth in bytes per second.
EgressBandwidth * uint64 ` json:"egressBandwidth,omitempty" `
}
// LinuxSeccomp represents syscall restrictions
type LinuxSeccomp struct {
DefaultAction LinuxSeccompAction ` json:"defaultAction" `
Architectures [ ] Arch ` json:"architectures,omitempty" `
Syscalls [ ] LinuxSyscall ` json:"syscalls" `
}
2016-09-20 08:16:59 +00:00
// Arch used for additional architectures
type Arch string
// Additional architectures permitted to be used for system calls
// By default only the native architecture of the kernel is permitted
const (
ArchX86 Arch = "SCMP_ARCH_X86"
ArchX86_64 Arch = "SCMP_ARCH_X86_64"
ArchX32 Arch = "SCMP_ARCH_X32"
ArchARM Arch = "SCMP_ARCH_ARM"
ArchAARCH64 Arch = "SCMP_ARCH_AARCH64"
ArchMIPS Arch = "SCMP_ARCH_MIPS"
ArchMIPS64 Arch = "SCMP_ARCH_MIPS64"
ArchMIPS64N32 Arch = "SCMP_ARCH_MIPS64N32"
ArchMIPSEL Arch = "SCMP_ARCH_MIPSEL"
ArchMIPSEL64 Arch = "SCMP_ARCH_MIPSEL64"
ArchMIPSEL64N32 Arch = "SCMP_ARCH_MIPSEL64N32"
ArchPPC Arch = "SCMP_ARCH_PPC"
ArchPPC64 Arch = "SCMP_ARCH_PPC64"
ArchPPC64LE Arch = "SCMP_ARCH_PPC64LE"
ArchS390 Arch = "SCMP_ARCH_S390"
ArchS390X Arch = "SCMP_ARCH_S390X"
2017-04-12 23:12:04 +00:00
ArchPARISC Arch = "SCMP_ARCH_PARISC"
ArchPARISC64 Arch = "SCMP_ARCH_PARISC64"
2016-09-20 08:16:59 +00:00
)
2017-04-12 23:12:04 +00:00
// LinuxSeccompAction taken upon Seccomp rule match
type LinuxSeccompAction string
2016-09-20 08:16:59 +00:00
// Define actions for Seccomp rules
const (
2017-04-12 23:12:04 +00:00
ActKill LinuxSeccompAction = "SCMP_ACT_KILL"
ActTrap LinuxSeccompAction = "SCMP_ACT_TRAP"
ActErrno LinuxSeccompAction = "SCMP_ACT_ERRNO"
ActTrace LinuxSeccompAction = "SCMP_ACT_TRACE"
ActAllow LinuxSeccompAction = "SCMP_ACT_ALLOW"
2016-09-20 08:16:59 +00:00
)
2017-04-12 23:12:04 +00:00
// LinuxSeccompOperator used to match syscall arguments in Seccomp
type LinuxSeccompOperator string
2016-09-20 08:16:59 +00:00
// Define operators for syscall arguments in Seccomp
const (
2017-04-12 23:12:04 +00:00
OpNotEqual LinuxSeccompOperator = "SCMP_CMP_NE"
OpLessThan LinuxSeccompOperator = "SCMP_CMP_LT"
OpLessEqual LinuxSeccompOperator = "SCMP_CMP_LE"
OpEqualTo LinuxSeccompOperator = "SCMP_CMP_EQ"
OpGreaterEqual LinuxSeccompOperator = "SCMP_CMP_GE"
OpGreaterThan LinuxSeccompOperator = "SCMP_CMP_GT"
OpMaskedEqual LinuxSeccompOperator = "SCMP_CMP_MASKED_EQ"
2016-09-20 08:16:59 +00:00
)
2017-04-12 23:12:04 +00:00
// LinuxSeccompArg used for matching specific syscall arguments in Seccomp
type LinuxSeccompArg struct {
Index uint ` json:"index" `
Value uint64 ` json:"value" `
ValueTwo uint64 ` json:"valueTwo" `
Op LinuxSeccompOperator ` json:"op" `
2016-09-20 08:16:59 +00:00
}
2017-04-12 23:12:04 +00:00
// LinuxSyscall is used to match a syscall in Seccomp
type LinuxSyscall struct {
Names [ ] string ` json:"names" `
Action LinuxSeccompAction ` json:"action" `
Args [ ] LinuxSeccompArg ` json:"args" `
Comment string ` json:"comment" `
2016-09-20 08:16:59 +00:00
}