[Cinder] Gotpl script fix

The gotpl script that determines if a cinder backend is ceph-backed
is not properly handling additional backends that does not have the
driver "cinder.volume.drivers.rbd.RBDDriver". This patch set fixes
the gotpl so it no longer causes a rendering problem.

Change-Id: I902e82301019531832afebce7a1e2f0b28bac8f3
Signed-off-by: Tin Lam <tin@irrational.io>
This commit is contained in:
Tin Lam 2020-02-06 15:27:23 -06:00
parent a7fcc03112
commit 4f1636590a
2 changed files with 3 additions and 8 deletions

View File

@ -90,7 +90,7 @@ spec:
{{ end }}
containers:
{{- 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}}
{{ 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 }}
@ -99,7 +99,6 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if include "cinder.utils.is_ceph_backend" $backend }}
- name: STORAGE_BACKEND
value: {{ $backend.volume_driver | quote }}
- name: RBD_POOL_NAME
@ -116,7 +115,6 @@ spec:
value: {{ (index $envAll.Values.conf.ceph.pools $backend.rbd_pool).chunk_size | quote }}
- name: RBD_POOL_SECRET
value: {{ $envAll.Values.secrets.rbd.volume | quote }}
{{- end }}
command:
- /tmp/storage-init.sh
volumeMounts:
@ -126,7 +124,6 @@ spec:
mountPath: /tmp/storage-init.sh
subPath: storage-init.sh
readOnly: true
{{- if include "cinder.utils.is_ceph_backend" $backend }}
- name: etcceph
mountPath: /etc/ceph
- name: ceph-etc
@ -141,7 +138,6 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
volumes:
- name: pod-tmp
emptyDir: {}

View File

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