commit 90ff2f248097a187e6e6f2bfd3cdac71cee460c7 Author: Henrik Jess Nielsen Date: Tue May 26 23:22:55 2026 +0200 Initial CSI setup — democratic-csi + NFS on int - 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 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 = <