openstack-armada-app/openstack-helm/files/0016-Cinder-rename-is_ceph_volume-configured.patch
Daniel Badea 875feb0307 Cinder support for multiple Ceph backends
Wrap code making the assumption there is only one Ceph backend
(using is_ceph_volume_configured) in a "range" and use ceph_backend_list
helper to iterate all available Ceph backends.

Move Ceph pool application name in values.yaml from
conf.software.rbd.rbd_pool_app_name* to conf.ceph.pools.*.app_name

Change-Id: Ib62407a876b8e679a15d6b9293b8e1e03e149788
Depends-On: I2d3e7d5440b55e0e9e3d053f645fc162736bbde6
Story: 2003909
Task: 30351
Signed-off-by: Daniel Badea <daniel.badea@windriver.com>
2019-06-20 13:02:28 +00:00

230 lines
10 KiB
Diff

From 4e4a8197f90ba90c5bfbad02698ad351e7e92125 Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Wed, 12 Jun 2019 14:07:17 +0000
Subject: [PATCH 1/2] Cinder rename is_ceph_volume configured
When using multiple ceph backends there is more than
one ceph 'volume' configured. Rename template to
_has_ceph_backend.
---
cinder/templates/deployment-backup.yaml | 8 +++----
cinder/templates/deployment-volume.yaml | 6 +++---
cinder/templates/job-clean.yaml | 4 ++--
cinder/templates/job-storage-init.yaml | 8 +++----
cinder/templates/utils/_has_ceph_backend.tpl | 25 ++++++++++++++++++++++
.../templates/utils/_is_ceph_volume_configured.tpl | 25 ----------------------
6 files changed, 38 insertions(+), 38 deletions(-)
mode change 100644 => 100755 cinder/templates/deployment-backup.yaml
mode change 100644 => 100755 cinder/templates/deployment-volume.yaml
mode change 100644 => 100755 cinder/templates/job-clean.yaml
mode change 100644 => 100755 cinder/templates/job-storage-init.yaml
create mode 100644 cinder/templates/utils/_has_ceph_backend.tpl
delete mode 100644 cinder/templates/utils/_is_ceph_volume_configured.tpl
diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml
old mode 100644
new mode 100755
index bffd774..74e38ba
--- a/cinder/templates/deployment-backup.yaml
+++ b/cinder/templates/deployment-backup.yaml
@@ -76,7 +76,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:
@@ -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 (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 }}
@@ -213,7 +213,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
@@ -226,7 +226,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 17902c0..a274d12
--- 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:
@@ -143,7 +143,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
@@ -194,7 +194,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 54fd41e..f0da8d4
--- 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 2708181..99128db
--- 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:
@@ -95,7 +95,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
@@ -120,7 +120,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
@@ -139,7 +139,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/_has_ceph_backend.tpl b/cinder/templates/utils/_has_ceph_backend.tpl
new file mode 100644
index 0000000..0ff7ae5
--- /dev/null
+++ b/cinder/templates/utils/_has_ceph_backend.tpl
@@ -0,0 +1,25 @@
+{{/*
+Copyright 2017 The Openstack-Helm Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/}}
+
+{{- 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 -}}
diff --git a/cinder/templates/utils/_is_ceph_volume_configured.tpl b/cinder/templates/utils/_is_ceph_volume_configured.tpl
deleted file mode 100644
index 63f2a73..0000000
--- a/cinder/templates/utils/_is_ceph_volume_configured.tpl
+++ /dev/null
@@ -1,25 +0,0 @@
-{{/*
-Copyright 2017 The Openstack-Helm Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-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 -}}
-{{- end -}}
--
1.8.3.1