commit 569a859b57e2b1540c76e7dbf649116b36fe7c32
parent 5cfaf38aa335ccebf1a22997a73595210ebd8dd7
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Fri, 17 Oct 2025 22:03:52 +0200
feat(nfs): add rocketduck csi
Diffstat:
3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/hcl/infra/nfs/README b/hcl/infra/nfs/README
@@ -3,7 +3,8 @@ NFS CSI DRIVER
 
 Run stateful workloads with the NFS CSI driver:
 - https://learn.hashicorp.com/tutorials/nomad/stateful-workloads-csi-volumes
-- https://github.com/kubernetes-csi/csi-driver-nfs
+- https://gitlab.com/rocketduck/csi-plugin-nfs
+- https://discuss.hashicorp.com/t/nfs-on-nomad-the-modern-way/61223/4
 
 ON NOMAD
 --------
@@ -29,7 +30,7 @@ Spin up a Docker development NFS server (see "docker-compose.yaml"):
 
 $ docker-compose up -d
 
-Create the export:
+Create the export (no longer strictly necessary with rocketduck):
 $ docker exec nfs mkdir /data/csi-test
 
 If external NFS server (not the docker-compose example here), don't forget to:
diff --git a/hcl/infra/nfs/plugin-nfs-controller.nomad b/hcl/infra/nfs/plugin-nfs-controller.nomad
@@ -1,3 +1,5 @@
+# https://gitlab.com/rocketduck/csi-plugin-nfs/-/blob/main/nomad/controller.nomad
+
 variable "affinity_node" {
   type        = string
   default     = "na"
@@ -19,15 +21,19 @@ job "plugin-nfs-controller" {
       driver = "podman"
 
       config {
-        image = "mcr.microsoft.com/k8s/csi/nfs-csi:latest"
+        image = "registry.gitlab.com/rocketduck/csi-plugin-nfs:1.1.0"
         force_pull = true
 
         args = [
-          "--v=5",
+          "--type=controller",
           "--nodeid=${attr.unique.hostname}",
-          "--endpoint=unix:///csi/csi.sock",
-          "--drivername=nfs.csi.k8s.io"
+          "--nfs-server=turris.lan:/srv/nfs",
+          "--mount-options=defaults",
         ]
+
+        # required so the mount works even after stopping the container
+        network_mode = "host"
+        #privileged = true
       }
 
       csi_plugin {
diff --git a/hcl/infra/nfs/plugin-nfs-nodes.nomad b/hcl/infra/nfs/plugin-nfs-nodes.nomad
@@ -1,3 +1,5 @@
+# https://gitlab.com/rocketduck/csi-plugin-nfs/-/blob/main/nomad/node.nomad
+
 job "plugin-nfs-nodes" {
   datacenters = ["dc1"]
 
@@ -12,16 +14,19 @@ job "plugin-nfs-nodes" {
       driver = "podman"
 
       config {
-        image = "mcr.microsoft.com/k8s/csi/nfs-csi:latest"
+        image = "registry.gitlab.com/rocketduck/csi-plugin-nfs:1.1.0"
         force_pull = true
 
         args = [
-          "--v=5",
+          "--type=node",
           "--nodeid=${attr.unique.hostname}",
-          "--endpoint=unix:///csi/csi.sock",
-          "--drivername=nfs.csi.k8s.io"
+          "--nfs-server=turris.lan:/srv/nfs",
+          "--mount-options=defaults",
         ]
 
+        # required so the mount works even after stopping the container
+        network_mode = "host"
+
         # node plugins must run as privileged jobs because they
         # mount disks to the host
         privileged = true