openstack-armada-app/openstack-helm/files/0014-Cinder-Support-backup-driver-specification-by-module.patch
Robert Church ea876f584e Cinder chart updates for volume backup and image caching
Pull in the two upstream changes since the last chart rebase and cherry
pick the newly proposed changes for enabling Cinder volume backups.

The following changes will be dropped on the next chart rebase:
 - Adding a cinder internal tenant to support image-volume caching
 - Allow configuring the RBD application name for volumes and backups

Change-Id: I2d3e7d5440b55e0e9e3d053f645fc162736bbde6
Story: 2004520
Task: 33631
Signed-off-by: Robert Church <robert.church@windriver.com>
2019-06-13 15:43:18 -04:00

242 lines
12 KiB
Diff

From a5c47db5550926bcf2d4dbd5667ad74e00b2ed97 Mon Sep 17 00:00:00 2001
From: Robert Church <robert.church@windriver.com>
Date: Fri, 24 May 2019 02:43:15 -0400
Subject: [PATCH 14/14] Cinder: Support backup driver specification by module
or class name
During the Queens cycle, Cinder introduced the ability to specify the
backup driver via class name and deprecated backup driver initialization
using the module name. (Id6bee9e7d0da8ead224a04f86fe79ddfb5b286cf)
Legacy support for initialization by module name was dropped in Stein.
(I3ada2dee1857074746b1893b82dd5f6641c6e579)
This change will support both methods of initialization and leave the
driver defaults enabled for module based initialization (valid through
Rocky images).
This change has been tested using the OSH default Cinder (Ocata) images
and StarlingX images based on master (Train).
Change-Id: Iec7bc6f4dd089aaa08ca652bebd9a10ef49da556
Signed-off-by: Robert Church <robert.church@windriver.com>
---
cinder/templates/bin/_backup-storage-init.sh.tpl | 8 ++++----
cinder/templates/configmap-etc.yaml | 2 +-
cinder/templates/deployment-backup.yaml | 16 ++++++++--------
cinder/templates/job-backup-storage-init.yaml | 8 ++++----
cinder/templates/job-clean.yaml | 4 ++--
cinder/templates/pvc-backup.yaml | 2 +-
cinder/values.yaml | 4 ++++
7 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/cinder/templates/bin/_backup-storage-init.sh.tpl b/cinder/templates/bin/_backup-storage-init.sh.tpl
index af9886ad..10069f17 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 5ed73db6..e13851ed 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 fdce03a9..bffd774c 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:
@@ -98,7 +98,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:
@@ -150,7 +150,7 @@ spec:
mountPath: {{ .Values.conf.cinder.DEFAULT.log_config_append }}
subPath: {{ base .Values.conf.cinder.DEFAULT.log_config_append }}
readOnly: true
- {{ 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 }}
@@ -164,7 +164,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
@@ -176,7 +176,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 }}
@@ -213,7 +213,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
@@ -221,7 +221,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 }}
@@ -231,7 +231,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 7b0e50e1..a43ba998 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:
@@ -106,7 +106,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
@@ -129,7 +129,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 }}
@@ -155,7 +155,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 d85234ed..54fd41e7 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" }}
@@ -87,7 +87,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 b2e851dc..94d63d0e 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 bef7b374..362f6918 100644
--- a/cinder/values.yaml
+++ b/cinder/values.yaml
@@ -767,6 +767,10 @@ conf:
enabled_backends: "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"
--
2.16.5