diff --git a/cinder/templates/job-storage-init.yaml b/cinder/templates/job-storage-init.yaml index fad5dbdb9d..876000eab5 100755 --- a/cinder/templates/job-storage-init.yaml +++ b/cinder/templates/job-storage-init.yaml @@ -90,7 +90,7 @@ spec: {{ end }} containers: {{- range $name, $backend := .Values.conf.backends }} - {{- if kindIs "map" $backend }} + {{- if (eq "true" ( dict "backend" $backend | include "cinder.utils.is_ceph_backend" )) }} - name: cinder-storage-init-{{$name}} {{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.storage_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} @@ -99,7 +99,6 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - {{- if include "cinder.utils.is_ceph_backend" $backend }} - name: STORAGE_BACKEND value: {{ $backend.volume_driver | quote }} - name: RBD_POOL_NAME @@ -116,7 +115,6 @@ spec: value: {{ (index $envAll.Values.conf.ceph.pools $backend.rbd_pool).chunk_size | quote }} - name: RBD_POOL_SECRET value: {{ $envAll.Values.secrets.rbd.volume | quote }} - {{- end }} command: - /tmp/storage-init.sh volumeMounts: @@ -126,7 +124,6 @@ spec: mountPath: /tmp/storage-init.sh subPath: storage-init.sh readOnly: true - {{- if include "cinder.utils.is_ceph_backend" $backend }} - name: etcceph mountPath: /etc/ceph - name: ceph-etc @@ -139,7 +136,6 @@ spec: subPath: key readOnly: true {{- end }} - {{- end }} {{- end }} {{- end }} volumes: diff --git a/cinder/templates/utils/_is_ceph_backend.tpl b/cinder/templates/utils/_is_ceph_backend.tpl index 3d5c3becc1..389197f93d 100644 --- a/cinder/templates/utils/_is_ceph_backend.tpl +++ b/cinder/templates/utils/_is_ceph_backend.tpl @@ -15,7 +15,6 @@ limitations under the License. */}} {{- define "cinder.utils.is_ceph_backend" -}} - {{- if kindIs "map" . -}} - {{- eq .volume_driver "cinder.volume.drivers.rbd.RBDDriver" -}} - {{- end -}} +{{- $backend := index . "backend" -}} +{{- printf "%v" (and ( kindIs "map" $backend ) ( eq $backend.volume_driver "cinder.volume.drivers.rbd.RBDDriver" )) -}} {{- end -}}