linode / linode-blockstorage-csi-driver

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

Implement ListVolumes #144

Closed avestuk closed 10 months ago

avestuk commented 11 months ago

General:

Pull Request Guidelines:

  1. [x] 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. [x] Have you linked your PR to an open issue

Advertises the capability for Controller ListVolumes which resolves #59 . Allows us to run the external-health-monitor and get volume health stats for our PVCs.

The PR also consolidates the places where our driver capabilities are set as I spent far too much time wondering why the change in ae2665ea54 wasn't being advertised. Furthermore, this meant that we weren't actually advertising the ability to mount

Testing

Testing this feature requires running the external-health-monitor. I chose to run it as part of the linode controller but we can run it as a separate deployment using leader election.

  1. Update the deploy/kubernetes/base/ss-csi-linode-controller.yaml with the following extra container and set the csi-driver to my image. The deploy/kubernetes/base/ds-csi-linode-node.yaml should also have it's plugin image update.
    - name: external-health-monitor
    image: registry.k8s.io/sig-storage/csi-external-health-monitor-controller:v0.10.0
    args:
      - "-v=5"
      - "-csi-address=$(ADDRESS)"
      - "-enable-node-watcher=true"
      - "-http-endpoint=:8080"
      - "-metrics-path=/metrics"
    env:
      - name: ADDRESS
        value: /var/lib/csi/sockets/pluginproxy/csi.sock
    volumeMounts:
    - name: socket-dir
      mountPath: /var/lib/csi/sockets/pluginproxy/
    ports:
      - containerPort: 8080
        name: metrics
    - name: linode-csi-plugin
    image: ghcr.io/avestuk/linode-blockstorage-csi-driver:v0.6.0-20-gc06d64a-dirty
  2. Create a PVC and consume it from a Pod - check that the external health monitor logs reflect volume creation
  3. Update the kubelet config to enable the CSIVolumeHealth feature gate
  4. Check the node metrics data and see that volumeHealthStatus is now being reported. kubectl get --raw "/api/v1/nodes/lke145862-214328-13bc36d60000/proxy/stats/summary"
    {
     "time": "2023-12-11T14:25:42Z",
     "availableBytes": 10445123584,
     "capacityBytes": 10464022528,
     "usedBytes": 2121728,
     "inodesFree": 655348,
     "inodes": 655360,
     "inodesUsed": 12,
     "name": "csi-example-volume",
     "pvcRef": {
      "name": "csi-example-pvc",
      "namespace": "kube-system"
     },
     "volumeHealthStats": {
      "abnormal": false
     }
    }
srust commented 11 months ago

Deal 😀