Skip to content

Commit 2300ee9

Browse files
committed
Add more flow explanation and mermaid chart
Signed-off-by: Sascha Grunert <[email protected]>
1 parent 91e367c commit 2300ee9

File tree

1 file changed

+50
-0
lines changed
  • keps/sig-node/4639-oci-volume-source

1 file changed

+50
-0
lines changed

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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,56 @@ mounted volume paths to the `ImageStatusResponse.Image` message returned by the
463463
the kubelet and the runtime to ensure that no context gets lost in restart
464464
scenarios.
465465

466+
The overall flow for container creation will look like this:
467+
468+
```mermaid
469+
sequenceDiagram
470+
participant K as kubelet
471+
participant C as Container Runtime
472+
Note left of K: During pod sync
473+
Note over K,C: CRI
474+
K->>+C: RPC: PullImage
475+
Note right of C: Pull and mount<br/>OCI object
476+
C-->>-K: PullImageResponse.Mountpoint
477+
Note left of K: Add mount points<br/> to container<br/>creation request
478+
K->>+C: RPC: CreateContainer
479+
Note right of C: Add bind mounts<br/>from object mount<br/>point to container
480+
C-->>-K: CreateContainerResponse
481+
```
482+
483+
1. **Kubelet Initiates Image Pull**:
484+
- During pod setup, the kubelet initiates the pull for the OCI object based on the volume source.
485+
- The kubelet passes the necessary indicator to mount the object to the container runtime.
486+
487+
2. **Runtime Handles Mounting**:
488+
- The container runtime mounts the OCI object as a filesystem using the metadata provided by the kubelet.
489+
- The runtime returns the mount point information to the kubelet.
490+
491+
3. **Redirecting of the Mountpoint**:
492+
- The kubelet uses the returned mount point to build the container creation request for each container using that mount.
493+
- The kubelet initiates the container creation and the runtime creates the required bind mounts to the target location.
494+
This is the current implemented behavior for all other mounts and should require no actual container runtime code change.
495+
496+
4. **Lifecycle Management**:
497+
- The container runtime manages the lifecycle of the mounts, ensuring they are created during pod setup and cleaned up upon sandbox removal.
498+
499+
5. **Tracking and Coordination**:
500+
- The kubelet and runtime coordinate to track pods requesting mounts to avoid removing containers with volumes in use.
501+
- During image garbage collection, the runtime provides the kubelet with the necessary mount information to ensure proper cleanup.
502+
503+
6. **SELinux Context Handling**:
504+
- The runtime applies SELinux labels to the volume mounts based on the security context provided by the kubelet, ensuring consistent enforcement of security policies.
505+
506+
7. **Pull Policy Implementation**:
507+
- The `pullPolicy` at the pod level will determine when the OCI object is pulled, with options for `IfNotPresent`, `Always`, and `Never`.
508+
- `IfNotPresent`: Prevents redundant pulls and uses existing images when available.
509+
- `Always`: Ensures the latest images are used, for example, with development and testing environments.
510+
- `Never`: Ensures only pre-pulled images are used, for example, in air-gapped or controlled environments.
511+
512+
8. **Security and Performance Optimization**:
513+
- Implement thorough security checks to mitigate risks such as path traversal attacks.
514+
- Optimize performance for handling large OCI artifacts, including caching strategies and efficient retrieval methods.
515+
466516
#### Container Runtimes
467517

468518
Container runtimes need to support the new `mount` field, otherwise the

0 commit comments

Comments
 (0)