Cleanup and allow job name customization

This commit is contained in:
Daniel Berteaud 2023-09-03 17:43:31 +02:00
parent 4120874069
commit a18c0515f7
4 changed files with 36 additions and 14 deletions

View File

@ -1,4 +1,4 @@
job "democratic-csi-controller" {
job "[[ .democratic_csi.job_name ]]-controller" {
[[- template "common/job_start.tpl" merge (dict "nomad" .democratic_csi.controller) . ]]
@ -26,7 +26,7 @@ job "democratic-csi-controller" {
args = [
"--csi-version=1.5.0",
"--csi-name=org.democratic-csi.[[ $proto ]]",
"--csi-name=[[ $.democratic_csi.plugin_id ]].[[ $proto ]]",
"--driver-config-file=/secrets/config.yml",
"--log-level=info",
"--csi-mode=controller",
@ -54,8 +54,7 @@ _EOF
}
csi_plugin {
# must match --csi-name arg
id = "org.democratic-csi.[[ $proto ]]"
id = "[[ $.democratic_csi.plugin_id ]].[[ $proto ]]"
type = "controller"
mount_dir = "/csi"
}

2
deps/common vendored

@ -1 +1 @@
Subproject commit c7906097f20a6d1598500afaee825159146bc498
Subproject commit a1738a81645748892a34d990c6df07cd1b4815ad

View File

@ -1,4 +1,4 @@
job "democratic-csi-node" {
job "[[ .democratic_csi.job_name ]]-node" {
type = "system"
[[- template "common/job_start.tpl" merge (dict "nomad" .democratic_csi.node) . ]]
@ -9,15 +9,15 @@ job "democratic-csi-node" {
[[- if eq $proto "iscsi" ]]
volume "host_root" {
type = "host"
type = [[ $.democratic_csi.node.volumes.host_root.type | toJSON ]]
read_only = false
source = "host_root"
source = [[ $.democratic_csi.node.volumes.host_root.source | toJSON ]]
}
volume "host_run_udev" {
type = "host"
type = [[ $.democratic_csi.node.volumes.run_udev.type | toJSON ]]
read_only = true
source = "host_run_udev"
source = [[ $.democratic_csi.node.volumes.run_udev.source | toJSON ]]
}
[[- end ]]
@ -36,7 +36,7 @@ job "democratic-csi-node" {
args = [
"--csi-version=1.5.0",
# must match the csi_plugin.id attribute below
"--csi-name=org.democratic-csi.[[ $proto ]]",
"--csi-name=[[ $.democratic_csi.plugin_id ]].[[ $proto ]]",
"--driver-config-file=/secrets/config.yml",
"--log-level=info",
"--csi-mode=node",
@ -60,7 +60,7 @@ _EOF
csi_plugin {
# must match --csi-name arg
id = "org.democratic-csi.[[ $proto ]]"
id = "[[ $.democratic_csi.plugin_id ]].[[ $proto ]]"
type = "node"
mount_dir = "/csi"
}

View File

@ -3,10 +3,14 @@
democratic_csi:
# The Docker image to use
image: danielberteaud/democratic-csi:1.8.3-4
# The ID of the storage plugin (the protocol will be appended
# Eg org.democratic-csi.iscsi and org.democratic-csi.nfs
plugin_id: org.democratic-csi
# The name of the job (-controller and -node will be appended
job_name: democratic-csi
# Settings for controllers
controller:
# Number of controler instances
count: 1
@ -59,7 +63,6 @@ democratic_csi:
# Settings for node plugins
node:
# Driver (docker or podman)
driver: docker
@ -71,3 +74,23 @@ democratic_csi:
# Custom env var to pass to controllers
env: {}
volumes:
# Democratic CSI nodes requiers an access to the host rootfs
# and the host /run/udev for everything to work.
# For this, you should create two volumes on your Nomad client, like this
#
# host_volume "host_root" {
# path = "/"
# }
# host_volume "host_run_udev" {
# path = "/run/udev"
# read_only = "true"
# }
host_root:
type: host
source: host_root
run_udev:
type: host
source: host_run_udev