Skip to content

runtime-rs: parse block-mounts annotation for volumeDevice passthrough#57

Open
TheRayquaza wants to merge 2 commits intodatadogfrom
mateo.lelong/runtime-rs-block-mounts
Open

runtime-rs: parse block-mounts annotation for volumeDevice passthrough#57
TheRayquaza wants to merge 2 commits intodatadogfrom
mateo.lelong/runtime-rs-block-mounts

Conversation

@TheRayquaza
Copy link
Copy Markdown

Summary

Parse io.katacontainers.volume.block-mounts annotation and convert matching volumeDevices into agent Storage objects, enabling block device passthrough via annotation in the Rust shim, mirroring Go runtime behavior.

Test plan

Test C1 - Block annotation mounts

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: kata-val-e1-pvc-2
  namespace: default
spec:
  accessModes: [ReadWriteOnce]
  volumeMode: Block
  storageClassName: ephemeral-premium-v2-lrs
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: kata-val-e1-2
  namespace: default
  annotations:
    io.katacontainers.volume.block-mounts: |
      {"/dev/block-vol": {"mount": "/data", "fstype": "ext4", "options": ["rw"]}}
spec:
  nodeName: us3-staging-dog-arbok-90eec5c94014646d000003
  runtimeClassName: kata-qemu-runtime-rs
  containers:
  - name: test
    image: registry.ddbuild.io/images/base/gbi-ubuntu_2204:release
    command: ["sleep", "3600"]
    volumeDevices:
    - name: block-storage
      devicePath: /dev/block-vol
  volumes:
  - name: block-storage
    persistentVolumeClaim:
      claimName: kata-val-e1-pvc-2

Pass signals:

  • Pod reaches Running
  • Can write to filesystem at the specified mount point

Test C2 - Invalid annotation JSON

apiVersion: v1
kind: Pod
metadata:
  name: kata-val-e3
  namespace: default
  annotations:
    io.katacontainers.volume.block-mounts: "not valid json {"
spec:
  nodeName: us3-staging-dog-arbok-90eec5c94014646d000003
  runtimeClassName: kata-qemu-runtime-rs
  containers:
  - name: test
    image: registry.ddbuild.io/images/base/gbi-ubuntu_2204:release
    command: ["sleep", "3600"]

Pass signals:

  • Warning logged: error parsing block mounts annotation
  • Pod start fails with a clean parse error (no panic)

Parse io.katacontainers.volume.block-mounts annotation and convert
matching volumeDevices into agent Storage objects, enabling block device
annotation mounts in the Rust shim, mirroring the Go runtime behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@zaymat zaymat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at it again, I don't think this patch was ever merged into our main branch.

I think this is the PR but we never merged it: https://github.com/DataDog/kata-containers/pull/40/changes

Comment thread src/libs/kata-types/src/annotations/mod.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants