Skip to content

Commit d0908f6

Browse files
committed
Let the runtime decide the mount path
Signed-off-by: Sascha Grunert <[email protected]>
1 parent 1ca8b14 commit d0908f6

File tree

1 file changed

+21
-15
lines changed
  • keps/sig-node/4639-oci-volume-source

1 file changed

+21
-15
lines changed

keps/sig-node/4639-oci-volume-source/README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ container image.
351351

352352
The CRI API is already capable of managing container images [via the `ImageService`](https://github.com/kubernetes/cri-api/blob/3a66d9d/pkg/apis/runtime/v1/api.proto#L146-L161).
353353
Those RPCs will be re-used for managing OCI artifacts, while the [`ImageSpec`](https://github.com/kubernetes/cri-api/blob/3a66d9d/pkg/apis/runtime/v1/api.proto#L798-L813)
354+
as well as [`PullImageResponse`](https://github.com/kubernetes/cri-api/blob/3a66d9d/pkg/apis/runtime/v1/api.proto#L1530-L1534)
354355
will be extended to mount the OCI object to a local path:
355356

356357
```protobuf
@@ -359,29 +360,35 @@ will be extended to mount the OCI object to a local path:
359360
message ImageSpec {
360361
// …
361362
362-
// Absolute local path where the image/artifacts should be mounted to.
363-
string mountpoint = 20;
363+
// Indicate that the OCI object should be mounted.
364+
bool mount = 20;
364365
365-
// List of additional mount options (`mount -o`).
366-
repeated string mount_options = 21;
366+
// SELinux label to be used.
367+
string mount_label = 21;
368+
}
369+
370+
message PullImageResponse {
371+
// …
372+
373+
// Absolute local path where the OCI object got mounted.
374+
string mountpoint = 2;
367375
}
368376
```
369377

370378
This allows to re-use the existing kubelet logic for managing the OCI objects,
371379
with the caveat that the new `VolumeSource` won't be isolated in a dedicated
372380
plugin as part of the existing [volume manager](https://github.com/kubernetes/kubernetes/tree/6d0aab2/pkg/kubelet/volumemanager).
373381

374-
The added `mount_options` allow the kubelet to handle features like SELinux
375-
relabelling by passing additional mount arguments.
382+
The added `mount_label` allow the kubelet to support SELinux contexts.
376383

377384
#### Container Runtimes
378385

379-
Container runtimes need to support the new `mountpoint` field, otherwise the
380-
feature cannot be used. The kubelet will verify if the `mountpoint` actually
381-
exists on disk to check the feature availability, because Protobuf will strip
382-
the field in a backwards compatible way for older runtimes. Pods using the new
383-
`VolumeSource` combined with a not supported container runtime version will fail
384-
to run on the node.
386+
Container runtimes need to support the new `mount` field, otherwise the
387+
feature cannot be used. The kubelet will verify if the returned `mountpoint`
388+
actually exists on disk to check the feature availability, because Protobuf will
389+
strip the field in a backwards compatible way for older runtimes. Pods using the
390+
new `VolumeSource` combined with a not supported container runtime version will
391+
fail to run on the node.
385392

386393
For security reasons, volume mounts should set the [`noexec`] and `ro`
387394
(read-only) options by default.
@@ -393,9 +400,8 @@ to volume mounts, which are inherited from the `securityContext` of the pod or
393400
container. Relabeling volume mounts can be time-consuming, especially when there
394401
are many files on the volume.
395402

396-
If the following criteria are met, then the kubelet will use the `mount_options`
397-
field in the CRI to pass `context=<SELinux label>` (`mount -o`) to the container
398-
runtime.
403+
If the following criteria are met, then the kubelet will use the `mount_label`
404+
field in the CRI to apply the right SELinux label to the mount.
399405

400406
- The operating system must support SELinux
401407
- The Pod must have at least `seLinuxOptions.level` assigned in the

0 commit comments

Comments
 (0)