Skip to content

How to Build a Custom Dell CSI Driver

With all the Dell Container Storage Interface (CSI) drivers and dependencies being open-source, anyone can tweak them to fit a specific use case. This post shows how to create a patched version of a Dell CSI Driver for PowerScale.


The Premise

As a practical example, the following steps show how to create a patched version of the Dell CSI Driver for PowerScale that supports a longer mounted path.

The CSI Specification defines that a driver must accept a max path of 128 bytes minimum :

// SP SHOULD support the maximum path length allowed by the operating
// system/filesystem, but, at a minimum, SP MUST accept a max path
// length of at least 128 bytes.

Dell drivers use the gocsi library as a common boilerplate for CSI development. That library enforces the 128-byte maximum path length .

The PowerScale hardware supports path lengths up to 1023 characters, as described in the File system guidelines chapter of the PowerScale spec . We will build a csi-powerscale driver that supports that maximum length.


Steps to Patch a Driver

Dependencies

The Dell CSI drivers are built with Go and run as containers. Prerequisites :

  • Go (v1.16 minimum at time of publication)
  • Podman or Docker
  • Optionally make to run the Makefile

Clone, Branch, and Patch

Clone the official csi-powerscale repository :

cd $GOPATH/src/github.com/
git clone [email protected]:dell/csi-powerscale.git dell/csi-powerscale
cd dell/csi-powerscale

Pick the version to patch (git tag lists versions). In this example, v2.1.0 :

git checkout v2.1.0 -b v2.1.0-longer-path

Fork the gocsi library to your GitHub :

Fork gocsi repository

Forking the gocsi repository on GitHub.

Clone your fork and add upstream :

cd $GOPATH/src/github.com/
git clone [email protected]:coulof/gocsi.git coulof/gocsi
cd coulof/gocsi
git remote add upstream [email protected]:dell/gocsi.git

Check the gocsi version used by the driver and branch it :

grep gocsi $GOPATH/src/github.com/dell/csi-powerscale/go.mod
git checkout v1.5.0 -b v1.5.0-longer-path

The patch is a one-liner :

--- a/middleware/specvalidator/spec_validator.go
+++ b/middleware/specvalidator/spec_validator.go
@@ -770,7 +770,7 @@ func validateVolumeCapabilitiesArg(
 }

 const (
-       maxFieldString = 128
+       maxFieldString = 1023
        maxFieldMap    = 4096
        maxFieldNodeId = 256
 )

Commit, push, and tag :

git commit -a -m 'increase path limit'
git push --set-upstream origin v1.5.0-longer-path
git tag -a v1.5.0-longer-path
git push --tags

Build

Back in the csi-powerscale repo, use the replace directive in go.mod to point to the patched library :

 replace (
+       github.com/dell/gocsi => github.com/coulof/gocsi v1.5.0-longer-path
        k8s.io/api => k8s.io/api v0.20.2

Download the new module and build :

go mod download
make build

Local testing

For local-only testing, point the replace directive to a local directory :

replace github.com/dell/gocsi => ../../coulof/gocsi

Build the container image. The quickest path is to overlay the binary on the official image :

FROM dellemc/csi-isilon:v2.1.0
COPY "csi-isilon" .
docker build -t coulof/csi-isilon:v2.1.0-long-path -f Dockerfile.patch .

Or rebuild entirely using the provided Makefile :

BASEIMAGE=registry.fedoraproject.org/fedora-minimal:latest \
  REGISTRY=docker.io \
  IMAGENAME=coulof/csi-powerscale \
  IMAGETAG=v2.1.0-long-path \
  make podman-build

Push to your registry :

docker push coulof/csi-isilon:v2.1.0-long-path

Update CSI Kubernetes Deployment

The last step is to replace the driver image. Depending on your deployment method :

Helm :

images:
  driver: docker.io/coulof/csi-powerscale:v2.1.0-long-path

Then helm upgrade as described in the documentation .

CSM Operator :

apiVersion: storage.dell.com/v1
kind: CSIIsilon
metadata:
  name: isilon
spec:
  driver:
    common:
      image: "docker.io/coulof/csi-powerscale:v2.1.0-long-path"

Quick test with kubectl patch :

# patch_csi-isilon_controller_image.yaml
spec:
  template:
    spec:
      containers:
        - name: driver
          image: docker.io/coulof/csi-powerscale:v2.1.0-long-path
kubectl patch deployment -n powerscale isilon-controller \
  --patch-file patch_csi-isilon_controller_image.yaml

Verify :

kubectl get pods -n powerscale
kubectl logs -n powerscale -l app=isilon-controller -c driver

Wrap-up and Disclaimer

Thanks to open source, it is easy to fix and improve Dell CSI drivers or Dell Container Storage Modules .

Support disclaimer

Dell officially supports the published image and binary (through tickets, Service Requests, etc.), but not custom builds.

Sources