From 93bad61c4e25b091e2adcc56893eb7dc5227605e Mon Sep 17 00:00:00 2001 From: okozachenko Date: Thu, 11 Aug 2022 17:45:04 +1000 Subject: [PATCH] Fix conditional check for ceph backend Current check uses cinder.utils.has_ceph_backend template which returns bool-like string values("true" or "false"), and consider it as bool type. So it is always true regardless of whether there is ceph backend or not. To fix this, this change uses string comparision. Change-Id: Ie2e54c00d536874562eb93e70a2836cac102c992 --- cinder/Chart.yaml | 2 +- cinder/templates/deployment-backup.yaml | 6 +++--- cinder/templates/deployment-volume.yaml | 4 ++-- cinder/templates/job-clean.yaml | 4 ++-- cinder/templates/job-storage-init.yaml | 4 ++-- releasenotes/notes/cinder.yaml | 1 + 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cinder/Chart.yaml b/cinder/Chart.yaml index 536f64c600..1afe30f573 100644 --- a/cinder/Chart.yaml +++ b/cinder/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Cinder name: cinder -version: 0.2.23 +version: 0.2.24 home: https://docs.openstack.org/cinder/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Cinder/OpenStack_Project_Cinder_vertical.png sources: diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml index 55c7289cf0..b4a429b7f4 100755 --- a/cinder/templates/deployment-backup.yaml +++ b/cinder/templates/deployment-backup.yaml @@ -181,7 +181,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.has_ceph_backend" $envAll) }} + {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (eq "true" (include "cinder.utils.has_ceph_backend" $envAll)) }} - name: etcceph mountPath: /etc/ceph {{- if not .Values.backup.external_ceph_rbd.enabled }} @@ -286,7 +286,7 @@ spec: configMap: name: cinder-bin defaultMode: 0555 - {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.has_ceph_backend" $envAll) }} + {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (eq "true" (include "cinder.utils.has_ceph_backend" $envAll)) }} - name: etcceph emptyDir: {} - name: ceph-etc @@ -299,7 +299,7 @@ spec: secret: secretName: {{ .Values.secrets.rbd.backup | quote }} {{ end }} - {{- if include "cinder.utils.has_ceph_backend" $envAll }} + {{- if eq "true" (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 index 537b712e7a..5dfa8d7567 100755 --- a/cinder/templates/deployment-volume.yaml +++ b/cinder/templates/deployment-volume.yaml @@ -176,7 +176,7 @@ spec: mountPath: /etc/cinder/conf/backends.conf subPath: backends.conf readOnly: true - {{- if include "cinder.utils.has_ceph_backend" $envAll }} + {{- if eq "true" (include "cinder.utils.has_ceph_backend" $envAll) }} - name: etcceph mountPath: /etc/ceph - name: ceph-etc @@ -284,7 +284,7 @@ spec: secret: secretName: cinder-etc defaultMode: 0444 - {{- if include "cinder.utils.has_ceph_backend" $envAll }} + {{- if eq "true" (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 index 57a424378e..d4efac5706 100755 --- a/cinder/templates/job-clean.yaml +++ b/cinder/templates/job-clean.yaml @@ -14,7 +14,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.has_ceph_backend" $envAll) }} +{{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (eq "true" (include "cinder.utils.has_ceph_backend" $envAll)) }} {{- $serviceAccountName := print "cinder-clean" }} {{ tuple $envAll "clean" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} @@ -72,7 +72,7 @@ spec: initContainers: {{ tuple $envAll "clean" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: - {{- if include "cinder.utils.has_ceph_backend" $envAll }} + {{- if eq "true" (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 index badfe5fcd8..0f06c221e0 100755 --- a/cinder/templates/job-storage-init.yaml +++ b/cinder/templates/job-storage-init.yaml @@ -70,7 +70,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.has_ceph_backend" $envAll }} + {{- if eq "true" (include "cinder.utils.has_ceph_backend" $envAll) }} - name: ceph-keyring-placement {{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} securityContext: @@ -152,7 +152,7 @@ spec: configMap: name: cinder-bin defaultMode: 0555 - {{- if include "cinder.utils.has_ceph_backend" $envAll }} + {{- if eq "true" (include "cinder.utils.has_ceph_backend" $envAll) }} - name: etcceph emptyDir: {} - name: ceph-etc diff --git a/releasenotes/notes/cinder.yaml b/releasenotes/notes/cinder.yaml index 5765918010..97690c8432 100644 --- a/releasenotes/notes/cinder.yaml +++ b/releasenotes/notes/cinder.yaml @@ -40,4 +40,5 @@ cinder: - 0.2.21 Migrated CronJob resource to batch/v1 API version & PodDisruptionBudget to policy/v1 - 0.2.22 Add Xena and Yoga values overrides - 0.2.23 Added OCI registry authentication + - 0.2.24 Fix conditional check for cinder.utils.has_ceph_backend template ...