|
| 1 | +package oci; |
| 2 | + |
| 3 | +// LinuxStateDirectory holds the container's state information |
| 4 | +message DefaultState { |
| 5 | + // TODO(vbatts) not as elegant in some ways, but there is not a concept of const here |
| 6 | + optional string Directory = 1 [default = "/run/opencontainer/containers"]; |
| 7 | +} |
| 8 | + |
| 9 | +// LinuxRuntime hosts the Linux-only runtime information |
| 10 | +message LinuxRuntime { |
| 11 | + // UIDMapping specifies user mappings for supporting user namespaces on linux. |
| 12 | + repeated IDMapping UIDMapping = 1; |
| 13 | + // GIDMapping specifies group mappings for supporting user namespaces on linux. |
| 14 | + repeated IDMapping GIDMapping = 2; |
| 15 | + // Rlimits specifies rlimit options to apply to the container's process. |
| 16 | + repeated Rlimit Rlimits = 3; |
| 17 | + // Sysctl are a set of key value pairs that are set for the container on start |
| 18 | + repeated StringStringEntry Sysctl = 4; |
| 19 | + // Resources contain cgroup information for handling resource constraints |
| 20 | + // for the container |
| 21 | + optional Resources Resources = 5; |
| 22 | + // TODO(vbatts) add the rest .. |
| 23 | +} |
| 24 | + |
| 25 | +// IDMapping specifies UID/GID mappings |
| 26 | +message IDMapping { |
| 27 | + // HostID is the UID/GID of the host user or group |
| 28 | + optional int32 HostID = 1; |
| 29 | + // ContainerID is the UID/GID of the container's user or group |
| 30 | + optional int32 ContainerID = 2; |
| 31 | + // Size is the length of the range of IDs mapped between the two namespaces |
| 32 | + optional int32 Size = 3; |
| 33 | +} |
| 34 | + |
| 35 | +// Rlimit type and restrictions |
| 36 | +message Rlimit { |
| 37 | + // Type of the rlimit to set |
| 38 | + optional string Type = 1; |
| 39 | + // Hard is the hard limit for the specified type |
| 40 | + optional uint64 Hard = 2; |
| 41 | + // Soft is the soft limit for the specified type |
| 42 | + optional uint64 Soft = 3; |
| 43 | +} |
| 44 | + |
| 45 | +// StringStringEntry is more backwards compatible protobuf associative map (than map<string, Mount>) |
| 46 | +message StringStringEntry { |
| 47 | + required string key = 1; |
| 48 | + required string value = 2; |
| 49 | +} |
| 50 | + |
| 51 | +// Resources has container runtime resource constraints |
| 52 | +message Resources { |
| 53 | + // DisableOOMKiller disables the OOM killer for out of memory conditions |
| 54 | + optional bool DisableOOMKiller = 1; |
| 55 | + // Memory restriction configuration |
| 56 | + optional Memory Memory = 2; |
| 57 | + // CPU resource restriction configuration |
| 58 | + optional CPU CPU = 3; |
| 59 | + // Task resource restriction configuration. |
| 60 | + optional Pids Pids = 4; |
| 61 | + // BlockIO restriction configuration |
| 62 | + optional BlockIO BlockIO = 5; |
| 63 | + // Hugetlb limit (in bytes) |
| 64 | + repeated HugepageLimit HugepageLimits = 6; |
| 65 | + // Network restriction configuration |
| 66 | + optional Network Network = 7; |
| 67 | +} |
| 68 | + |
| 69 | +// Memory for Linux cgroup 'memory' resource management |
| 70 | +message Memory { |
| 71 | + // Memory limit (in bytes) |
| 72 | + optional int64 Limit = 1; |
| 73 | + // Memory reservation or soft_limit (in bytes) |
| 74 | + optional int64 Reservation = 2; |
| 75 | + // Total memory usage (memory + swap); set `-1' to disable swap |
| 76 | + optional int64 Swap = 3; |
| 77 | + // Kernel memory limit (in bytes) |
| 78 | + optional int64 Kernel = 4; |
| 79 | + // How aggressive the kernel will swap memory pages. Range from 0 to 100. Set -1 to use system default |
| 80 | + optional int64 Swappiness = 5; |
| 81 | +} |
| 82 | + |
| 83 | +// CPU for Linux cgroup 'cpu' resource management |
| 84 | +message CPU { |
| 85 | + // CPU shares (relative weight vs. other cgroups with cpu shares) |
| 86 | + optional int64 Shares = 1; |
| 87 | + // CPU hardcap limit (in usecs). Allowed cpu time in a given period |
| 88 | + optional int64 Quota = 2; |
| 89 | + // CPU period to be used for hardcapping (in usecs). 0 to use system default |
| 90 | + optional int64 Period = 3; |
| 91 | + // How many time CPU will use in realtime scheduling (in usecs) |
| 92 | + optional int64 RealtimeRuntime = 4; |
| 93 | + // CPU period to be used for realtime scheduling (in usecs) |
| 94 | + optional int64 RealtimePeriod = 5; |
| 95 | + // CPU to use within the cpuset |
| 96 | + optional string Cpus = 6; |
| 97 | + // MEM to use within the cpuset |
| 98 | + optional string Mems = 7; |
| 99 | +} |
| 100 | + |
| 101 | +// Pids for Linux cgroup 'pids' resource management (Linux 4.3) |
| 102 | +message Pids { |
| 103 | + // Maximum number of PIDs. A value < 0 implies "no limit". |
| 104 | + optional int64 Limit = 1; |
| 105 | +} |
| 106 | + |
| 107 | +// BlockIO for Linux cgroup 'blockio' resource management |
| 108 | +message BlockIO { |
| 109 | + // Specifies per cgroup weight, range is from 10 to 1000 |
| 110 | + optional int64 Weight = 1; |
| 111 | + // Weight per cgroup per device, can override BlkioWeight |
| 112 | + optional string WeightDevice = 2; |
| 113 | + // IO read rate limit per cgroup per device, bytes per second |
| 114 | + optional string ThrottleReadBpsDevice = 3; |
| 115 | + // IO write rate limit per cgroup per divice, bytes per second |
| 116 | + optional string ThrottleWriteBpsDevice = 4; |
| 117 | + // IO read rate limit per cgroup per device, IO per second |
| 118 | + optional string ThrottleReadIOpsDevice = 5; |
| 119 | + // IO write rate limit per cgroup per device, IO per second |
| 120 | + optional string ThrottleWriteIOpsDevice = 6; |
| 121 | +} |
| 122 | + |
| 123 | +// HugepageLimit structure corresponds to limiting kernel hugepages |
| 124 | +message HugepageLimit { |
| 125 | + optional string Pagesize = 1; |
| 126 | + optional int32 Limit = 2; |
| 127 | +} |
| 128 | + |
| 129 | +// Network identification and priority configuration |
| 130 | +message Network { |
| 131 | + // Set class identifier for container's network packets |
| 132 | + optional string ClassID = 1; |
| 133 | + // Set priority of network traffic for container |
| 134 | + repeated InterfacePriority Priorities = 2; |
| 135 | +} |
| 136 | + |
| 137 | +// InterfacePriority for network interfaces |
| 138 | +message InterfacePriority { |
| 139 | + // Name is the name of the network interface |
| 140 | + optional string Name = 1; |
| 141 | + // Priority for the interface |
| 142 | + optional int64 Priority = 2; |
| 143 | +} |
| 144 | + |
0 commit comments