diff --git a/cinder/templates/bin/_backup-storage-init.sh.tpl b/cinder/templates/bin/_backup-storage-init.sh.tpl index af9886ad8b..10069f17f8 100644 --- a/cinder/templates/bin/_backup-storage-init.sh.tpl +++ b/cinder/templates/bin/_backup-storage-init.sh.tpl @@ -17,7 +17,7 @@ limitations under the License. */}} set -x -if [ "x$STORAGE_BACKEND" == "xcinder.backup.drivers.ceph" ]; then +if [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.ceph' ]]; then SECRET=$(mktemp --suffix .yaml) KEYRING=$(mktemp --suffix .keyring) function cleanup { @@ -27,10 +27,10 @@ if [ "x$STORAGE_BACKEND" == "xcinder.backup.drivers.ceph" ]; then fi set -ex -if [ "x$STORAGE_BACKEND" == "xcinder.backup.drivers.swift" ] || \ - [ "x$STORAGE_BACKEND" == "xcinder.backup.drivers.posix" ]; then +if [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.swift' ]] || \ + [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.posix' ]]; then echo "INFO: no action required to use $STORAGE_BACKEND" -elif [ "x$STORAGE_BACKEND" == "xcinder.backup.drivers.ceph" ]; then +elif [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.ceph' ]]; then ceph -s function ensure_pool () { ceph osd pool stats $1 || ceph osd pool create $1 $2 diff --git a/cinder/templates/configmap-etc.yaml b/cinder/templates/configmap-etc.yaml index f934b92ecb..20862d2858 100644 --- a/cinder/templates/configmap-etc.yaml +++ b/cinder/templates/configmap-etc.yaml @@ -63,7 +63,7 @@ limitations under the License. {{- $_ := tuple "image" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.cinder.DEFAULT "glance_api_servers" -}} {{- end -}} -{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.swift" }} +{{- if (contains "cinder.backup.drivers.swift" .Values.conf.cinder.DEFAULT.backup_driver) }} {{- if empty .Values.conf.cinder.DEFAULT.backup_swift_auth_version -}} {{- $_ := set .Values.conf.cinder.DEFAULT "backup_swift_auth_version" "3" -}} {{- end -}} diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml index 89a824653e..ed98fdc49a 100644 --- a/cinder/templates/deployment-backup.yaml +++ b/cinder/templates/deployment-backup.yaml @@ -54,7 +54,7 @@ spec: {{ .Values.labels.backup.node_selector_key }}: {{ .Values.labels.backup.node_selector_value }} initContainers: {{ tuple $envAll "backup" $mounts_cinder_backup_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} + {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: ceph-backup-keyring-placement {{ tuple $envAll "cinder_backup" | include "helm-toolkit.snippets.image" | indent 10 }} securityContext: @@ -102,7 +102,7 @@ spec: subPath: key readOnly: true {{ end }} - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.posix" }} + {{- if (contains "cinder.backup.drivers.posix" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: ceph-backup-volume-perms {{ 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 (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.utils.is_ceph_volume_configured" $envAll) }} + {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }} - name: etcceph mountPath: /etc/ceph {{- if not .Values.backup.external_ceph_rbd.enabled }} @@ -176,7 +176,7 @@ spec: subPath: external-backup-ceph.conf readOnly: true {{- end }} - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} + {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: ceph-backup-keyring mountPath: /tmp/client-keyring subPath: key @@ -188,7 +188,7 @@ spec: readOnly: true {{- end }} {{- end }} - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.posix" }} + {{- if (contains "cinder.backup.drivers.posix" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: cinder-backup mountPath: {{ .Values.conf.cinder.DEFAULT.backup_posix_path }} {{- end }} @@ -227,7 +227,7 @@ spec: configMap: name: cinder-bin defaultMode: 0555 - {{ if or (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.utils.is_ceph_volume_configured" $envAll) }} + {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }} - name: etcceph emptyDir: {} - name: ceph-etc @@ -235,7 +235,7 @@ spec: name: {{ .Values.ceph_client.configmap }} defaultMode: 0444 {{ end }} - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} + {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: ceph-backup-keyring secret: secretName: {{ .Values.secrets.rbd.backup | quote }} @@ -245,7 +245,7 @@ spec: secret: secretName: {{ .Values.secrets.rbd.volume | quote }} {{ end }} - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.posix" }} + {{- if (contains "cinder.backup.drivers.posix" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: cinder-backup persistentVolumeClaim: claimName: cinder-backup diff --git a/cinder/templates/job-backup-storage-init.yaml b/cinder/templates/job-backup-storage-init.yaml index 988aa9535c..25fe6d3635 100644 --- a/cinder/templates/job-backup-storage-init.yaml +++ b/cinder/templates/job-backup-storage-init.yaml @@ -67,7 +67,7 @@ spec: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} initContainers: {{ tuple $envAll "backup_storage_init" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} + {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: ceph-keyring-placement {{ tuple $envAll "cinder_backup_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} securityContext: @@ -108,7 +108,7 @@ spec: fieldPath: metadata.namespace - name: STORAGE_BACKEND value: {{ .Values.conf.cinder.DEFAULT.backup_driver | quote }} - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} + {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: RBD_POOL_NAME value: {{ .Values.conf.cinder.DEFAULT.backup_ceph_pool | quote }} - name: RBD_POOL_APP_NAME @@ -133,7 +133,7 @@ spec: mountPath: /tmp/backup-storage-init.sh subPath: backup-storage-init.sh readOnly: true - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} + {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: etcceph mountPath: /etc/ceph {{- if not .Values.backup.external_ceph_rbd.enabled }} @@ -161,7 +161,7 @@ spec: configMap: name: cinder-bin defaultMode: 0555 - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} + {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: etcceph emptyDir: {} - name: ceph-etc diff --git a/cinder/templates/job-clean.yaml b/cinder/templates/job-clean.yaml index db44085871..415d41f858 100644 --- 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 (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.utils.is_ceph_volume_configured" $envAll) }} +{{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }} {{- $serviceAccountName := print "cinder-clean" }} {{ tuple $envAll "clean" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} @@ -89,7 +89,7 @@ spec: subPath: clean-secrets.sh readOnly: true {{ end }} - {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} + {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: cinder-volume-backup-secret-clean {{ tuple $envAll "cinder_backup_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/pvc-backup.yaml b/cinder/templates/pvc-backup.yaml index b2e851dcee..94d63d0ee9 100644 --- a/cinder/templates/pvc-backup.yaml +++ b/cinder/templates/pvc-backup.yaml @@ -16,7 +16,7 @@ limitations under the License. {{- if .Values.manifests.pvc_backup }} {{- $envAll := . }} -{{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.posix" }} +{{- if (contains "cinder.backup.drivers.posix" .Values.conf.cinder.DEFAULT.backup_driver) }} --- kind: PersistentVolumeClaim apiVersion: v1 diff --git a/cinder/values.yaml b/cinder/values.yaml index 93a23c4523..f527145cb3 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -797,6 +797,10 @@ conf: default_volume_type: "rbd1" # NOTE(portdirect): "cinder.backup.drivers.ceph" and # "cinder.backup.drivers.posix" also supported + # NOTE(rchurch): As of Stein, drivers by class name are required + # - cinder.backup.drivers.swift.SwiftBackupDriver + # - cinder.backup.drivers.ceph.CephBackupDriver + # - cinder.backup.drivers.posix.PosixBackupDriver backup_driver: "cinder.backup.drivers.swift" # Backup: Ceph RBD options backup_ceph_conf: "/etc/ceph/ceph.conf"