1- //package oci.config.runtime;
21package oci ;
32
4- import "runtime_config_linux.proto" ;
5-
63// RuntimeSpec is the generic runtime state information on a running container
74message RuntimeSpec {
85 // Mounts is a mapping of names to mount configurations.
@@ -13,13 +10,6 @@ message RuntimeSpec {
1310 optional Hooks hooks = 2 ;
1411}
1512
16- // LinuxRuntimeSpec is the full specification for linux containers.
17- message LinuxRuntimeSpec {
18- optional RuntimeSpec runtime_spec = 1 ;
19- // LinuxRuntime is platform specific configuration for linux based containers.
20- optional oci.LinuxRuntime linux = 2 ;
21- }
22-
2313// MountFieldEntry is more backwards compatible protobuf associative map (than map<string, Mount>)
2414message MountFieldEntry {
2515 required string key = 1 ;
@@ -52,3 +42,230 @@ message Hooks {
5242 // Poststop is a list of hooks to be run after the container process exits.
5343 repeated Hook poststop = 2 ;
5444}
45+
46+ // LinuxStateDirectory holds the container's state information
47+ message DefaultState {
48+ // TODO(vbatts) not as elegant in some ways, but there is not a concept of const here
49+ optional string directory = 1 [default = "/run/opencontainer/containers" ];
50+ }
51+
52+ /*
53+ BEGIN Linux specific runtime
54+ */
55+
56+ // LinuxRuntimeSpec is the full specification for linux containers.
57+ message LinuxRuntimeSpec {
58+ optional RuntimeSpec runtime_spec = 1 ;
59+ // LinuxRuntime is platform specific configuration for linux based containers.
60+ optional LinuxRuntime linux = 2 ;
61+ }
62+
63+ // LinuxRuntime hosts the Linux-only runtime information
64+ message LinuxRuntime {
65+ // UidMapping specifies user mappings for supporting user namespaces on linux.
66+ repeated IDMapping uid_mapping = 1 ;
67+ // GidMapping specifies group mappings for supporting user namespaces on linux.
68+ repeated IDMapping gid_mapping = 2 ;
69+ // Rlimits specifies rlimit options to apply to the container's process.
70+ repeated Rlimit rlimits = 3 ;
71+ // Sysctl are a set of key value pairs that are set for the container on start
72+ repeated StringStringEntry sysctl = 4 ;
73+ // Resources contain cgroup information for handling resource constraints
74+ // for the container
75+ optional Resources resources = 5 ;
76+ // CgroupsPath specifies the path to cgroups that are created and/or joined by the container.
77+ // The path is expected to be relative to the cgroups mountpoint.
78+ // If resources are specified, the cgroups at CgroupsPath will be updated based on resources.
79+ optional string cgroups_path = 6 ;
80+ // Namespaces contains the namespaces that are created and/or joined by the container
81+ repeated Namespace namespaces = 7 ;
82+ // Devices are a list of device nodes that are created and enabled for the container
83+ repeated Device devices = 8 ;
84+ // ApparmorProfile specified the apparmor profile for the container.
85+ optional string apparmor_profile = 9 ;
86+ // SelinuxProcessLabel specifies the selinux context that the container process is run as.
87+ optional string selinux_process_label = 10 ;
88+ // Seccomp specifies the seccomp security settings for the container.
89+ optional Seccomp seccomp = 11 ;
90+ // RootfsPropagation is the rootfs mount propagation mode for the container
91+ optional string rootfs_propagation = 12 ;
92+ }
93+
94+ // IDMapping specifies UID/GID mappings
95+ message IDMapping {
96+ // HostID is the UID/GID of the host user or group
97+ optional int32 host_id = 1 ;
98+ // ContainerID is the UID/GID of the container's user or group
99+ optional int32 container_id = 2 ;
100+ // Size is the length of the range of IDs mapped between the two namespaces
101+ optional int32 size = 3 ;
102+ }
103+
104+ // Rlimit type and restrictions
105+ message Rlimit {
106+ // Type of the rlimit to set
107+ optional string type = 1 ;
108+ // Hard is the hard limit for the specified type
109+ optional uint64 hard = 2 ;
110+ // Soft is the soft limit for the specified type
111+ optional uint64 soft = 3 ;
112+ }
113+
114+ // StringStringEntry is more backwards compatible protobuf associative map (than map<string, Mount>)
115+ message StringStringEntry {
116+ required string key = 1 ;
117+ required string value = 2 ;
118+ }
119+
120+ // Resources has container runtime resource constraints
121+ message Resources {
122+ // DisableOOMKiller disables the OOM killer for out of memory conditions
123+ optional bool disable_oom_killer = 1 ;
124+ // Memory restriction configuration
125+ optional Memory memory = 2 ;
126+ // CPU resource restriction configuration
127+ optional CPU cpu = 3 ;
128+ // Task resource restriction configuration.
129+ optional Pids pids = 4 ;
130+ // BlockIO restriction configuration
131+ optional BlockIO block_io = 5 ;
132+ // Hugetlb limit (in bytes)
133+ repeated HugepageLimit hugepage_limits = 6 ;
134+ // Network restriction configuration
135+ optional Network network = 7 ;
136+ }
137+
138+ // Memory for Linux cgroup 'memory' resource management
139+ message Memory {
140+ // Memory limit (in bytes)
141+ optional int64 limit = 1 ;
142+ // Memory reservation or soft_limit (in bytes)
143+ optional int64 reservation = 2 ;
144+ // Total memory usage (memory + swap); set `-1' to disable swap
145+ optional int64 swap = 3 ;
146+ // Kernel memory limit (in bytes)
147+ optional int64 kernel = 4 ;
148+ // How aggressive the kernel will swap memory pages. Range from 0 to 100. Set -1 to use system default
149+ optional int64 Swappiness = 5 ;
150+ }
151+
152+ // CPU for Linux cgroup 'cpu' resource management
153+ message CPU {
154+ // CPU shares (relative weight vs. other cgroups with cpu shares)
155+ optional int64 shares = 1 ;
156+ // CPU hardcap limit (in usecs). Allowed cpu time in a given period
157+ optional int64 quota = 2 ;
158+ // CPU period to be used for hardcapping (in usecs). 0 to use system default
159+ optional int64 period = 3 ;
160+ // How many time CPU will use in realtime scheduling (in usecs)
161+ optional int64 realtime_runtime = 4 ;
162+ // CPU period to be used for realtime scheduling (in usecs)
163+ optional int64 realtime_period = 5 ;
164+ // CPU to use within the cpuset
165+ optional string cpus = 6 ;
166+ // MEM to use within the cpuset
167+ optional string mems = 7 ;
168+ }
169+
170+ // Pids for Linux cgroup 'pids' resource management (Linux 4.3)
171+ message Pids {
172+ // Maximum number of PIDs. A value < 0 implies "no limit".
173+ optional int64 limit = 1 ;
174+ }
175+
176+ // BlockIO for Linux cgroup 'blockio' resource management
177+ message BlockIO {
178+ // Specifies per cgroup weight, range is from 10 to 1000
179+ optional int64 weight = 1 ;
180+ // Weight per cgroup per device, can override BlkioWeight
181+ optional string weight_device = 2 ;
182+ // IO read rate limit per cgroup per device, bytes per second
183+ optional string throttle_read_bps_device = 3 ;
184+ // IO write rate limit per cgroup per divice, bytes per second
185+ optional string throttle_write_bps_device = 4 ;
186+ // IO read rate limit per cgroup per device, IO per second
187+ optional string throttle_read_iops_device = 5 ;
188+ // IO write rate limit per cgroup per device, IO per second
189+ optional string throttle_write_iops_device = 6 ;
190+ }
191+
192+ // HugepageLimit structure corresponds to limiting kernel hugepages
193+ message HugepageLimit {
194+ optional string pagesize = 1 ;
195+ optional int32 limit = 2 ;
196+ }
197+
198+ // Network identification and priority configuration
199+ message Network {
200+ // Set class identifier for container's network packets
201+ optional string class_id = 1 ;
202+ // Set priority of network traffic for container
203+ repeated InterfacePriority priorities = 2 ;
204+ }
205+
206+ // InterfacePriority for network interfaces
207+ message InterfacePriority {
208+ // Name is the name of the network interface
209+ optional string name = 1 ;
210+ // Priority for the interface
211+ optional int64 priority = 2 ;
212+ }
213+
214+ // Namespace is the configuration for a linux namespace
215+ message Namespace {
216+ // Type is the type of Linux namespace
217+ optional string type = 1 ;
218+ // Path is a path to an existing namespace persisted on disk that can be joined
219+ // and is of the same type
220+ optional string path = 2 ;
221+ }
222+
223+ // Device represents the information on a Linux special device file
224+ message Device {
225+ // Path to the device.
226+ optional string path = 1 ;
227+ // Device type, block, char, etc.
228+ // TODO(vbatts) ensure int32 is fine here, instead of golang's rune
229+ optional int32 type = 2 ;
230+ // Major is the device's major number.
231+ optional int64 major = 3 ;
232+ // Minor is the device's minor number.
233+ optional int64 minor = 4 ;
234+ // Cgroup permissions format, rwm.
235+ optional string permissions = 5 ;
236+ // FileMode permission bits for the device.
237+ // TODO(vbatts) os.FileMode is an octal uint32
238+ optional uint32 file_mode = 6 ;
239+ // Uid of the device.
240+ optional uint32 uid = 7 ;
241+ // Gid of the device.
242+ optional uint32 gid = 8 ;
243+ }
244+
245+ // Seccomp represents syscall restrictions
246+ message Seccomp {
247+ // TODO(vbatts) string instead of "Action" type
248+ optional string default_action = 1 ;
249+ repeated Syscall syscalls = 2 ;
250+ }
251+
252+ // Syscall is used to match a syscall in Seccomp
253+ message Syscall {
254+ optional string name = 1 ;
255+ optional string action = 2 ;
256+ repeated Arg args = 3 ;
257+ }
258+
259+ // Arg used for matching specific syscall arguments in Seccomp
260+ message Arg {
261+ optional uint32 index = 1 ;
262+ optional uint64 value = 2 ;
263+ optional uint64 value_two = 3 ;
264+ // Op is the operator string
265+ optional string op = 4 ;
266+ }
267+
268+ /*
269+ END Linux specific runtime
270+ */
271+
0 commit comments