From 90ff2f248097a187e6e6f2bfd3cdac71cee460c7 Mon Sep 17 00:00:00 2001 From: Henrik Jess Nielsen Date: Tue, 26 May 2026 23:22:55 +0200 Subject: [PATCH] =?UTF-8?q?Initial=20CSI=20setup=20=E2=80=94=20democratic-?= =?UTF-8?q?csi=20+=20NFS=20on=20int?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - controller.nomad: CSI controller pinned to int - node.nomad: CSI node plugin (int only for now, expand later) - volumes/example.hcl: template for creating new volumes NFS: int exports /opt/csi-volumes to 192.168.15.0/24 Plugin ID: org.democratic-csi.nfs --- README.md | 55 ++++++++++++++++++++++++++++++++ csi/controller.nomad | 69 +++++++++++++++++++++++++++++++++++++++++ csi/node.nomad | 69 +++++++++++++++++++++++++++++++++++++++++ csi/volumes/example.hcl | 14 +++++++++ 4 files changed, 207 insertions(+) create mode 100644 README.md create mode 100644 csi/controller.nomad create mode 100644 csi/node.nomad create mode 100644 csi/volumes/example.hcl diff --git a/README.md b/README.md new file mode 100644 index 0000000..68a2441 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# nomad-csi + +Nomad CSI storage for i80.dk — democratic-csi + NFS on int.i80.dk. + +## Architecture + +- **NFS server**: `int.i80.dk` exports `/opt/csi-volumes` to 192.168.15.0/24 +- **CSI driver**: [democratic-csi](https://github.com/democratic-csi/democratic-csi) v1.9.0 +- **Plugin ID**: `org.democratic-csi.nfs` + +## Deploy + +```bash +# One-time: deploy CSI controller + node plugin +nomad job run csi/controller.nomad +nomad job run csi/node.nomad + +# Verify +nomad plugin status org.democratic-csi.nfs +``` + +## Create a volume + +```bash +# Edit csi/volumes/example.hcl with your id/name/size, then: +nomad volume create csi/volumes/my-volume.hcl + +# Volumes are persistent — only deleted explicitly: +nomad volume delete my-volume-id +``` + +## Use in a job + +```hcl +volume "data" { + type = "csi" + source = "my-volume-id" + access_mode = "single-node-writer" + attachment_mode = "file-system" +} + +# ...in the task: +volume_mount { + volume = "data" + destination = "/data" +} +``` + +## Expanding to all workers + +When ready, update `csi/node.nomad`: +- Change `type = "service"` → `type = "system"` +- Remove the `constraint` block + +Workers need `nfs-common` installed (via Ansible `storage.yml` playbook). diff --git a/csi/controller.nomad b/csi/controller.nomad new file mode 100644 index 0000000..af4a114 --- /dev/null +++ b/csi/controller.nomad @@ -0,0 +1,69 @@ +job "csi-nfs-controller" { + datacenters = ["dc1"] + type = "service" + namespace = "default" + + # Pin controller to int — NFS server lives here + constraint { + attribute = "${node.unique.name}" + value = "int" + } + + group "controller" { + count = 1 + + task "plugin" { + driver = "docker" + + config { + image = "democraticcsi/democratic-csi:latest" + command = "/bin/democratic-csi" + args = [ + "--csi-version=1.5.0", + "--csi-name=org.democratic-csi.nfs", + "--driver-config-file=${NOMAD_TASK_DIR}/driver-config-file.yaml", + "--log-level=info", + "--csi-mode=controller", + "--server-socket=${CSI_ENDPOINT}", + ] + + volumes = [ + "/opt/csi-volumes:/opt/csi-volumes", + ] + + privileged = true + } + + csi_plugin { + id = "org.democratic-csi.nfs" + type = "controller" + mount_dir = "/csi" + } + + template { + data = <