|
19 | 19 | - [Risks and Mitigations](#risks-and-mitigations) |
20 | 20 | - [Design Details](#design-details) |
21 | 21 | - [Pod.spec changes](#podspec-changes) |
| 22 | + - [CRI changes](#cri-changes) |
22 | 23 | - [Phases](#phases) |
23 | 24 | - [Phase 1: pods "without" volumes](#phase-1-pods-without-volumes) |
24 | 25 | - [Phase 2: pods with volumes](#phase-2-pods-with-volumes) |
@@ -200,6 +201,65 @@ If true or not present, uses the host user namespace (as today) |
200 | 201 | If false, a new userns is created for the pod. |
201 | 202 | By default it is set to `true`. |
202 | 203 |
|
| 204 | +### CRI changes |
| 205 | + |
| 206 | +The following messages will be added: |
| 207 | + |
| 208 | +``` |
| 209 | +// A IDMapping describes a ID mapping for the user namespace used for the |
| 210 | +// pod. |
| 211 | +message IDMapping { |
| 212 | + // host_id is the id on the host. |
| 213 | + uint32 host_id = 1; |
| 214 | + // container_id is the id in the container. |
| 215 | + uint32 container_id = 2; |
| 216 | + // length is the size of the range to map. |
| 217 | + uint32 length = 3; |
| 218 | +} |
| 219 | +
|
| 220 | +// A UserNamespace describes the intended user namespace configuration. |
| 221 | +message UserNamespace { |
| 222 | + // User namespace for this sandbox. |
| 223 | + // Note: It currently supports only POD and NODE. |
| 224 | + NamespaceMode mode = 1; |
| 225 | +
|
| 226 | + // uids specifies the UID mappings for the user namespace. |
| 227 | + repeated IDMapping uids = 2; |
| 228 | +
|
| 229 | + // gids specifies the GID mappings for the user namespace. |
| 230 | + repeated IDMapping gids = 3; |
| 231 | +} |
| 232 | +``` |
| 233 | + |
| 234 | +The existing message `NamespaceOption` will have a `user` field added. |
| 235 | +The complete `NamespaceOption` message with the new field is shown here: |
| 236 | + |
| 237 | +``` |
| 238 | +// NamespaceOption provides options for Linux namespaces. |
| 239 | +message NamespaceOption { |
| 240 | + // Network namespace for this container/sandbox. |
| 241 | + // Note: There is currently no way to set CONTAINER scoped network in the Kubernetes API. |
| 242 | + // Namespaces currently set by the kubelet: POD, NODE |
| 243 | + NamespaceMode network = 1; |
| 244 | + // PID namespace for this container/sandbox. |
| 245 | + // Note: The CRI default is POD, but the v1.PodSpec default is CONTAINER. |
| 246 | + // The kubelet's runtime manager will set this to CONTAINER explicitly for v1 pods. |
| 247 | + // Namespaces currently set by the kubelet: POD, CONTAINER, NODE, TARGET |
| 248 | + NamespaceMode pid = 2; |
| 249 | + // IPC namespace for this container/sandbox. |
| 250 | + // Note: There is currently no way to set CONTAINER scoped IPC in the Kubernetes API. |
| 251 | + // Namespaces currently set by the kubelet: POD, NODE |
| 252 | + NamespaceMode ipc = 3; |
| 253 | + // Target Container ID for NamespaceMode of TARGET. This container must have been |
| 254 | + // previously created in the same pod. It is not possible to specify different targets |
| 255 | + // for each namespace. |
| 256 | + string target_id = 4; |
| 257 | + // User namespace for this sandbox. |
| 258 | + UserNamespace user = 5; |
| 259 | +} |
| 260 | +
|
| 261 | +``` |
| 262 | + |
203 | 263 | ### Phases |
204 | 264 |
|
205 | 265 | We propose to divide the work in 3 phases. Each phase makes this work with |
|
0 commit comments