mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-21 15:54:21 +01:00
Switch to democratic CSI driver
Signed-off-by: main <magic_rb@redalder.org>
This commit is contained in:
parent
cd88bccac1
commit
766e15b326
|
@ -6,7 +6,7 @@ variable "datacenters" {
|
||||||
type = list(string)
|
type = list(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
job "nfs-controller" {
|
job "democratic-csi-nfs-controller" {
|
||||||
datacenters = var.datacenters
|
datacenters = var.datacenters
|
||||||
region = var.region
|
region = var.region
|
||||||
|
|
||||||
|
@ -15,23 +15,37 @@ job "nfs-controller" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "mcr.microsoft.com/k8s/csi/nfs-csi:latest"
|
image = "docker.io/democraticcsi/democratic-csi:latest"
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--endpoint=unix://csi/csi.sock",
|
"--csi-version=1.5.0",
|
||||||
"-v=5",
|
# must match the csi_plugin.id attribute below
|
||||||
]
|
"--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/csi.sock",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
destination = "${NOMAD_TASK_DIR}/driver-config-file.yaml"
|
||||||
|
|
||||||
|
data = <<EOH
|
||||||
|
driver: node-manual
|
||||||
|
EOH
|
||||||
}
|
}
|
||||||
|
|
||||||
csi_plugin {
|
csi_plugin {
|
||||||
id = "nfs"
|
# must match --csi-name arg
|
||||||
type = "controller"
|
id = "org.democratic-csi.nfs"
|
||||||
mount_dir = "/csi"
|
type = "controller"
|
||||||
|
mount_dir = "/csi"
|
||||||
}
|
}
|
||||||
|
|
||||||
resources {
|
resources {
|
||||||
cpu = 250
|
cpu = 500
|
||||||
memory = 128
|
memory = 256
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ variable "datacenters" {
|
||||||
type = list(string)
|
type = list(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
job "nfs-node" {
|
job "democratic-csi-nfs-node" {
|
||||||
datacenters = var.datacenters
|
datacenters = var.datacenters
|
||||||
region = var.region
|
region = var.region
|
||||||
|
|
||||||
|
@ -16,28 +16,48 @@ job "nfs-node" {
|
||||||
task "plugin" {
|
task "plugin" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
env {
|
||||||
image = "mcr.microsoft.com/k8s/csi/nfs-csi:latest"
|
CSI_NODE_ID = "${attr.unique.hostname}"
|
||||||
|
}
|
||||||
|
|
||||||
args = [
|
config {
|
||||||
"--v=5",
|
image = "docker.io/democraticcsi/democratic-csi:latest"
|
||||||
"--nodeid=${attr.unique.hostname}",
|
|
||||||
"--endpoint=unix:///csi/csi.sock",
|
args = [
|
||||||
"--drivername=nfs.csi.k8s.io"
|
"--csi-version=1.5.0",
|
||||||
|
# must match the csi_plugin.id attribute below
|
||||||
|
"--csi-name=org.democratic-csi.nfs",
|
||||||
|
"--driver-config-file=${NOMAD_TASK_DIR}/driver-config-file.yaml",
|
||||||
|
"--log-level=info",
|
||||||
|
"--csi-mode=node",
|
||||||
|
"--server-socket=/csi/csi.sock",
|
||||||
]
|
]
|
||||||
|
|
||||||
privileged = true
|
# node plugins must run as privileged jobs because they
|
||||||
|
# mount disks to the host
|
||||||
|
privileged = true
|
||||||
|
ipc_mode = "host"
|
||||||
|
network_mode = "host"
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
destination = "${NOMAD_TASK_DIR}/driver-config-file.yaml"
|
||||||
|
|
||||||
|
data = <<EOH
|
||||||
|
driver: node-manual
|
||||||
|
EOH
|
||||||
}
|
}
|
||||||
|
|
||||||
csi_plugin {
|
csi_plugin {
|
||||||
id = "nfs"
|
# must match --csi-name arg
|
||||||
type = "node"
|
id = "org.democratic-csi.nfs"
|
||||||
mount_dir = "/csi"
|
type = "node"
|
||||||
|
mount_dir = "/csi"
|
||||||
}
|
}
|
||||||
|
|
||||||
resources {
|
resources {
|
||||||
cpu = 250
|
cpu = 500
|
||||||
memory = 128
|
memory = 256
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ data "local_file" "ingress-upstreams" {
|
||||||
|
|
||||||
resource "nomad_volume" "ingress-letsencrypt" {
|
resource "nomad_volume" "ingress-letsencrypt" {
|
||||||
type = "csi"
|
type = "csi"
|
||||||
plugin_id = "nfs"
|
plugin_id = "org.democratic-csi.nfs"
|
||||||
volume_id = "ingress-letsencrypt"
|
volume_id = "ingress-letsencrypt"
|
||||||
name = "ingress-letsencrypt"
|
name = "ingress-letsencrypt"
|
||||||
external_id = "ingress-letsencrypt"
|
external_id = "ingress-letsencrypt"
|
||||||
|
@ -17,6 +17,8 @@ resource "nomad_volume" "ingress-letsencrypt" {
|
||||||
context = {
|
context = {
|
||||||
server = "10.64.2.1"
|
server = "10.64.2.1"
|
||||||
share = "/var/nfs/ingress-letsencrypt"
|
share = "/var/nfs/ingress-letsencrypt"
|
||||||
|
node_attach_driver = "nfs"
|
||||||
|
provisioner_driver = "node-manual"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_options {
|
mount_options {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
resource "nomad_volume" "home-assistant_hass" {
|
resource "nomad_volume" "home-assistant_hass" {
|
||||||
type = "csi"
|
type = "csi"
|
||||||
plugin_id = "nfs"
|
plugin_id = "org.democratic-csi.nfs"
|
||||||
volume_id = "home-assistant_hass"
|
volume_id = "home-assistant_hass"
|
||||||
name = "home-assistant_hass"
|
name = "home-assistant_hass"
|
||||||
external_id = "home-assistant_hass"
|
external_id = "home-assistant_hass"
|
||||||
|
@ -13,17 +13,19 @@ resource "nomad_volume" "home-assistant_hass" {
|
||||||
context = {
|
context = {
|
||||||
server = "blowhole.hosts.in.redalder.org"
|
server = "blowhole.hosts.in.redalder.org"
|
||||||
share = "/var/nfs/home-assistant_hass"
|
share = "/var/nfs/home-assistant_hass"
|
||||||
|
node_attach_driver = "nfs"
|
||||||
|
provisioner_driver = "node-manual"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_options {
|
mount_options {
|
||||||
fs_type = "nfs"
|
fs_type = "nfs"
|
||||||
mount_flags = [ "nolock", "hard" ]
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "nomad_volume" "home-assistant_zigbee2mqtt" {
|
resource "nomad_volume" "home-assistant_zigbee2mqtt" {
|
||||||
type = "csi"
|
type = "csi"
|
||||||
plugin_id = "nfs"
|
plugin_id = "org.democratic-csi.nfs"
|
||||||
volume_id = "home-assistant_zigbee2mqtt"
|
volume_id = "home-assistant_zigbee2mqtt"
|
||||||
name = "home-assistant_zigbee2mqtt"
|
name = "home-assistant_zigbee2mqtt"
|
||||||
external_id = "home-assistant_zigbee2mqtt"
|
external_id = "home-assistant_zigbee2mqtt"
|
||||||
|
@ -36,17 +38,19 @@ resource "nomad_volume" "home-assistant_zigbee2mqtt" {
|
||||||
context = {
|
context = {
|
||||||
server = "blowhole.hosts.in.redalder.org"
|
server = "blowhole.hosts.in.redalder.org"
|
||||||
share = "/var/nfs/home-assistant_zigbee2mqtt"
|
share = "/var/nfs/home-assistant_zigbee2mqtt"
|
||||||
|
node_attach_driver = "nfs"
|
||||||
|
provisioner_driver = "node-manual"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_options {
|
mount_options {
|
||||||
fs_type = "nfs"
|
fs_type = "nfs"
|
||||||
mount_flags = [ "nolock", "hard" ]
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "nomad_volume" "home-assistant_mosquitto" {
|
resource "nomad_volume" "home-assistant_mosquitto" {
|
||||||
type = "csi"
|
type = "csi"
|
||||||
plugin_id = "nfs"
|
plugin_id = "org.democratic-csi.nfs"
|
||||||
volume_id = "home-assistant_mosquitto"
|
volume_id = "home-assistant_mosquitto"
|
||||||
name = "home-assistant_mosquitto"
|
name = "home-assistant_mosquitto"
|
||||||
external_id = "home-assistant_mosquitto"
|
external_id = "home-assistant_mosquitto"
|
||||||
|
@ -59,11 +63,13 @@ resource "nomad_volume" "home-assistant_mosquitto" {
|
||||||
context = {
|
context = {
|
||||||
server = "blowhole.hosts.in.redalder.org"
|
server = "blowhole.hosts.in.redalder.org"
|
||||||
share = "/var/nfs/home-assistant_mosquitto"
|
share = "/var/nfs/home-assistant_mosquitto"
|
||||||
|
node_attach_driver = "nfs"
|
||||||
|
provisioner_driver = "node-manual"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_options {
|
mount_options {
|
||||||
fs_type = "nfs"
|
fs_type = "nfs"
|
||||||
mount_flags = [ "nolock", "hard" ]
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
resource "nomad_volume" "jellyfin-cache" {
|
resource "nomad_volume" "jellyfin-cache" {
|
||||||
type = "csi"
|
type = "csi"
|
||||||
plugin_id = "nfs"
|
plugin_id = "org.democratic-csi.nfs"
|
||||||
volume_id = "jellyfin-cache"
|
volume_id = "jellyfin-cache"
|
||||||
name = "jellyfin-cache"
|
name = "jellyfin-cache"
|
||||||
external_id = "jellyfin-cache"
|
external_id = "jellyfin-cache"
|
||||||
|
@ -13,17 +13,19 @@ resource "nomad_volume" "jellyfin-cache" {
|
||||||
context = {
|
context = {
|
||||||
server = "blowhole.hosts.in.redalder.org"
|
server = "blowhole.hosts.in.redalder.org"
|
||||||
share = "/var/nfs/jellyfin/cache"
|
share = "/var/nfs/jellyfin/cache"
|
||||||
|
node_attach_driver = "nfs"
|
||||||
|
provisioner_driver = "node-manual"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_options {
|
mount_options {
|
||||||
fs_type = "nfs"
|
fs_type = "nfs"
|
||||||
mount_flags = [ "nolock", "hard" ]
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "nomad_volume" "jellyfin-config" {
|
resource "nomad_volume" "jellyfin-config" {
|
||||||
type = "csi"
|
type = "csi"
|
||||||
plugin_id = "nfs"
|
plugin_id = "org.democratic-csi.nfs"
|
||||||
volume_id = "jellyfin-config"
|
volume_id = "jellyfin-config"
|
||||||
name = "jellyfin-config"
|
name = "jellyfin-config"
|
||||||
external_id = "jellyfin-config"
|
external_id = "jellyfin-config"
|
||||||
|
@ -36,17 +38,19 @@ resource "nomad_volume" "jellyfin-config" {
|
||||||
context = {
|
context = {
|
||||||
server = "blowhole.hosts.in.redalder.org"
|
server = "blowhole.hosts.in.redalder.org"
|
||||||
share = "/var/nfs/jellyfin/config"
|
share = "/var/nfs/jellyfin/config"
|
||||||
|
node_attach_driver = "nfs"
|
||||||
|
provisioner_driver = "node-manual"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_options {
|
mount_options {
|
||||||
fs_type = "nfs"
|
fs_type = "nfs"
|
||||||
mount_flags = [ "nolock", "hard" ]
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "nomad_volume" "jellyfin-media" {
|
resource "nomad_volume" "jellyfin-media" {
|
||||||
type = "csi"
|
type = "csi"
|
||||||
plugin_id = "nfs"
|
plugin_id = "org.democratic-csi.nfs"
|
||||||
volume_id = "jellyfin-media"
|
volume_id = "jellyfin-media"
|
||||||
name = "jellyfin-media"
|
name = "jellyfin-media"
|
||||||
external_id = "jellyfin-media"
|
external_id = "jellyfin-media"
|
||||||
|
@ -59,11 +63,13 @@ resource "nomad_volume" "jellyfin-media" {
|
||||||
context = {
|
context = {
|
||||||
server = "blowhole.hosts.in.redalder.org"
|
server = "blowhole.hosts.in.redalder.org"
|
||||||
share = "/var/nfs/jellyfin/media"
|
share = "/var/nfs/jellyfin/media"
|
||||||
|
node_attach_driver = "nfs"
|
||||||
|
provisioner_driver = "node-manual"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_options {
|
mount_options {
|
||||||
fs_type = "nfs"
|
fs_type = "nfs"
|
||||||
mount_flags = [ "nolock", "hard" ]
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
resource "nomad_volume" "syncthing-data" {
|
resource "nomad_volume" "syncthing-data" {
|
||||||
type = "csi"
|
type = "csi"
|
||||||
plugin_id = "nfs"
|
plugin_id = "org.democratic-csi.nfs"
|
||||||
volume_id = "syncthing-data"
|
volume_id = "syncthing-data"
|
||||||
name = "syncthing-data"
|
name = "syncthing-data"
|
||||||
external_id = "syncthing-data"
|
external_id = "syncthing-data"
|
||||||
|
@ -13,17 +13,19 @@ resource "nomad_volume" "syncthing-data" {
|
||||||
context = {
|
context = {
|
||||||
server = "blowhole.hosts.in.redalder.org"
|
server = "blowhole.hosts.in.redalder.org"
|
||||||
share = "/var/nfs/syncthing/data"
|
share = "/var/nfs/syncthing/data"
|
||||||
|
node_attach_driver = "nfs"
|
||||||
|
provisioner_driver = "node-manual"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_options {
|
mount_options {
|
||||||
fs_type = "nfs"
|
fs_type = "nfs"
|
||||||
mount_flags = [ "nolock", "hard" ]
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "nomad_volume" "syncthing-storage" {
|
resource "nomad_volume" "syncthing-storage" {
|
||||||
type = "csi"
|
type = "csi"
|
||||||
plugin_id = "nfs"
|
plugin_id = "org.democratic-csi.nfs"
|
||||||
volume_id = "syncthing-storage"
|
volume_id = "syncthing-storage"
|
||||||
name = "syncthing-storage"
|
name = "syncthing-storage"
|
||||||
external_id = "syncthing-storage"
|
external_id = "syncthing-storage"
|
||||||
|
@ -36,17 +38,19 @@ resource "nomad_volume" "syncthing-storage" {
|
||||||
context = {
|
context = {
|
||||||
server = "blowhole.hosts.in.redalder.org"
|
server = "blowhole.hosts.in.redalder.org"
|
||||||
share = "/var/nfs/syncthing/storage"
|
share = "/var/nfs/syncthing/storage"
|
||||||
|
node_attach_driver = "nfs"
|
||||||
|
provisioner_driver = "node-manual"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_options {
|
mount_options {
|
||||||
fs_type = "nfs"
|
fs_type = "nfs"
|
||||||
mount_flags = [ "nolock", "hard" ]
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "nomad_volume" "syncthing-config" {
|
resource "nomad_volume" "syncthing-config" {
|
||||||
type = "csi"
|
type = "csi"
|
||||||
plugin_id = "nfs"
|
plugin_id = "org.democratic-csi.nfs"
|
||||||
volume_id = "syncthing-config"
|
volume_id = "syncthing-config"
|
||||||
name = "syncthing-config"
|
name = "syncthing-config"
|
||||||
external_id = "syncthing-config"
|
external_id = "syncthing-config"
|
||||||
|
@ -59,11 +63,13 @@ resource "nomad_volume" "syncthing-config" {
|
||||||
context = {
|
context = {
|
||||||
server = "blowhole.hosts.in.redalder.org"
|
server = "blowhole.hosts.in.redalder.org"
|
||||||
share = "/var/nfs/syncthing/config"
|
share = "/var/nfs/syncthing/config"
|
||||||
|
node_attach_driver = "nfs"
|
||||||
|
provisioner_driver = "node-manual"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_options {
|
mount_options {
|
||||||
fs_type = "nfs"
|
fs_type = "nfs"
|
||||||
mount_flags = [ "nolock", "hard" ]
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue