mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-21 23:54:22 +01:00
Add terranix config for nfs-csi container
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
4b6ca6f4c0
commit
a13865213f
47
terranix/containers/nfs-csi/controller.hcl
Normal file
47
terranix/containers/nfs-csi/controller.hcl
Normal file
|
@ -0,0 +1,47 @@
|
|||
variable "datacenters" {
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
job "democratic-csi-nfs-controller" {
|
||||
datacenters = var.datacenters
|
||||
|
||||
group "controller" {
|
||||
task "plugin" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "docker.io/democraticcsi/democratic-csi:latest"
|
||||
|
||||
args = [
|
||||
"--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=controller",
|
||||
"--server-socket=/csi/csi.sock",
|
||||
]
|
||||
}
|
||||
|
||||
template {
|
||||
destination = "${NOMAD_TASK_DIR}/driver-config-file.yaml"
|
||||
|
||||
data = <<EOH
|
||||
driver: node-manual
|
||||
EOH
|
||||
}
|
||||
|
||||
csi_plugin {
|
||||
# must match --csi-name arg
|
||||
id = "org.democratic-csi.nfs"
|
||||
type = "controller"
|
||||
mount_dir = "/csi"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 500
|
||||
memory = 256
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
terranix/containers/nfs-csi/default.nix
Normal file
26
terranix/containers/nfs-csi/default.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ elib, ... }:
|
||||
let
|
||||
inherit (elib)
|
||||
nomadJob;
|
||||
datacenters = builtins.toJSON [
|
||||
"do-1"
|
||||
"homelab-1"
|
||||
];
|
||||
in
|
||||
{
|
||||
resource."nomad_job"."nfs-controller" = nomadJob {
|
||||
jobspec = ./controller.hcl;
|
||||
|
||||
vars = {
|
||||
inherit datacenters;
|
||||
};
|
||||
};
|
||||
|
||||
resource."nomad_job"."nfs-node" = nomadJob {
|
||||
jobspec = ./node.hcl;
|
||||
|
||||
vars = {
|
||||
inherit datacenters;
|
||||
};
|
||||
};
|
||||
}
|
59
terranix/containers/nfs-csi/node.hcl
Normal file
59
terranix/containers/nfs-csi/node.hcl
Normal file
|
@ -0,0 +1,59 @@
|
|||
variable "datacenters" {
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
job "democratic-csi-nfs-node" {
|
||||
datacenters = var.datacenters
|
||||
|
||||
type = "system"
|
||||
|
||||
group "nodes" {
|
||||
task "plugin" {
|
||||
driver = "docker"
|
||||
|
||||
env {
|
||||
CSI_NODE_ID = "${attr.unique.hostname}"
|
||||
}
|
||||
|
||||
config {
|
||||
image = "docker.io/democraticcsi/democratic-csi:latest"
|
||||
|
||||
args = [
|
||||
"--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",
|
||||
]
|
||||
|
||||
# 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 {
|
||||
# must match --csi-name arg
|
||||
id = "org.democratic-csi.nfs"
|
||||
type = "node"
|
||||
mount_dir = "/csi"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 500
|
||||
memory = 256
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue