From b5ae94c0f788989ef80bfc08d09f00d6dc5990df Mon Sep 17 00:00:00 2001 From: josebb Date: Mon, 13 Dec 2021 20:20:40 +0200 Subject: [PATCH] Specify configmap name for external ceph configuration in cinder Now we need to add external ceph configuration in values as yaml format, then it is converted to ini format and added in cinder-etc configmap. Instead, we can just specify the pre-existing configmap name. Configmap name takes precedence over plain configuration. Change-Id: Ica1973798223207f6a453613a600d121db25edea --- cinder/Chart.yaml | 2 +- cinder/templates/configmap-etc.yaml | 4 +- cinder/templates/deployment-backup.yaml | 24 ++++++++++++ cinder/templates/deployment-volume.yaml | 13 +++++++ cinder/values.yaml | 2 + .../external-ceph-configmap.yaml | 39 +++++++++++++++++++ releasenotes/notes/cinder.yaml | 1 + 7 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 cinder/values_overrides/external-ceph-configmap.yaml diff --git a/cinder/Chart.yaml b/cinder/Chart.yaml index c5f47adcbe..d235da61c5 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.29 +version: 0.2.30 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/configmap-etc.yaml b/cinder/templates/configmap-etc.yaml index 309e8be6d5..fe73a881a6 100644 --- a/cinder/templates/configmap-etc.yaml +++ b/cinder/templates/configmap-etc.yaml @@ -158,10 +158,10 @@ data: {{- $filePrefix := replace "_" "-" $key }} {{ printf "%s.filters" $filePrefix }}: {{ $value.content | b64enc }} {{- end }} -{{- if .Values.backup.external_ceph_rbd.enabled }} +{{- if and .Values.backup.external_ceph_rbd.enabled (not .Values.backup.external_ceph_rbd.configmap) }} external-backup-ceph.conf: {{ include "helm-toolkit.utils.to_ini" .Values.backup.external_ceph_rbd.conf | b64enc }} {{- end }} -{{- if .Values.ceph_client.enable_external_ceph_backend }} +{{- if and .Values.ceph_client.enable_external_ceph_backend (not .Values.ceph_client.external_ceph.configmap) }} external-ceph.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.ceph_client.external_ceph.conf | b64enc }} {{- end }} {{- end }} diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml index b4a429b7f4..6107775cdf 100755 --- a/cinder/templates/deployment-backup.yaml +++ b/cinder/templates/deployment-backup.yaml @@ -189,6 +189,11 @@ spec: mountPath: /etc/ceph/ceph.conf subPath: ceph.conf readOnly: true + {{- else if .Values.backup.external_ceph_rbd.configmap }} + - name: external-backup-ceph-etc + mountPath: /etc/ceph/ceph.conf + subPath: ceph.conf + readOnly: true {{- else }} - name: cinder-etc mountPath: /etc/ceph/ceph.conf @@ -207,10 +212,17 @@ spec: readOnly: true {{- end }} {{- if .Values.ceph_client.enable_external_ceph_backend }} + {{- if .Values.ceph_client.external_ceph.configmap }} + - name: external-ceph-etc + mountPath: /etc/ceph/external-ceph.conf + subPath: external-ceph.conf + readOnly: true + {{- else }} - name: cinder-etc mountPath: /etc/ceph/external-ceph.conf subPath: external-ceph.conf readOnly: true + {{- end }} {{- if .Values.ceph_client.external_ceph.rbd_user }} - name: external-ceph-keyring mountPath: /tmp/external-ceph-client-keyring @@ -289,10 +301,22 @@ spec: {{ 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: {} + {{- if and .Values.backup.external_ceph_rbd.enabled .Values.backup.external_ceph_rbd.configmap }} + - name: external-backup-ceph-etc + configMap: + name: {{ .Values.backup.external_ceph_rbd.configmap }} + defaultMode: 0444 + {{- end }} - name: ceph-etc configMap: name: {{ .Values.ceph_client.configmap }} defaultMode: 0444 + {{- if and .Values.ceph_client.enable_external_ceph_backend .Values.ceph_client.external_ceph.configmap }} + - name: external-ceph-etc + configMap: + name: {{ .Values.ceph_client.external_ceph.configmap }} + defaultMode: 0444 + {{- end }} {{ end }} {{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }} - name: ceph-backup-keyring diff --git a/cinder/templates/deployment-volume.yaml b/cinder/templates/deployment-volume.yaml index ad605da046..0fccd461e6 100755 --- a/cinder/templates/deployment-volume.yaml +++ b/cinder/templates/deployment-volume.yaml @@ -193,10 +193,17 @@ spec: subPath: key readOnly: true {{- if .Values.ceph_client.enable_external_ceph_backend }} + {{- if .Values.ceph_client.external_ceph.configmap }} + - name: external-ceph-etc + mountPath: /etc/ceph/external-ceph.conf + subPath: external-ceph.conf + readOnly: true + {{- else }} - name: cinder-etc mountPath: /etc/ceph/external-ceph.conf subPath: external-ceph.conf readOnly: true + {{- end }} {{- if .Values.ceph_client.external_ceph.rbd_user }} - name: external-ceph-keyring mountPath: /tmp/external-ceph-client-keyring @@ -300,6 +307,12 @@ spec: configMap: name: {{ .Values.ceph_client.configmap }} defaultMode: 0444 + {{- if and .Values.ceph_client.enable_external_ceph_backend .Values.ceph_client.external_ceph.configmap }} + - name: external-ceph-etc + configMap: + name: {{ .Values.ceph_client.external_ceph.configmap }} + defaultMode: 0444 + {{- end }} - name: ceph-keyring secret: secretName: {{ .Values.secrets.rbd.volume | quote }} diff --git a/cinder/values.yaml b/cinder/values.yaml index 3acdadd40a..18bcda55f5 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -425,6 +425,7 @@ ceph_client: # secret for external ceph keyring will be created. rbd_user: null rbd_user_keyring: null + configmap: null conf: global: null osd: null @@ -1100,6 +1101,7 @@ backup: external_ceph_rbd: enabled: false admin_keyring: null + configmap: null conf: global: null osd: null diff --git a/cinder/values_overrides/external-ceph-configmap.yaml b/cinder/values_overrides/external-ceph-configmap.yaml new file mode 100644 index 0000000000..09822182d7 --- /dev/null +++ b/cinder/values_overrides/external-ceph-configmap.yaml @@ -0,0 +1,39 @@ +# Note: This yaml file serves as an example for overriding the manifest +# to enable additional externally managed Ceph Cinder backend. +# Configuration of external ceph cluster is provided by a pre-existing configmap. +# For backup external ceph, backup-external-ceph configmap with ceph.conf data field. +# For 2nd tier external ceph, external-ceph configmap with external-ceph.conf data field. +--- +backup: + external_ceph_rbd: + enabled: true + configmap: backup-external-ceph + +ceph_client: + enable_external_ceph_backend: True + external_ceph: + rbd_user: cinder2 + rbd_user_keyring: RBDUserKeyRing + configmap: external-ceph + +conf: + cinder: + DEFAULT: + enabled_backends: "rbd1,rbd2" + backends: + rbd2: + volume_driver: cinder.volume.drivers.rbd.RBDDriver + volume_backend_name: rbd2 + rbd_pool: cinder2.volumes + rbd_ceph_conf: "/etc/ceph/external-ceph.conf" + rbd_flatten_volume_from_snapshot: False + report_discard_supported: True + rbd_max_clone_depth: 5 + rbd_store_chunk_size: 4 + rados_connect_timeout: -1 + rbd_user: cinder2 + rbd_secret_uuid: 3f0133e4-8384-4743-9473-fecacc095c74 + image_volume_cache_enabled: True + image_volume_cache_max_size_gb: 200 + image_volume_cache_max_count: 50 +... diff --git a/releasenotes/notes/cinder.yaml b/releasenotes/notes/cinder.yaml index 41f2202c03..638dd0d4be 100644 --- a/releasenotes/notes/cinder.yaml +++ b/releasenotes/notes/cinder.yaml @@ -46,4 +46,5 @@ cinder: - 0.2.27 Support TLS endpoints - 0.2.28 Use HTTP probe instead of TCP probe - 0.2.29 Add SYS_ADMIN capability in cinder-volume + - 0.2.30 Specify a existing configmap name for external ceph configuration ...