Merge "[Cinder] Gotpl script fix"

This commit is contained in:
Zuul 2020-02-13 20:41:01 +00:00 committed by Gerrit Code Review
commit 040e6aa23a
2 changed files with 3 additions and 8 deletions

View File

@ -90,7 +90,7 @@ spec:
{{ end }} {{ end }}
containers: containers:
{{- range $name, $backend := .Values.conf.backends }} {{- range $name, $backend := .Values.conf.backends }}
{{- if kindIs "map" $backend }} {{- if (eq "true" ( dict "backend" $backend | include "cinder.utils.is_ceph_backend" )) }}
- name: cinder-storage-init-{{$name}} - name: cinder-storage-init-{{$name}}
{{ 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.storage_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.storage_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
@ -99,7 +99,6 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
{{- if include "cinder.utils.is_ceph_backend" $backend }}
- name: STORAGE_BACKEND - name: STORAGE_BACKEND
value: {{ $backend.volume_driver | quote }} value: {{ $backend.volume_driver | quote }}
- name: RBD_POOL_NAME - name: RBD_POOL_NAME
@ -116,7 +115,6 @@ spec:
value: {{ (index $envAll.Values.conf.ceph.pools $backend.rbd_pool).chunk_size | quote }} value: {{ (index $envAll.Values.conf.ceph.pools $backend.rbd_pool).chunk_size | quote }}
- name: RBD_POOL_SECRET - name: RBD_POOL_SECRET
value: {{ $envAll.Values.secrets.rbd.volume | quote }} value: {{ $envAll.Values.secrets.rbd.volume | quote }}
{{- end }}
command: command:
- /tmp/storage-init.sh - /tmp/storage-init.sh
volumeMounts: volumeMounts:
@ -126,7 +124,6 @@ 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_backend" $backend }}
- name: etcceph - name: etcceph
mountPath: /etc/ceph mountPath: /etc/ceph
- name: ceph-etc - name: ceph-etc
@ -139,7 +136,6 @@ spec:
subPath: key subPath: key
readOnly: true readOnly: true
{{- end }} {{- end }}
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
volumes: volumes:

View File

@ -15,7 +15,6 @@ limitations under the License.
*/}} */}}
{{- define "cinder.utils.is_ceph_backend" -}} {{- define "cinder.utils.is_ceph_backend" -}}
{{- if kindIs "map" . -}} {{- $backend := index . "backend" -}}
{{- eq .volume_driver "cinder.volume.drivers.rbd.RBDDriver" -}} {{- printf "%v" (and ( kindIs "map" $backend ) ( eq $backend.volume_driver "cinder.volume.drivers.rbd.RBDDriver" )) -}}
{{- end -}}
{{- end -}} {{- end -}}