orchestration-tests/nomad/storage_plugins/democratic-csi-nfs-node.nomad

70 lines
1.5 KiB
Plaintext
Raw Normal View History

2022-06-17 22:19:19 +00:00
variable "image_name" {
type = string
default = "docker.io/democraticcsi/democratic-csi:latest"
}
variable "csi_version" {
type = string
default = "1.5.0"
}
variable "config_data" {
type = string
}
job "democratic-csi-nfs-node" {
datacenters = ["dc1"]
# you can run node plugins as service jobs as well, but this ensures
# that all nodes in the DC have a copy.
type = "system"
group "nodes" {
task "plugin" {
driver = "docker"
env {
CSI_NODE_ID = "${attr.unique.hostname}"
}
config {
image = var.image_name
args = [
"--csi-version=${var.csi_version}",
# 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 = var.config_data
}
csi_plugin {
# must match --csi-name arg
id = "org.democratic-csi.nfs"
type = "node"
mount_dir = "/csi"
}
resources {
cpu = 250
memory = 128
}
}
}
}