From 641cc4a15a64c86649c3b37ee0b6358d7cda444b Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Wed, 13 Jun 2018 17:43:47 -0500 Subject: [PATCH] Cinder: update functions to live in correct locations This PS simply moves functions within the chart to their correct location. Change-Id: I6430304528b964d9babcd54e3336f3016b8efde6 Signed-off-by: Pete Birley --- cinder/templates/deployment-backup.yaml | 10 ++++---- cinder/templates/deployment-volume.yaml | 8 +++--- cinder/templates/job-clean.yaml | 4 +-- cinder/templates/job-storage-init.yaml | 14 +++++------ .../_ceph_volume_section_name.tpl} | 12 +-------- .../utils/_is_ceph_volume_configured.tpl | 25 +++++++++++++++++++ 6 files changed, 44 insertions(+), 29 deletions(-) rename cinder/templates/{_funcs.tpl => utils/_ceph_volume_section_name.tpl} (71%) create mode 100644 cinder/templates/utils/_is_ceph_volume_configured.tpl diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml index 466fde44..9122bc32 100644 --- a/cinder/templates/deployment-backup.yaml +++ b/cinder/templates/deployment-backup.yaml @@ -67,7 +67,7 @@ spec: subPath: key readOnly: true {{ end }} - {{- if include "cinder.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} - name: ceph-keyring-placement {{ tuple $envAll "cinder_backup" | include "helm-toolkit.snippets.image" | indent 10 }} securityContext: @@ -76,7 +76,7 @@ spec: - /tmp/ceph-keyring.sh env: - name: RBD_USER - value: {{ index (index .Values.conf.backends (include "cinder.ceph_volume_section_name" $envAll)) "rbd_user" | quote }} + value: {{ index (index .Values.conf.backends (include "cinder.utils.ceph_volume_section_name" $envAll)) "rbd_user" | quote }} volumeMounts: - name: etcceph mountPath: /etc/ceph @@ -137,7 +137,7 @@ spec: mountPath: /etc/cinder/cinder.conf subPath: cinder.conf readOnly: true - {{ if or (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.is_ceph_volume_configured" $envAll) }} + {{ 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 - name: ceph-etc @@ -186,7 +186,7 @@ spec: configMap: name: cinder-bin defaultMode: 0555 - {{ if or (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.is_ceph_volume_configured" $envAll) }} + {{ if or (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.utils.is_ceph_volume_configured" $envAll) }} - name: etcceph emptyDir: {} - name: ceph-etc @@ -199,7 +199,7 @@ spec: secret: secretName: {{ .Values.secrets.rbd.backup | quote }} {{ end }} - {{- if include "cinder.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.is_ceph_volume_configured" $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 index ef796388..b51977fe 100644 --- a/cinder/templates/deployment-volume.yaml +++ b/cinder/templates/deployment-volume.yaml @@ -45,7 +45,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.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} - name: ceph-keyring-placement {{ tuple $envAll "cinder_volume" | include "helm-toolkit.snippets.image" | indent 10 }} securityContext: @@ -54,7 +54,7 @@ spec: - /tmp/ceph-keyring.sh env: - name: RBD_USER - value: {{ index (index .Values.conf.backends (include "cinder.ceph_volume_section_name" $envAll)) "rbd_user" | quote }} + value: {{ index (index .Values.conf.backends (include "cinder.utils.ceph_volume_section_name" $envAll)) "rbd_user" | quote }} volumeMounts: - name: etcceph mountPath: /etc/ceph @@ -102,7 +102,7 @@ spec: mountPath: /etc/cinder/conf/backends.conf subPath: backends.conf readOnly: true - {{- if include "cinder.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} - name: etcceph mountPath: /etc/ceph - name: ceph-etc @@ -152,7 +152,7 @@ spec: - name: cinder-etc configMap: name: cinder-etc - {{- if include "cinder.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} - name: etcceph emptyDir: {} - name: ceph-etc diff --git a/cinder/templates/job-clean.yaml b/cinder/templates/job-clean.yaml index 76d8cffe..039731c6 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.is_ceph_volume_configured" $envAll) }} +{{ if or (eq .Values.conf.cinder.DEFAULT.backup_driver "cinder.backup.drivers.ceph") (include "cinder.utils.is_ceph_volume_configured" $envAll) }} {{- $randStringSuffix := randAlphaNum 5 | lower }} @@ -69,7 +69,7 @@ spec: initContainers: {{ tuple $envAll "clean" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: - {{- if include "cinder.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.is_ceph_volume_configured" $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 index 591a19e5..beb4c786 100644 --- a/cinder/templates/job-storage-init.yaml +++ b/cinder/templates/job-storage-init.yaml @@ -64,7 +64,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.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} - name: ceph-keyring-placement {{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} securityContext: @@ -94,13 +94,13 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - {{- if include "cinder.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} - name: STORAGE_BACKEND - value: {{ index (index .Values.conf.backends (include "cinder.ceph_volume_section_name" $envAll)) "volume_driver" | quote }} + value: {{ index (index .Values.conf.backends (include "cinder.utils.ceph_volume_section_name" $envAll)) "volume_driver" | quote }} - name: RBD_POOL_NAME - value: {{ index (index .Values.conf.backends (include "cinder.ceph_volume_section_name" $envAll)) "rbd_pool" | quote }} + value: {{ index (index .Values.conf.backends (include "cinder.utils.ceph_volume_section_name" $envAll)) "rbd_pool" | quote }} - name: RBD_POOL_USER - value: {{ index (index .Values.conf.backends (include "cinder.ceph_volume_section_name" $envAll)) "rbd_user" | quote }} + value: {{ index (index .Values.conf.backends (include "cinder.utils.ceph_volume_section_name" $envAll)) "rbd_user" | quote }} - name: RBD_POOL_CRUSH_RULE value: {{ .Values.conf.ceph.pools.volume.crush_rule | quote }} - name: RBD_POOL_REPLICATION @@ -117,7 +117,7 @@ spec: mountPath: /tmp/storage-init.sh subPath: storage-init.sh readOnly: true - {{- if include "cinder.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} - name: etcceph mountPath: /etc/ceph - name: ceph-etc @@ -136,7 +136,7 @@ spec: configMap: name: cinder-bin defaultMode: 0555 - {{- if include "cinder.is_ceph_volume_configured" $envAll }} + {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} - name: etcceph emptyDir: {} - name: ceph-etc diff --git a/cinder/templates/_funcs.tpl b/cinder/templates/utils/_ceph_volume_section_name.tpl similarity index 71% rename from cinder/templates/_funcs.tpl rename to cinder/templates/utils/_ceph_volume_section_name.tpl index 785ee254..af16d6a9 100644 --- a/cinder/templates/_funcs.tpl +++ b/cinder/templates/utils/_ceph_volume_section_name.tpl @@ -14,17 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- define "cinder.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 -}} - -{{- define "cinder.ceph_volume_section_name" -}} +{{- define "cinder.utils.ceph_volume_section_name" -}} {{- range $section, $values := .Values.conf.backends -}} {{- if kindIs "map" $values -}} {{- if eq $values.volume_driver "cinder.volume.drivers.rbd.RBDDriver" -}} diff --git a/cinder/templates/utils/_is_ceph_volume_configured.tpl b/cinder/templates/utils/_is_ceph_volume_configured.tpl new file mode 100644 index 00000000..63f2a73a --- /dev/null +++ b/cinder/templates/utils/_is_ceph_volume_configured.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.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 -}}