Change from nomad_volume to nomad_csi_volume_registration

as the later is deprecated
This commit is contained in:
2025-05-04 17:35:35 +10:00
parent 1df01e6c76
commit 66306e2428
4 changed files with 158 additions and 150 deletions

View File

@@ -32,11 +32,12 @@ data "nomad_plugin" "smb" {
wait_for_healthy = true 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] depends_on = [data.nomad_plugin.smb]
plugin_id = "smb" plugin_id = "smb"
type = "csi"
volume_id = "unraid_transfer_id5" volume_id = "unraid_transfer"
name = "unraid_transfer_name" name = "unraid_transfer_name"
external_id = "unraid_transfer_ext" external_id = "unraid_transfer_ext"
@@ -51,7 +52,6 @@ resource "nomad_volume" "unraid_transfer" {
} }
parameters = { parameters = {
source = "//192.168.1.192/transfer"
"csi.storage.k8s.io/node-stage-secret-name" = "smbcreds" "csi.storage.k8s.io/node-stage-secret-name" = "smbcreds"
"csi.storage.k8s.io/node-stage-secret-namespace" = "default" "csi.storage.k8s.io/node-stage-secret-namespace" = "default"
} }

View File

@@ -1,7 +1,7 @@
{ {
"version": 4, "version": 4,
"terraform_version": "1.11.4", "terraform_version": "1.11.4",
"serial": 514, "serial": 555,
"lineage": "15e0900c-88bc-9754-4600-e3977d018ba0", "lineage": "15e0900c-88bc-9754-4600-e3977d018ba0",
"outputs": {}, "outputs": {},
"resources": [ "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", "mode": "managed",
"type": "nomad_job", "type": "nomad_job",
@@ -335,7 +401,9 @@
"schema_version": 0, "schema_version": 0,
"attributes": { "attributes": {
"allocation_ids": [], "allocation_ids": [],
"datacenters": [], "datacenters": [
"*"
],
"deployment_id": null, "deployment_id": null,
"deployment_status": null, "deployment_status": null,
"deregister_on_destroy": true, "deregister_on_destroy": true,
@@ -343,9 +411,9 @@
"detach": true, "detach": true,
"hcl2": [], "hcl2": [],
"id": "transfer", "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, "json": null,
"modify_index": "19989", "modify_index": "20353",
"name": "transfer", "name": "transfer",
"namespace": "default", "namespace": "default",
"policy_override": null, "policy_override": null,
@@ -353,7 +421,7 @@
"read_allocation_ids": false, "read_allocation_ids": false,
"region": "global", "region": "global",
"rerun_if_dead": false, "rerun_if_dead": false,
"status": "running", "status": "dead",
"task_groups": [ "task_groups": [
{ {
"count": 1, "count": 1,
@@ -368,16 +436,16 @@
{ {
"destination": "/srv", "destination": "/srv",
"read_only": false, "read_only": false,
"volume": "unraid_transfer_use" "volume": "unraid_transfer"
} }
] ]
} }
], ],
"volumes": [ "volumes": [
{ {
"name": "unraid_transfer_use", "name": "unraid_transfer",
"read_only": false, "read_only": false,
"source": "unraid_transfer_id5", "source": "unraid_transfer",
"type": "csi" "type": "csi"
} }
] ]
@@ -445,70 +513,6 @@
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=" "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 "check_results": null

View File

@@ -1,7 +1,7 @@
{ {
"version": 4, "version": 4,
"terraform_version": "1.11.4", "terraform_version": "1.11.4",
"serial": 512, "serial": 554,
"lineage": "15e0900c-88bc-9754-4600-e3977d018ba0", "lineage": "15e0900c-88bc-9754-4600-e3977d018ba0",
"outputs": {}, "outputs": {},
"resources": [ "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", "mode": "managed",
"type": "nomad_job", "type": "nomad_job",
@@ -335,7 +401,9 @@
"schema_version": 0, "schema_version": 0,
"attributes": { "attributes": {
"allocation_ids": [], "allocation_ids": [],
"datacenters": [], "datacenters": [
"*"
],
"deployment_id": null, "deployment_id": null,
"deployment_status": null, "deployment_status": null,
"deregister_on_destroy": true, "deregister_on_destroy": true,
@@ -343,9 +411,9 @@
"detach": true, "detach": true,
"hcl2": [], "hcl2": [],
"id": "transfer", "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, "json": null,
"modify_index": "19963", "modify_index": "20342",
"name": "transfer", "name": "transfer",
"namespace": "default", "namespace": "default",
"policy_override": null, "policy_override": null,
@@ -368,16 +436,16 @@
{ {
"destination": "/srv", "destination": "/srv",
"read_only": false, "read_only": false,
"volume": "unraid_transfer_use" "volume": "unraid_transfer"
} }
] ]
} }
], ],
"volumes": [ "volumes": [
{ {
"name": "unraid_transfer_use", "name": "unraid_transfer",
"read_only": false, "read_only": false,
"source": "unraid_transfer_id5", "source": "unraid_transfer",
"type": "csi" "type": "csi"
} }
] ]
@@ -445,70 +513,6 @@
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=" "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 "check_results": null

View File

@@ -23,10 +23,10 @@ job "transfer" {
} }
} }
volume "unraid_transfer_use" { volume "unraid_transfer" {
type = "csi" type = "csi"
read_only = false read_only = false
source = "unraid_transfer_id5" source = "unraid_transfer"
access_mode = "single-node-writer" access_mode = "single-node-writer"
attachment_mode = "file-system" attachment_mode = "file-system"
} }
@@ -46,7 +46,7 @@ job "transfer" {
} }
volume_mount { volume_mount {
volume = "unraid_transfer_use" volume = "unraid_transfer"
destination = "/srv" destination = "/srv"
read_only = false read_only = false
} }