linode / linode-blockstorage-csi-driver

Container Storage Interface (CSI) Driver for Linode Block Storage
Apache License 2.0
64 stars 54 forks source link

add xfsprogs to add mkfs.xfs binary to csi-linode-node pod #199

Closed rahulait closed 3 weeks ago

rahulait commented 4 weeks ago

General:

There was a long standing request to support xfs filesystem within PVCs provisioned by linode-csi-driver: https://www.linode.com/community/questions/20316/create-a-persistentvolume-on-lke-with-a-different-fstype

One of the dependencies were resolved recently which added volumemode=block support: https://github.com/linode/linode-blockstorage-csi-driver/pull/126

However, when provisioning pvcs with fstype as xfs, it was still failing as the mkfs.xfs binary was missing from the pods.

This PR adds this binary so that one can provision PVCs with filesystem of type xfs. Here is the output from csi-linode-plugin container of csi-linode-node pod before and after adding the binary.

Before:

/ # ls /sbin/mkfs*
/sbin/mkfs.ext2  /sbin/mkfs.ext3  /sbin/mkfs.ext4  /sbin/mkfs.vfat

After:

/ # ls /sbin/mkfs*
/sbin/mkfs.ext2  /sbin/mkfs.ext3  /sbin/mkfs.ext4  /sbin/mkfs.vfat  /sbin/mkfs.xfs

Here is a sample yaml one can use to test it out with this branch:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: linode-block-storage-retain-xfs
parameters:
    fstype: xfs
provisioner: linodebs.csi.linode.com
reclaimPolicy: Retain
volumeBindingMode: Immediate
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: csi-example-pod
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: csi-example-pod
  replicas: 1
  template:
    metadata:
      labels:
        app: csi-example-pod
    spec:
      containers:
      - name: csi-example-pod
        image: busybox
        volumeMounts:
        - mountPath: "/data"
          name: csi-example-volume
        command: [ "sleep", "1000000" ]
      volumes:
      - name: csi-example-volume
        persistentVolumeClaim:
          claimName: csi-example-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: csi-example-pvc
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: linode-block-storage-retain-xfs

Pull Request Guidelines:

  1. [ ] Does your submission pass tests?
  2. [x] Have you added tests?
  3. [x] Are you addressing a single feature in this PR?
  4. [x] Are your commits atomic, addressing one change per commit?
  5. [x] Are you following the conventions of the language?
  6. [x] Have you saved your large formatting changes for a different PR, so we can focus on your work?
  7. [x] Have you explained your rationale for why this feature is needed?
  8. [ ] Have you linked your PR to an open issue
codecov[bot] commented 4 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 36.40%. Comparing base (e5a7c33) to head (d760709). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #199 +/- ## ======================================= Coverage 36.40% 36.40% ======================================= Files 22 22 Lines 1596 1596 ======================================= Hits 581 581 Misses 981 981 Partials 34 34 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.