From 66306e2428dcc1b8353dc288d3623c57ea8d8fff Mon Sep 17 00:00:00 2001 From: Adrian Cowan Date: Sun, 4 May 2025 17:35:35 +1000 Subject: [PATCH] Change from nomad_volume to nomad_csi_volume_registration as the later is deprecated --- 2-nomad-config/services.tf | 8 +- 2-nomad-config/terraform.tfstate | 148 ++++++++++++------------ 2-nomad-config/terraform.tfstate.backup | 146 +++++++++++------------ 2-nomad-config/transfer.nomad.hcl | 6 +- 4 files changed, 158 insertions(+), 150 deletions(-) diff --git a/2-nomad-config/services.tf b/2-nomad-config/services.tf index b08c427..4a8f0b7 100644 --- a/2-nomad-config/services.tf +++ b/2-nomad-config/services.tf @@ -32,11 +32,12 @@ data "nomad_plugin" "smb" { wait_for_healthy = true } -resource "nomad_volume" "unraid_transfer" { +resource "nomad_csi_volume_registration" "unraid_transfer" { + #Note: Before chaning the definition of this volume you need to stop the jobs that are using it depends_on = [data.nomad_plugin.smb] plugin_id = "smb" - type = "csi" - volume_id = "unraid_transfer_id5" + + volume_id = "unraid_transfer" name = "unraid_transfer_name" external_id = "unraid_transfer_ext" @@ -51,7 +52,6 @@ resource "nomad_volume" "unraid_transfer" { } parameters = { - source = "//192.168.1.192/transfer" "csi.storage.k8s.io/node-stage-secret-name" = "smbcreds" "csi.storage.k8s.io/node-stage-secret-namespace" = "default" } diff --git a/2-nomad-config/terraform.tfstate b/2-nomad-config/terraform.tfstate index 96b1d82..c4355ae 100644 --- a/2-nomad-config/terraform.tfstate +++ b/2-nomad-config/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.11.4", - "serial": 514, + "serial": 555, "lineage": "15e0900c-88bc-9754-4600-e3977d018ba0", "outputs": {}, "resources": [ @@ -37,6 +37,72 @@ } ] }, + { + "mode": "managed", + "type": "nomad_csi_volume_registration", + "name": "unraid_transfer", + "provider": "provider[\"registry.terraform.io/hashicorp/nomad\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "capability": [ + { + "access_mode": "single-node-writer", + "attachment_mode": "file-system" + } + ], + "capacity": 0, + "capacity_max": null, + "capacity_max_bytes": 0, + "capacity_min": null, + "capacity_min_bytes": 0, + "context": { + "source": "//192.168.1.192/transfer" + }, + "controller_required": false, + "controllers_expected": 0, + "controllers_healthy": 0, + "deregister_on_destroy": true, + "external_id": "unraid_transfer_ext", + "id": "unraid_transfer", + "mount_options": [], + "name": "unraid_transfer_name", + "namespace": "default", + "nodes_expected": 1, + "nodes_healthy": 1, + "parameters": { + "csi.storage.k8s.io/node-stage-secret-name": "smbcreds", + "csi.storage.k8s.io/node-stage-secret-namespace": "default" + }, + "plugin_id": "smb", + "plugin_provider": "smb.csi.k8s.io", + "plugin_provider_version": "v1.7.0", + "schedulable": true, + "secrets": { + "password": "", + "username": "anon" + }, + "timeouts": null, + "topologies": [], + "topology_request": [], + "volume_id": "unraid_transfer" + }, + "sensitive_attributes": [ + [ + { + "type": "get_attr", + "value": "secrets" + } + ] + ], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwfX0=", + "dependencies": [ + "data.nomad_plugin.smb" + ] + } + ] + }, { "mode": "managed", "type": "nomad_job", @@ -335,7 +401,9 @@ "schema_version": 0, "attributes": { "allocation_ids": [], - "datacenters": [], + "datacenters": [ + "*" + ], "deployment_id": null, "deployment_status": null, "deregister_on_destroy": true, @@ -343,9 +411,9 @@ "detach": true, "hcl2": [], "id": "transfer", - "jobspec": "job \"transfer\" {\n group \"transfer\" {\n network {\n port \"http\" {\n to = 80\n }\n }\n\n service {\n name = \"transfer\"\n port = \"http\"\n \n tags = [\n \"traefik.enable=true\",\n \"traefik.http.routers.volume-test.middlewares=auth@file\",\n ]\n\n check {\n type = \"http\"\n path = \"/\"\n interval = \"10s\"\n timeout = \"2s\"\n }\n }\n\n volume \"unraid_transfer_use\" {\n type = \"csi\"\n read_only = false\n source = \"unraid_transfer_id5\"\n access_mode = \"single-node-writer\"\n attachment_mode = \"file-system\"\n }\n\n task \"filebrowser\" {\n driver = \"docker\"\n\n config {\n # Use the s6 tag for the linuxserver.io based image\n image = \"filebrowser/filebrowser:s6\"\n\n ports = [\"http\"]\n\n volumes = [\n \"local/config/settings.json:/config/settings.json\",\n ]\n }\n\n volume_mount {\n volume = \"unraid_transfer_use\"\n\t destination = \"/srv\"\n read_only = false\n }\n\n resources {\n cpu = 500\n memory = 256\n }\n\n template {\n data = \u003c\u003cEOF\n{\n \"port\": 80,\n \"baseURL\": \"\",\n \"address\": \"\",\n \"log\": \"stdout\",\n \"database\": \"/database/filebrowser.db\",\n \"root\": \"/srv\",\n \"auth\": {\n \"method\": \"noauth\"\n }\n}\nEOF\n\n destination = \"local/config/settings.json\"\n }\n }\n }\n}", + "jobspec": "job \"transfer\" {\n group \"transfer\" {\n network {\n port \"http\" {\n to = 80\n }\n }\n\n service {\n name = \"transfer\"\n port = \"http\"\n \n tags = [\n \"traefik.enable=true\",\n \"traefik.http.routers.volume-test.middlewares=auth@file\",\n ]\n\n check {\n type = \"http\"\n path = \"/\"\n interval = \"10s\"\n timeout = \"2s\"\n }\n }\n\n volume \"unraid_transfer\" {\n type = \"csi\"\n read_only = false\n source = \"unraid_transfer\"\n access_mode = \"single-node-writer\"\n attachment_mode = \"file-system\"\n }\n\n task \"filebrowser\" {\n driver = \"docker\"\n\n config {\n # Use the s6 tag for the linuxserver.io based image\n image = \"filebrowser/filebrowser:s6\"\n\n ports = [\"http\"]\n\n volumes = [\n \"local/config/settings.json:/config/settings.json\",\n ]\n }\n\n volume_mount {\n volume = \"unraid_transfer\"\n\t destination = \"/srv\"\n read_only = false\n }\n\n resources {\n cpu = 500\n memory = 256\n }\n\n template {\n data = \u003c\u003cEOF\n{\n \"port\": 80,\n \"baseURL\": \"\",\n \"address\": \"\",\n \"log\": \"stdout\",\n \"database\": \"/database/filebrowser.db\",\n \"root\": \"/srv\",\n \"auth\": {\n \"method\": \"noauth\"\n }\n}\nEOF\n\n destination = \"local/config/settings.json\"\n }\n }\n }\n}", "json": null, - "modify_index": "19989", + "modify_index": "20353", "name": "transfer", "namespace": "default", "policy_override": null, @@ -353,7 +421,7 @@ "read_allocation_ids": false, "region": "global", "rerun_if_dead": false, - "status": "running", + "status": "dead", "task_groups": [ { "count": 1, @@ -368,16 +436,16 @@ { "destination": "/srv", "read_only": false, - "volume": "unraid_transfer_use" + "volume": "unraid_transfer" } ] } ], "volumes": [ { - "name": "unraid_transfer_use", + "name": "unraid_transfer", "read_only": false, - "source": "unraid_transfer_id5", + "source": "unraid_transfer", "type": "csi" } ] @@ -445,70 +513,6 @@ "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=" } ] - }, - { - "mode": "managed", - "type": "nomad_volume", - "name": "unraid_transfer", - "provider": "provider[\"registry.terraform.io/hashicorp/nomad\"]", - "instances": [ - { - "schema_version": 1, - "attributes": { - "access_mode": null, - "attachment_mode": null, - "capability": [ - { - "access_mode": "single-node-writer", - "attachment_mode": "file-system" - } - ], - "context": { - "source": "//192.168.1.192/transfer" - }, - "controller_required": false, - "controllers_expected": 0, - "controllers_healthy": 0, - "deregister_on_destroy": true, - "external_id": "unraid_transfer_ext", - "id": "unraid_transfer_id5", - "mount_options": [], - "name": "unraid_transfer_name", - "namespace": "default", - "nodes_expected": 1, - "nodes_healthy": 1, - "parameters": { - "csi.storage.k8s.io/node-stage-secret-name": "smbcreds", - "csi.storage.k8s.io/node-stage-secret-namespace": "default", - "source": "//192.168.1.192/transfer" - }, - "plugin_id": "smb", - "plugin_provider": "smb.csi.k8s.io", - "plugin_provider_version": "v1.7.0", - "schedulable": true, - "secrets": { - "password": "", - "username": "anon" - }, - "topologies": [], - "topology_request": [], - "type": "csi", - "volume_id": "unraid_transfer_id5" - }, - "sensitive_attributes": [ - [ - { - "type": "get_attr", - "value": "secrets" - } - ] - ], - "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", - "dependencies": [ - "data.nomad_plugin.smb" - ] - } - ] } ], "check_results": null diff --git a/2-nomad-config/terraform.tfstate.backup b/2-nomad-config/terraform.tfstate.backup index 3e1507f..d9a390a 100644 --- a/2-nomad-config/terraform.tfstate.backup +++ b/2-nomad-config/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.11.4", - "serial": 512, + "serial": 554, "lineage": "15e0900c-88bc-9754-4600-e3977d018ba0", "outputs": {}, "resources": [ @@ -37,6 +37,72 @@ } ] }, + { + "mode": "managed", + "type": "nomad_csi_volume_registration", + "name": "unraid_transfer", + "provider": "provider[\"registry.terraform.io/hashicorp/nomad\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "capability": [ + { + "access_mode": "single-node-writer", + "attachment_mode": "file-system" + } + ], + "capacity": 0, + "capacity_max": null, + "capacity_max_bytes": 0, + "capacity_min": null, + "capacity_min_bytes": 0, + "context": { + "source": "//192.168.1.192/transfer" + }, + "controller_required": false, + "controllers_expected": 0, + "controllers_healthy": 0, + "deregister_on_destroy": true, + "external_id": "unraid_transfer_ext", + "id": "unraid_transfer", + "mount_options": [], + "name": "unraid_transfer_name", + "namespace": "default", + "nodes_expected": 1, + "nodes_healthy": 1, + "parameters": { + "csi.storage.k8s.io/node-stage-secret-name": "smbcreds", + "csi.storage.k8s.io/node-stage-secret-namespace": "default" + }, + "plugin_id": "smb", + "plugin_provider": "smb.csi.k8s.io", + "plugin_provider_version": "v1.7.0", + "schedulable": true, + "secrets": { + "password": "", + "username": "anon" + }, + "timeouts": null, + "topologies": [], + "topology_request": [], + "volume_id": "unraid_transfer" + }, + "sensitive_attributes": [ + [ + { + "type": "get_attr", + "value": "secrets" + } + ] + ], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwfX0=", + "dependencies": [ + "data.nomad_plugin.smb" + ] + } + ] + }, { "mode": "managed", "type": "nomad_job", @@ -335,7 +401,9 @@ "schema_version": 0, "attributes": { "allocation_ids": [], - "datacenters": [], + "datacenters": [ + "*" + ], "deployment_id": null, "deployment_status": null, "deregister_on_destroy": true, @@ -343,9 +411,9 @@ "detach": true, "hcl2": [], "id": "transfer", - "jobspec": "job \"transfer\" {\n group \"transfer\" {\n network {\n port \"http\" {\n to = 80\n }\n }\n\n service {\n name = \"transfer\"\n port = \"http\"\n \n tags = [\n \"traefik.enable=true\",\n \"traefik.http.routers.volume-test.middlewares=auth@file\",\n ]\n\n check {\n type = \"http\"\n path = \"/\"\n interval = \"10s\"\n timeout = \"2s\"\n }\n }\n\n volume \"unraid_transfer_use\" {\n type = \"csi\"\n read_only = false\n source = \"unraid_transfer_id5\"\n access_mode = \"single-node-writer\"\n attachment_mode = \"file-system\"\n }\n\n task \"filebrowser\" {\n driver = \"docker\"\n\n config {\n # Use the s6 tag for the linuxserver.io based image\n image = \"filebrowser/filebrowser:s6\"\n\n ports = [\"http\"]\n\n volumes = [\n \"local/config/settings.json:/config/settings.json\",\n ]\n }\n\n volume_mount {\n volume = \"unraid_transfer_use\"\n\t destination = \"/srv\"\n read_only = false\n }\n\n resources {\n cpu = 500\n memory = 256\n }\n\n template {\n data = \u003c\u003cEOF\n{\n \"port\": 80,\n \"baseURL\": \"\",\n \"address\": \"\",\n \"log\": \"stdout\",\n \"database\": \"/database/filebrowser.db\",\n \"root\": \"/srv\",\n \"auth\": {\n \"method\": \"noauth\",\n \"header\": \"X-Forwarded-User\"\n }\n}\nEOF\n\n destination = \"local/config/settings.json\"\n }\n }\n }\n}", + "jobspec": "job \"transfer\" {\n group \"transfer\" {\n network {\n port \"http\" {\n to = 80\n }\n }\n\n service {\n name = \"transfer\"\n port = \"http\"\n \n tags = [\n \"traefik.enable=true\",\n \"traefik.http.routers.volume-test.middlewares=auth@file\",\n ]\n\n check {\n type = \"http\"\n path = \"/\"\n interval = \"10s\"\n timeout = \"2s\"\n }\n }\n\n volume \"unraid_transfer\" {\n type = \"csi\"\n read_only = false\n source = \"unraid_transfer\"\n access_mode = \"single-node-writer\"\n attachment_mode = \"file-system\"\n }\n\n task \"filebrowser\" {\n driver = \"docker\"\n\n config {\n # Use the s6 tag for the linuxserver.io based image\n image = \"filebrowser/filebrowser:s6\"\n\n ports = [\"http\"]\n\n volumes = [\n \"local/config/settings.json:/config/settings.json\",\n ]\n }\n\n volume_mount {\n volume = \"unraid_transfer\"\n\t destination = \"/srv\"\n read_only = false\n }\n\n resources {\n cpu = 500\n memory = 256\n }\n\n template {\n data = \u003c\u003cEOF\n{\n \"port\": 80,\n \"baseURL\": \"\",\n \"address\": \"\",\n \"log\": \"stdout\",\n \"database\": \"/database/filebrowser.db\",\n \"root\": \"/srv\",\n \"auth\": {\n \"method\": \"noauth\"\n }\n}\nEOF\n\n destination = \"local/config/settings.json\"\n }\n }\n }\n}", "json": null, - "modify_index": "19963", + "modify_index": "20342", "name": "transfer", "namespace": "default", "policy_override": null, @@ -368,16 +436,16 @@ { "destination": "/srv", "read_only": false, - "volume": "unraid_transfer_use" + "volume": "unraid_transfer" } ] } ], "volumes": [ { - "name": "unraid_transfer_use", + "name": "unraid_transfer", "read_only": false, - "source": "unraid_transfer_id5", + "source": "unraid_transfer", "type": "csi" } ] @@ -445,70 +513,6 @@ "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=" } ] - }, - { - "mode": "managed", - "type": "nomad_volume", - "name": "unraid_transfer", - "provider": "provider[\"registry.terraform.io/hashicorp/nomad\"]", - "instances": [ - { - "schema_version": 1, - "attributes": { - "access_mode": null, - "attachment_mode": null, - "capability": [ - { - "access_mode": "single-node-writer", - "attachment_mode": "file-system" - } - ], - "context": { - "source": "//192.168.1.192/transfer" - }, - "controller_required": false, - "controllers_expected": 0, - "controllers_healthy": 0, - "deregister_on_destroy": true, - "external_id": "unraid_transfer_ext", - "id": "unraid_transfer_id5", - "mount_options": [], - "name": "unraid_transfer_name", - "namespace": "default", - "nodes_expected": 1, - "nodes_healthy": 1, - "parameters": { - "csi.storage.k8s.io/node-stage-secret-name": "smbcreds", - "csi.storage.k8s.io/node-stage-secret-namespace": "default", - "source": "//192.168.1.192/transfer" - }, - "plugin_id": "smb", - "plugin_provider": "smb.csi.k8s.io", - "plugin_provider_version": "v1.7.0", - "schedulable": true, - "secrets": { - "password": "", - "username": "anon" - }, - "topologies": [], - "topology_request": [], - "type": "csi", - "volume_id": "unraid_transfer_id5" - }, - "sensitive_attributes": [ - [ - { - "type": "get_attr", - "value": "secrets" - } - ] - ], - "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", - "dependencies": [ - "data.nomad_plugin.smb" - ] - } - ] } ], "check_results": null diff --git a/2-nomad-config/transfer.nomad.hcl b/2-nomad-config/transfer.nomad.hcl index 805496b..f2d9a11 100644 --- a/2-nomad-config/transfer.nomad.hcl +++ b/2-nomad-config/transfer.nomad.hcl @@ -23,10 +23,10 @@ job "transfer" { } } - volume "unraid_transfer_use" { + volume "unraid_transfer" { type = "csi" read_only = false - source = "unraid_transfer_id5" + source = "unraid_transfer" access_mode = "single-node-writer" attachment_mode = "file-system" } @@ -46,7 +46,7 @@ job "transfer" { } volume_mount { - volume = "unraid_transfer_use" + volume = "unraid_transfer" destination = "/srv" read_only = false }