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
This commit is contained in:
okozachenko 2022-08-11 17:45:04 +10:00
parent ced30abead
commit 93bad61c4e
6 changed files with 11 additions and 10 deletions

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0 appVersion: v1.0.0
description: OpenStack-Helm Cinder description: OpenStack-Helm Cinder
name: cinder name: cinder
version: 0.2.23 version: 0.2.24
home: https://docs.openstack.org/cinder/latest/ home: https://docs.openstack.org/cinder/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Cinder/OpenStack_Project_Cinder_vertical.png icon: https://www.openstack.org/themes/openstack/images/project-mascots/Cinder/OpenStack_Project_Cinder_vertical.png
sources: sources:

View File

@ -181,7 +181,7 @@ spec:
subPath: {{ base .Values.conf.cinder.DEFAULT.log_config_append }} subPath: {{ base .Values.conf.cinder.DEFAULT.log_config_append }}
readOnly: true readOnly: true
{{- end }} {{- 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 - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
{{- if not .Values.backup.external_ceph_rbd.enabled }} {{- if not .Values.backup.external_ceph_rbd.enabled }}
@ -286,7 +286,7 @@ spec:
configMap: configMap:
name: cinder-bin name: cinder-bin
defaultMode: 0555 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 - name: etcceph
emptyDir: {} emptyDir: {}
- name: ceph-etc - name: ceph-etc
@ -299,7 +299,7 @@ spec:
secret: secret:
secretName: {{ .Values.secrets.rbd.backup | quote }} secretName: {{ .Values.secrets.rbd.backup | quote }}
{{ end }} {{ end }}
{{- if include "cinder.utils.has_ceph_backend" $envAll }} {{- if eq "true" (include "cinder.utils.has_ceph_backend" $envAll) }}
- name: ceph-keyring - name: ceph-keyring
secret: secret:
secretName: {{ .Values.secrets.rbd.volume | quote }} secretName: {{ .Values.secrets.rbd.volume | quote }}

View File

@ -176,7 +176,7 @@ spec:
mountPath: /etc/cinder/conf/backends.conf mountPath: /etc/cinder/conf/backends.conf
subPath: backends.conf subPath: backends.conf
readOnly: true readOnly: true
{{- if include "cinder.utils.has_ceph_backend" $envAll }} {{- if eq "true" (include "cinder.utils.has_ceph_backend" $envAll) }}
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
- name: ceph-etc - name: ceph-etc
@ -284,7 +284,7 @@ spec:
secret: secret:
secretName: cinder-etc secretName: cinder-etc
defaultMode: 0444 defaultMode: 0444
{{- if include "cinder.utils.has_ceph_backend" $envAll }} {{- if eq "true" (include "cinder.utils.has_ceph_backend" $envAll) }}
- name: etcceph - name: etcceph
emptyDir: {} emptyDir: {}
- name: pod-shared - name: pod-shared

View File

@ -14,7 +14,7 @@ limitations under the License.
{{- if .Values.manifests.job_clean }} {{- if .Values.manifests.job_clean }}
{{- $envAll := . }} {{- $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" }} {{- $serviceAccountName := print "cinder-clean" }}
{{ tuple $envAll "clean" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} {{ tuple $envAll "clean" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
@ -72,7 +72,7 @@ spec:
initContainers: initContainers:
{{ tuple $envAll "clean" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} {{ tuple $envAll "clean" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers: 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 - name: cinder-volume-rbd-secret-clean
{{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} {{ 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 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.clean | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}

View File

@ -70,7 +70,7 @@ spec:
{{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
initContainers: initContainers:
{{ tuple $envAll "storage_init" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} {{ 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 - name: ceph-keyring-placement
{{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }}
securityContext: securityContext:
@ -152,7 +152,7 @@ spec:
configMap: configMap:
name: cinder-bin name: cinder-bin
defaultMode: 0555 defaultMode: 0555
{{- if include "cinder.utils.has_ceph_backend" $envAll }} {{- if eq "true" (include "cinder.utils.has_ceph_backend" $envAll) }}
- name: etcceph - name: etcceph
emptyDir: {} emptyDir: {}
- name: ceph-etc - name: ceph-etc

View File

@ -40,4 +40,5 @@ cinder:
- 0.2.21 Migrated CronJob resource to batch/v1 API version & PodDisruptionBudget to policy/v1 - 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.22 Add Xena and Yoga values overrides
- 0.2.23 Added OCI registry authentication - 0.2.23 Added OCI registry authentication
- 0.2.24 Fix conditional check for cinder.utils.has_ceph_backend template
... ...