diff --git a/runtime_config.go b/runtime_config.go index 6418f010..1ea6640a 100644 --- a/runtime_config.go +++ b/runtime_config.go @@ -1,5 +1,6 @@ package specs +// RuntimeSpec is the generic runtime state information on a running container type RuntimeSpec struct { // Mounts is a mapping of names to mount configurations. // Which mounts will be mounted and where should be chosen with MountPoints @@ -9,13 +10,14 @@ type RuntimeSpec struct { Hooks Hooks `json:"hooks"` } -// Hook specifies a command that is run at a particular event in the lifecycle of a container. +// 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"` Env []string `json:"env"` } +// 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. @@ -24,7 +26,7 @@ type Hooks struct { Poststop []Hook `json:"poststop"` } -// Mount specifies a mount for a container. +// Mount specifies a mount for a container type Mount struct { // Type specifies the mount kind. Type string `json:"type"` diff --git a/runtime_config_linux.go b/runtime_config_linux.go index 3c879449..7ddffdd0 100644 --- a/runtime_config_linux.go +++ b/runtime_config_linux.go @@ -12,6 +12,7 @@ type LinuxRuntimeSpec struct { Linux LinuxRuntime `json:"linux"` } +// LinuxRuntime hosts the Linux-only runtime information type LinuxRuntime struct { // UIDMapping specifies user mappings for supporting user namespaces on linux. UIDMappings []IDMapping `json:"uidMappings"` @@ -38,7 +39,7 @@ type LinuxRuntime struct { RootfsPropagation string `json:"rootfsPropagation"` } -// Namespace is the configuration for a linux namespace. +// Namespace is the configuration for a linux namespace type Namespace struct { // Type is the type of Linux namespace Type NamespaceType `json:"type"` @@ -51,12 +52,18 @@ type Namespace struct { type NamespaceType string const ( - PIDNamespace NamespaceType = "pid" - NetworkNamespace = "network" - MountNamespace = "mount" - IPCNamespace = "ipc" - UTSNamespace = "uts" - UserNamespace = "user" + // PIDNamespace for isolating process IDs + PIDNamespace NamespaceType = "pid" + // 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" ) // IDMapping specifies UID/GID mappings @@ -141,6 +148,7 @@ type CPU struct { Mems string `json:"mems"` } +// Pids for Linux cgroup 'pids' resource management (Linux 4.3) type Pids struct { // Maximum number of PIDs. A value < 0 implies "no limit". Limit int64 `json:"limit"` @@ -172,6 +180,7 @@ type Resources struct { Network Network `json:"network"` } +// Device represents the information on a Linux special device file type Device struct { // Path to the device. Path string `json:"path"`