Merge "Cinder replace is_ceph_volume_configured"

This commit is contained in:
Zuul 2019-06-22 19:32:30 +00:00 committed by Gerrit Code Review
commit 215c82f18c
5 changed files with 21 additions and 21 deletions

8
cinder/templates/deployment-backup.yaml Normal file → Executable file
View File

@ -78,7 +78,7 @@ spec:
subPath: key subPath: key
readOnly: true readOnly: true
{{ end }} {{ end }}
{{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.has_ceph_backend" $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:
@ -162,7 +162,7 @@ spec:
subPath: {{ base .Values.conf.cinder.DEFAULT.log_config_append }} subPath: {{ base .Values.conf.cinder.DEFAULT.log_config_append }}
readOnly: true readOnly: true
{{- end }} {{- end }}
{{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }} {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.has_ceph_backend" $envAll) }}
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
{{- if not .Values.backup.external_ceph_rbd.enabled }} {{- if not .Values.backup.external_ceph_rbd.enabled }}
@ -227,7 +227,7 @@ spec:
configMap: configMap:
name: cinder-bin name: cinder-bin
defaultMode: 0555 defaultMode: 0555
{{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }} {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.has_ceph_backend" $envAll) }}
- name: etcceph - name: etcceph
emptyDir: {} emptyDir: {}
- name: ceph-etc - name: ceph-etc
@ -240,7 +240,7 @@ spec:
secret: secret:
secretName: {{ .Values.secrets.rbd.backup | quote }} secretName: {{ .Values.secrets.rbd.backup | quote }}
{{ end }} {{ end }}
{{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.has_ceph_backend" $envAll }}
- name: ceph-keyring - name: ceph-keyring
secret: secret:
secretName: {{ .Values.secrets.rbd.volume | quote }} secretName: {{ .Values.secrets.rbd.volume | quote }}

6
cinder/templates/deployment-volume.yaml Normal file → Executable file
View File

@ -54,7 +54,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.utils.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.has_ceph_backend" $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:
@ -153,7 +153,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.utils.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.has_ceph_backend" $envAll }}
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
- name: ceph-etc - name: ceph-etc
@ -206,7 +206,7 @@ spec:
secret: secret:
secretName: cinder-etc secretName: cinder-etc
defaultMode: 0444 defaultMode: 0444
{{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.has_ceph_backend" $envAll }}
- name: etcceph - name: etcceph
emptyDir: {} emptyDir: {}
- name: pod-shared - name: pod-shared

4
cinder/templates/job-clean.yaml Normal file → Executable file
View File

@ -16,7 +16,7 @@ limitations under the License.
{{- if .Values.manifests.job_clean }} {{- if .Values.manifests.job_clean }}
{{- $envAll := . }} {{- $envAll := . }}
{{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.is_ceph_volume_configured" $envAll) }} {{ if or (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) (include "cinder.utils.has_ceph_backend" $envAll) }}
{{- $serviceAccountName := print "cinder-clean" }} {{- $serviceAccountName := print "cinder-clean" }}
{{ tuple $envAll "clean" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} {{ tuple $envAll "clean" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
@ -68,7 +68,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.utils.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.has_ceph_backend" $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 }}

8
cinder/templates/job-storage-init.yaml Normal file → Executable file
View File

@ -65,7 +65,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.utils.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.has_ceph_backend" $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:
@ -97,7 +97,7 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
{{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.has_ceph_backend" $envAll }}
- name: STORAGE_BACKEND - name: STORAGE_BACKEND
value: {{ index (index .Values.conf.backends (include "cinder.utils.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
@ -124,7 +124,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.utils.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.has_ceph_backend" $envAll }}
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
- name: ceph-etc - name: ceph-etc
@ -145,7 +145,7 @@ spec:
configMap: configMap:
name: cinder-bin name: cinder-bin
defaultMode: 0555 defaultMode: 0555
{{- if include "cinder.utils.is_ceph_volume_configured" $envAll }} {{- if include "cinder.utils.has_ceph_backend" $envAll }}
- name: etcceph - name: etcceph
emptyDir: {} emptyDir: {}
- name: ceph-etc - name: ceph-etc

View File

@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- define "cinder.utils.is_ceph_volume_configured" -}} {{- define "cinder.utils.has_ceph_backend" -}}
{{- range $section, $values := .Values.conf.backends -}} {{- $has_ceph := false -}}
{{- if kindIs "map" $values -}} {{- range $_, $backend := .Values.conf.backends -}}
{{- if eq $values.volume_driver "cinder.volume.drivers.rbd.RBDDriver" -}} {{- if kindIs "map" $backend -}}
true {{- $has_ceph = or $has_ceph (eq $backend.volume_driver "cinder.volume.drivers.rbd.RBDDriver") -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- $has_ceph -}}
{{- end -}} {{- end -}}