Skip to content

Mount type/options are not optional in my experience. #285

@oreillymj

Description

@oreillymj

In the CDI spec, both mount type and mount options are marked as optional. My experience is that the mount fails without an access option set. The error is also pretty confusing.

Using dev0 from this CDI file fails

cdiVersion: 0.6.0
kind: vendor.com/device
devices:
    - name: dev0
      containerEdits:
        env:
            - SOME_VAR=dev0
            - FOO=injected
        mounts:
            - hostPath: /usr/lib/firmware
              containerPath: /usr/lib/firmware
              type: ""
              options: []

with the following error

Warning Failed 12s kubelet Error: failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/usr/lib/firmware" to rootfs at "/usr/lib/firmware": mount src=/usr/lib/firmware, dst=/usr/lib/firmware, dstFd=/proc/thread-self/fd/8: no such device

If the mounts have a type and options, then the same pod is created sucessfully

        mounts:
            - hostPath: /usr/lib/firmware
              containerPath: /usr/lib/firmware
              type: bind
              options:
                - rbind
                - ro

To replicate I have created a skeleton device plugin here , which advertises 8 device to kublet and writes a matching CDI file with or without the mount type/options. with the device plugin running, you can test it by scheduling this pod

apiVersion: v1
kind: Pod
metadata:
  name: busybox-bad-mount
spec:
  containers:
  - name: busybox
    image: busybox
    command: ["sleep", "infinity"]
    resources:
      limits:
        vendor.com/device: 1  # Request 1 device
  restartPolicy: Never
  nodeSelector: {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions