Skip to content

Add support for CSI volumes

Brandon Butler requested to merge (removed):csi-volume into master

What does this MR do?

Adds support for a new CSI volume type in the Kubernetes executor.

Why was this MR needed?

With different methods of supplying storage to a container within a pod, new types of volumes may need to be added. Ephemeral inline volumes are one such storage type, made available via CSI drivers.

The benefit of CSI ephemeral inline volumes, is that the storage has the same lifecycle as the job pod, but the storage medium is more flexible than standard ephemeral volumes, depending on the driver used. One such provider of a driver is Portworx.

What's the best way to test this MR?

Install a CSI driver, like pxd.portworx.com, that supports an inline ephemeral volume and configure a runner with something like:

[[runners.kubernetes.volumes.csi]]
  name = "csi-volume"
  mount_path = "/builds/csi-volume"
  driver = "pxd.portworx.com"
  [runners.kubernetes.volumes.csi.volume_attributes]
    "size" = "2Gi"

A comparable volume and volumeMount in a pod manifest would look like:

kind: Pod
apiVersion: v1
metadata:
  name: csi-inline-volume-app
  labels:
    app: test    
spec:
  containers:
    - name: my-frontend
      image: busybox
      volumeMounts:
      - mountPath: "/builds/csi-volume"
        name: csi-volume
      command: [ "sleep", "1000000" ]
  imagePullSecrets:
    - name: docker-hub-pull-secret
  volumes:
    - name: csi-volume
      csi:
        driver: pxd.portworx.com
        volumeAttributes:
          size: "2Gi"

What are the relevant issue numbers?

#27618 (closed)

Edited by Brandon Butler

Merge request reports