This commit is contained in:
Daniel Berteaud 2023-10-08 16:24:28 +02:00
parent 5a4801c142
commit 35420a1f81
3 changed files with 18 additions and 17 deletions

View File

@ -1,6 +1,8 @@
job "[[ .democratic_csi.job_name ]]-controller" {
[[ $c := merge .democratic_csi.controller . -]]
[[- template "common/job_start.tpl" merge (dict "nomad" .democratic_csi.controller) . ]]
job "[[ .democratic_csi.instance ]]-controller" {
[[- template "common/job_start.tpl" $c ]]
[[- range $proto := slice "iscsi" "nfs" ]]
@ -10,15 +12,15 @@ job "[[ .democratic_csi.job_name ]]-controller" {
task "[[ $proto ]]-controller" {
driver = [[ $.democratic_csi.controller.driver | toJSON ]]
driver = [[ $c.nomad.driver | toJSON ]]
env {
NODE_EXTRA_CA_CERTS = "/local/ca.crt"
[[ template "common/env.tpl" $.democratic_csi.controller.env ]]
[[ template "common/env.tpl" $c.env ]]
}
vault {
policies = ["democratic-csi[[ $.env.suffix ]]"]
policies = ["democratic-csi[[ $c.consul.suffix ]]"]
}
config {
@ -48,7 +50,7 @@ _EOF
# Load vault root CA into the trust store
template {
data = <<-EOF
{{ with secret "[[ $.env.suffix ]]pki/root/cert/ca" }}{{ .Data.certificate }}{{ end }}
{{ with secret "[[ $c.consul.suffix ]]pki/root/cert/ca" }}{{ .Data.certificate }}{{ end }}
EOF
destination = "local/ca.crt"
}

View File

@ -1,7 +1,9 @@
job "[[ .democratic_csi.job_name ]]-node" {
[[ $c := merge .democratic_csi.node . -]]
job "[[ .democratic_csi.instance ]]-node" {
type = "system"
[[- template "common/job_start.tpl" merge (dict "nomad" .democratic_csi.node) . ]]
[[- template "common/job_start.tpl" $c ]]
[[- range $proto := slice "iscsi" "nfs" ]]
@ -23,11 +25,11 @@ job "[[ .democratic_csi.job_name ]]-node" {
task "[[ $proto ]]-node" {
driver = [[ $.democratic_csi.node.driver | toJSON ]]
driver = [[ $c.nomad.driver | toJSON ]]
env {
CSI_NODE_ID = "${attr.unique.hostname}"
[[ template "common/env.tpl" $.democratic_csi.node.env ]]
[[ template "common/env.tpl" $c.env ]]
}
config {

View File

@ -3,20 +3,19 @@
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
# Name of the instance (must be different if you plan to run several copies on the same namespace)
instance: democratic-csi
# Settings for controllers
controller:
# Number of controler instances
count: 1
# Driver (docker or podman)
driver: docker
# Resource allocation for controllers
resources:
cpu: 100
@ -63,8 +62,6 @@ democratic_csi:
# Settings for node plugins
node:
# Driver (docker or podman)
driver: docker
# Resource allocation
resources: