From 74df9d19cbf088dbb8a4d8c93433b32bb39b35ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dulko?= Date: Tue, 18 Apr 2017 10:41:42 +0200 Subject: [PATCH] Add cinder-backup service cinder-backup binary is responsible for backing up volumes and snapshots as well as restoring them. Without this service being deployed, we cannot use those features. This commit introduces the service into OpenStack-Helm. Change-Id: I4ff5a56a77e5e10471a653ee1fbc3837de48ad38 --- cinder/templates/configmap-etc.yaml | 2 +- cinder/templates/deployment-backup.yaml | 87 +++++++++++++++++++++++++ cinder/values.yaml | 24 +++++++ 3 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 cinder/templates/deployment-backup.yaml diff --git a/cinder/templates/configmap-etc.yaml b/cinder/templates/configmap-etc.yaml index 58a9b21707..84442a19e9 100644 --- a/cinder/templates/configmap-etc.yaml +++ b/cinder/templates/configmap-etc.yaml @@ -98,7 +98,7 @@ data: {{- else -}} {{ tuple "etc/_policy.json.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{- end }} -{{- if include "cinder.is_ceph_configured" . -}} +{{- if or (include "cinder.is_ceph_configured" .) (eq .Values.conf.cinder.default.cinder.backup_driver "cinder.backup.drivers.ceph") -}} ceph.conf: |+ {{ if .Values.conf.ceph.override -}} {{ .Values.conf.ceph.override | indent 4 }} diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml new file mode 100644 index 0000000000..b6f5b61c04 --- /dev/null +++ b/cinder/templates/deployment-backup.yaml @@ -0,0 +1,87 @@ +# 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. +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.backup }} +{{- $mounts_cinder_backup := .Values.mounts.cinder_backup.cinder_backup }} +{{- $mounts_cinder_backup_init := .Values.mounts.cinder_backup.init_container }} + +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + name: cinder-backup +spec: + replicas: {{ .Values.replicas.backup }} + revisionHistoryLimit: {{ .Values.upgrades.revision_history }} + strategy: + type: {{ .Values.upgrades.pod_replacement_strategy }} + {{ if eq .Values.upgrades.pod_replacement_strategy "RollingUpdate" }} + rollingUpdate: + maxUnavailable: {{ .Values.upgrades.rolling_update.max_unavailable }} + maxSurge: {{ .Values.upgrades.rolling_update.max_surge }} + {{ end }} + template: + metadata: + labels: + app: cinder-backup + annotations: + configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} + configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} + pod.beta.kubernetes.io/init-containers: '[ +{{ tuple $envAll $dependencies $mounts_cinder_backup_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 10 }} + ]' + spec: + nodeSelector: + {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} + containers: + - name: cinder-backup + image: {{ .Values.images.backup }} + imagePullPolicy: {{ .Values.images.pull_policy }} + {{- if .Values.resources.enabled }} + resources: + requests: + memory: {{ .Values.resources.cinder_backup.requests.memory | quote }} + cpu: {{ .Values.resources.cinder_backup.requests.cpu | quote }} + limits: + memory: {{ .Values.resources.cinder_backup.limits.memory | quote }} + cpu: {{ .Values.resources.cinder_backup.limits.cpu | quote }} + {{- end }} + command: + - cinder-backup + - --config-dir + - /etc/cinder/conf + volumeMounts: + - name: pod-var-cache-cinder + mountPath: /var/cache/cinder + - name: cinder-etc + mountPath: /etc/cinder/conf/cinder.conf + subPath: cinder.conf + readOnly: true + {{- if eq .Values.conf.cinder.default.cinder.backup_driver "cinder.backup.drivers.ceph" }} + - name: cinder-etc + mountPath: /etc/ceph/ceph.conf + subPath: ceph.conf + readOnly: true + - name: cinder-etc + mountPath: /etc/ceph/ceph.client.{{ .Values.conf.backends.rbd1.rbd_user }}.keyring + subPath: ceph.client.{{ .Values.conf.backends.rbd1.rbd_user }}.keyring + readOnly: true + {{- end -}} +{{ if $mounts_cinder_backup.volumeMounts }}{{ toYaml $mounts_cinder_backup.volumeMounts | indent 12 }}{{ end }} + volumes: + - name: pod-var-cache-cinder + emptyDir: {} + - name: cinder-etc + configMap: + name: cinder-etc +{{ if $mounts_cinder_backup.volumes }}{{ toYaml $mounts_cinder_backup.volumes | indent 8 }}{{ end }} diff --git a/cinder/values.yaml b/cinder/values.yaml index 0311531ef0..08dbfa8071 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -21,6 +21,7 @@ replicas: api: 1 volume: 1 scheduler: 1 + backup: 1 labels: node_selector_key: openstack-control-plane @@ -35,6 +36,7 @@ images: api: docker.io/kolla/ubuntu-source-cinder-api:3.0.3 scheduler: docker.io/kolla/ubuntu-source-cinder-scheduler:3.0.3 volume: docker.io/kolla/ubuntu-source-cinder-volume:3.0.3 + backup: docker.io/kolla/ubuntu-source-cinder-backup:3.0.3 dep_check: docker.io/kolla/ubuntu-source-kubernetes-entrypoint:4.0.0 pull_policy: "IfNotPresent" @@ -103,6 +105,10 @@ conf: host: cinder-volume-worker osapi_volume_listen_port: 8776 enabled_backends: "rbd1" + backup_driver: "cinder.backup.drivers.ceph" + backup_ceph_conf: "/etc/ceph/ceph.conf" + backup_ceph_user: admin + backup_ceph_pool: backups keystone_authtoken: keystonemiddleware: auth_token: @@ -177,6 +183,14 @@ dependencies: service: - keystone-api - cinder-api + volume: + jobs: + - cinder-db-sync + - cinder-ks-user + - cinder-ks-endpoints + service: + - keystone-api + - cinder-api # We use a different layout of the endpoints here to account for versioning # this swaps the service name and type, and should be rolled out to other @@ -281,6 +295,13 @@ resources: limits: memory: "1024Mi" cpu: "2000m" + cinder_backup: + requests: + memory: "124Mi" + cpu: "100m" + limits: + memory: "1024Mi" + cpu: "2000m" cinder_db_init: requests: memory: "124Mi" @@ -327,3 +348,6 @@ mounts: cinder_volume: init_container: null cinder_volume: + cinder_backup: + init_container: null + cinder_backup: