diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml old mode 100644 new mode 100755 index ed98fdc49a..835c2597fb --- a/cinder/templates/deployment-backup.yaml +++ b/cinder/templates/deployment-backup.yaml @@ -78,7 +78,7 @@ spec: subPath: key readOnly: true {{ end }} - {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.has_ceph_backend" $envAll }} - name: ceph-keyring-placement {{ tuple $envAll "cinder_backup" | include "helm-toolkit.snippets.image" | indent 10 }} securityContext: @@ -162,7 +162,7 @@ spec: subPath: {{ base .Values.conf.cinder.DEFAULT.log_config_append }} readOnly: true {{- end }} - {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }} + {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.has_ceph_backend" $envAll) }} - name: etcceph mountPath: /etc/ceph {{- if not .Values.backup.external_ceph_rbd.enabled }} @@ -227,7 +227,7 @@ spec: configMap: name: cinder-bin defaultMode: 0555 - {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }} + {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.has_ceph_backend" $envAll) }} - name: etcceph emptyDir: {} - name: ceph-etc @@ -240,7 +240,7 @@ spec: secret: secretName: {{ .Values.secrets.rbd.backup | quote }} {{ end }} - {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.has_ceph_backend" $envAll }} - name: ceph-keyring secret: secretName: {{ .Values.secrets.rbd.volume | quote }} diff --git a/cinder/templates/deployment-volume.yaml b/cinder/templates/deployment-volume.yaml old mode 100644 new mode 100755 index fcabd0fc13..45298d59a3 --- a/cinder/templates/deployment-volume.yaml +++ b/cinder/templates/deployment-volume.yaml @@ -54,7 +54,7 @@ spec: {{ .Values.labels.volume.node_selector_key }}: {{ .Values.labels.volume.node_selector_value }} initContainers: {{ tuple $envAll "volume" $mounts_cinder_volume_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.has_ceph_backend" $envAll }} - name: ceph-keyring-placement {{ tuple $envAll "cinder_volume" | include "helm-toolkit.snippets.image" | indent 10 }} securityContext: @@ -153,7 +153,7 @@ spec: mountPath: /etc/cinder/conf/backends.conf subPath: backends.conf readOnly: true - {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.has_ceph_backend" $envAll }} - name: etcceph mountPath: /etc/ceph - name: ceph-etc @@ -206,7 +206,7 @@ spec: secret: secretName: cinder-etc defaultMode: 0444 - {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.has_ceph_backend" $envAll }} - name: etcceph emptyDir: {} - name: pod-shared diff --git a/cinder/templates/job-clean.yaml b/cinder/templates/job-clean.yaml old mode 100644 new mode 100755 index 415d41f858..714dc2c128 --- a/cinder/templates/job-clean.yaml +++ b/cinder/templates/job-clean.yaml @@ -16,7 +16,7 @@ limitations under the License. {{- if .Values.manifests.job_clean }} {{- $envAll := . }} -{{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }} +{{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.has_ceph_backend" $envAll) }} {{- $serviceAccountName := print "cinder-clean" }} {{ tuple $envAll "clean" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} @@ -68,7 +68,7 @@ spec: initContainers: {{ tuple $envAll "clean" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: - {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.has_ceph_backend" $envAll }} - name: cinder-volume-rbd-secret-clean {{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.clean | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} diff --git a/cinder/templates/job-storage-init.yaml b/cinder/templates/job-storage-init.yaml old mode 100644 new mode 100755 index 7a0cae06bd..4c13be6ff2 --- a/cinder/templates/job-storage-init.yaml +++ b/cinder/templates/job-storage-init.yaml @@ -65,7 +65,7 @@ spec: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} initContainers: {{ tuple $envAll "storage_init" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.has_ceph_backend" $envAll }} - name: ceph-keyring-placement {{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} securityContext: @@ -97,7 +97,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.has_ceph_backend" $envAll }} - name: STORAGE_BACKEND value: {{ index (index .Values.conf.backends (include "cinder.utils.ceph_volume_section_name" $envAll)) "volume_driver" | quote }} - name: RBD_POOL_NAME @@ -124,7 +124,7 @@ spec: mountPath: /tmp/storage-init.sh subPath: storage-init.sh readOnly: true - {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.has_ceph_backend" $envAll }} - name: etcceph mountPath: /etc/ceph - name: ceph-etc @@ -145,7 +145,7 @@ spec: configMap: name: cinder-bin defaultMode: 0555 - {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.has_ceph_backend" $envAll }} - name: etcceph emptyDir: {} - name: ceph-etc diff --git a/cinder/templates/utils/_is_ceph_volume_configured.tpl b/cinder/templates/utils/_has_ceph_backend.tpl similarity index 64% rename from cinder/templates/utils/_is_ceph_volume_configured.tpl rename to cinder/templates/utils/_has_ceph_backend.tpl index 63f2a73aab..0ff7ae5e81 100644 --- a/cinder/templates/utils/_is_ceph_volume_configured.tpl +++ b/cinder/templates/utils/_has_ceph_backend.tpl @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- define "cinder.utils.is_ceph_volume_configured" -}} -{{- range $section, $values := .Values.conf.backends -}} -{{- if kindIs "map" $values -}} -{{- if eq $values.volume_driver "cinder.volume.drivers.rbd.RBDDriver" -}} -true -{{- end -}} -{{- end -}} -{{- end -}} +{{- define "cinder.utils.has_ceph_backend" -}} + {{- $has_ceph := false -}} + {{- range $_, $backend := .Values.conf.backends -}} + {{- if kindIs "map" $backend -}} + {{- $has_ceph = or $has_ceph (eq $backend.volume_driver "cinder.volume.drivers.rbd.RBDDriver") -}} + {{- end -}} + {{- end -}} + {{- $has_ceph -}} {{- end -}}