From 94528404e260686ece012eb9067778e1453f0d6a Mon Sep 17 00:00:00 2001 From: Jaesang Lee Date: Mon, 11 Jun 2018 07:01:07 +0000 Subject: [PATCH] Add ceph configuration for cinder-backup This PS allows the cinder-backup to use a separate ceph backend, you can add a ceph ip and admin keyring to .Values.backup_ceph so that cinder-backup can use the new ceph. blueprint add-ceph-configuration-for-cinder-backup Change-Id: Ib2c4ca3945a15107d77e36635bda52297de9f164 --- .../_external-ceph-rbd-admin-keyring.sh.tpl | 30 +++++++++++++++++++ cinder/templates/configmap-bin.yaml | 4 +++ cinder/templates/configmap-etc.yaml | 4 +++ cinder/templates/deployment-backup.yaml | 7 +++++ cinder/templates/job-backup-storage-init.yaml | 20 +++++++++++++ cinder/values.yaml | 7 +++++ 6 files changed, 72 insertions(+) create mode 100644 cinder/templates/bin/_external-ceph-rbd-admin-keyring.sh.tpl diff --git a/cinder/templates/bin/_external-ceph-rbd-admin-keyring.sh.tpl b/cinder/templates/bin/_external-ceph-rbd-admin-keyring.sh.tpl new file mode 100644 index 0000000000..8a8e9b3f1d --- /dev/null +++ b/cinder/templates/bin/_external-ceph-rbd-admin-keyring.sh.tpl @@ -0,0 +1,30 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -ex +{{- if .Values.backup.external_ceph_rbd.admin_keyring }} +cat < /etc/ceph/ceph.client.admin.keyring +[client.admin] + key = {{ .Values.backup.external_ceph_rbd.admin_keyring }} +EOF +{{- else }} +echo "ERROR: You must define the ceph admin keyring in values.yaml to use external_ceph_rbd." +exit 1 +{{- end }} + +exit 0 diff --git a/cinder/templates/configmap-bin.yaml b/cinder/templates/configmap-bin.yaml index f0d3450606..0cfd6af25b 100644 --- a/cinder/templates/configmap-bin.yaml +++ b/cinder/templates/configmap-bin.yaml @@ -68,3 +68,7 @@ data: rabbit-init.sh: | {{- include "helm-toolkit.scripts.rabbit_init" . | indent 4 }} {{- end }} +{{- if .Values.backup.external_ceph_rbd.enabled }} + external-ceph-rbd-admin-keyring.sh: | +{{ tuple "bin/_external-ceph-rbd-admin-keyring.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} +{{- end }} diff --git a/cinder/templates/configmap-etc.yaml b/cinder/templates/configmap-etc.yaml index fc82047c52..5902360f3b 100644 --- a/cinder/templates/configmap-etc.yaml +++ b/cinder/templates/configmap-etc.yaml @@ -133,4 +133,8 @@ data: {{ printf "%s.filters" $filePrefix }}: | {{ $value.content | indent 4 }} {{- end }} +{{- if .Values.backup.external_ceph_rbd.enabled }} + external-backup-ceph.conf: | +{{ include "helm-toolkit.utils.to_ini" .Values.backup.external_ceph_rbd.conf | indent 4 }} +{{- end }} {{- end }} diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml index 94d1ff0442..9606d14a55 100644 --- a/cinder/templates/deployment-backup.yaml +++ b/cinder/templates/deployment-backup.yaml @@ -149,10 +149,17 @@ spec: {{ if or (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.utils.is_ceph_volume_configured" $envAll) }} - name: etcceph mountPath: /etc/ceph + {{- if not .Values.backup.external_ceph_rbd.enabled }} - name: ceph-etc mountPath: /etc/ceph/ceph.conf subPath: ceph.conf readOnly: true + {{- else }} + - name: cinder-etc + mountPath: /etc/ceph/ceph.conf + subPath: external-backup-ceph.conf + readOnly: true + {{- end }} - name: ceph-keyring mountPath: /tmp/client-keyring subPath: key diff --git a/cinder/templates/job-backup-storage-init.yaml b/cinder/templates/job-backup-storage-init.yaml index 2201516da7..978b6910f1 100644 --- a/cinder/templates/job-backup-storage-init.yaml +++ b/cinder/templates/job-backup-storage-init.yaml @@ -74,10 +74,17 @@ spec: volumeMounts: - name: etcceph mountPath: /etc/ceph + {{- if not .Values.backup.external_ceph_rbd.enabled }} - name: cinder-bin mountPath: /tmp/ceph-admin-keyring.sh subPath: ceph-admin-keyring.sh readOnly: true + {{- else }} + - name: cinder-bin + mountPath: /tmp/ceph-admin-keyring.sh + subPath: external-ceph-rbd-admin-keyring.sh + readOnly: true + {{ end }} {{- if empty .Values.conf.ceph.admin_keyring }} - name: ceph-keyring mountPath: /tmp/client-keyring @@ -120,10 +127,17 @@ spec: {{- if eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph" }} - name: etcceph mountPath: /etc/ceph + {{- if not .Values.backup.external_ceph_rbd.enabled }} - name: ceph-etc mountPath: /etc/ceph/ceph.conf subPath: ceph.conf readOnly: true + {{- else }} + - name: cinder-etc + mountPath: /etc/ceph/ceph.conf + subPath: external-backup-ceph.conf + readOnly: true + {{- end }} {{- if empty .Values.conf.ceph.admin_keyring }} - name: ceph-keyring mountPath: /tmp/client-keyring @@ -143,6 +157,12 @@ spec: configMap: name: ceph-etc defaultMode: 0444 + {{- if .Values.backup.external_ceph_rbd.enabled }} + - name: cinder-etc + configMap: + name: cinder-etc + defaultMode: 0444 + {{- end }} {{- if empty .Values.conf.ceph.admin_keyring }} - name: ceph-keyring secret: diff --git a/cinder/values.yaml b/cinder/values.yaml index 60e66ff0e1..63c9d71948 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -863,6 +863,13 @@ conf: max: 0 backup: + external_ceph_rbd: + enabled: false + admin_keyring: null + conf: + global: + mon_host: null + osd: posix: volume: class_name: general