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 <pete@port.direct>
This commit is contained in:
Pete Birley
2018-06-13 17:43:47 -05:00
parent f0937065ed
commit 641cc4a15a
6 changed files with 44 additions and 29 deletions

View File

@@ -67,7 +67,7 @@ spec:
subPath: key subPath: key
readOnly: true readOnly: true
{{ end }} {{ end }}
{{- if include "cinder.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }}
- name: ceph-keyring-placement - name: ceph-keyring-placement
{{ tuple $envAll "cinder_backup" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "cinder_backup" | include "helm-toolkit.snippets.image" | indent 10 }}
securityContext: securityContext:
@@ -76,7 +76,7 @@ spec:
- /tmp/ceph-keyring.sh - /tmp/ceph-keyring.sh
env: env:
- name: RBD_USER - 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: volumeMounts:
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
@@ -137,7 +137,7 @@ spec:
mountPath: /etc/cinder/cinder.conf mountPath: /etc/cinder/cinder.conf
subPath: cinder.conf subPath: cinder.conf
readOnly: true 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 - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
- name: ceph-etc - name: ceph-etc
@@ -186,7 +186,7 @@ spec:
configMap: configMap:
name: cinder-bin name: cinder-bin
defaultMode: 0555 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 - name: etcceph
emptyDir: {} emptyDir: {}
- name: ceph-etc - name: ceph-etc
@@ -199,7 +199,7 @@ spec:
secret: secret:
secretName: {{ .Values.secrets.rbd.backup | quote }} secretName: {{ .Values.secrets.rbd.backup | quote }}
{{ end }} {{ end }}
{{- if include "cinder.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }}
- name: ceph-keyring - name: ceph-keyring
secret: secret:
secretName: {{ .Values.secrets.rbd.volume | quote }} secretName: {{ .Values.secrets.rbd.volume | quote }}

View File

@@ -45,7 +45,7 @@ spec:
{{ .Values.labels.volume.node_selector_key }}: {{ .Values.labels.volume.node_selector_value }} {{ .Values.labels.volume.node_selector_key }}: {{ .Values.labels.volume.node_selector_value }}
initContainers: initContainers:
{{ tuple $envAll "volume" $mounts_cinder_volume_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} {{ 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 - name: ceph-keyring-placement
{{ tuple $envAll "cinder_volume" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "cinder_volume" | include "helm-toolkit.snippets.image" | indent 10 }}
securityContext: securityContext:
@@ -54,7 +54,7 @@ spec:
- /tmp/ceph-keyring.sh - /tmp/ceph-keyring.sh
env: env:
- name: RBD_USER - 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: volumeMounts:
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
@@ -102,7 +102,7 @@ spec:
mountPath: /etc/cinder/conf/backends.conf mountPath: /etc/cinder/conf/backends.conf
subPath: backends.conf subPath: backends.conf
readOnly: true readOnly: true
{{- if include "cinder.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }}
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
- name: ceph-etc - name: ceph-etc
@@ -152,7 +152,7 @@ spec:
- name: cinder-etc - name: cinder-etc
configMap: configMap:
name: cinder-etc name: cinder-etc
{{- if include "cinder.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }}
- name: etcceph - name: etcceph
emptyDir: {} emptyDir: {}
- name: ceph-etc - name: ceph-etc

View File

@@ -16,7 +16,7 @@ limitations under the License.
{{- if .Values.manifests.job_clean }} {{- if .Values.manifests.job_clean }}
{{- $envAll := . }} {{- $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 }} {{- $randStringSuffix := randAlphaNum 5 | lower }}
@@ -69,7 +69,7 @@ spec:
initContainers: initContainers:
{{ tuple $envAll "clean" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} {{ tuple $envAll "clean" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers: containers:
{{- if include "cinder.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }}
- name: cinder-volume-rbd-secret-clean - name: cinder-volume-rbd-secret-clean
{{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} {{ 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 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.clean | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}

View File

@@ -64,7 +64,7 @@ spec:
{{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
initContainers: initContainers:
{{ tuple $envAll "storage_init" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} {{ 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 - name: ceph-keyring-placement
{{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }}
securityContext: securityContext:
@@ -94,13 +94,13 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
{{- if include "cinder.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }}
- name: STORAGE_BACKEND - 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 - 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 - 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 - name: RBD_POOL_CRUSH_RULE
value: {{ .Values.conf.ceph.pools.volume.crush_rule | quote }} value: {{ .Values.conf.ceph.pools.volume.crush_rule | quote }}
- name: RBD_POOL_REPLICATION - name: RBD_POOL_REPLICATION
@@ -117,7 +117,7 @@ spec:
mountPath: /tmp/storage-init.sh mountPath: /tmp/storage-init.sh
subPath: storage-init.sh subPath: storage-init.sh
readOnly: true readOnly: true
{{- if include "cinder.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }}
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
- name: ceph-etc - name: ceph-etc
@@ -136,7 +136,7 @@ spec:
configMap: configMap:
name: cinder-bin name: cinder-bin
defaultMode: 0555 defaultMode: 0555
{{- if include "cinder.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.is_ceph_volume_configured" $envAll }}
- name: etcceph - name: etcceph
emptyDir: {} emptyDir: {}
- name: ceph-etc - name: ceph-etc

View File

@@ -14,17 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- define "cinder.is_ceph_volume_configured" -}} {{- 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" -}}
true
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- define "cinder.ceph_volume_section_name" -}}
{{- range $section, $values := .Values.conf.backends -}} {{- range $section, $values := .Values.conf.backends -}}
{{- if kindIs "map" $values -}} {{- if kindIs "map" $values -}}
{{- if eq $values.volume_driver "cinder.volume.drivers.rbd.RBDDriver" -}} {{- if eq $values.volume_driver "cinder.volume.drivers.rbd.RBDDriver" -}}

View File

@@ -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 -}}