helm-charts/charts/library/common/templates/render/_pvcs.tpl
Bernd Schorgers a548690b00
feat(common): Release v2.5.0 (#258)
Co-authored-by: Maurits <75321636+maurits-funda@users.noreply.github.com>
Co-authored-by: Noam Lerner <bugok@users.noreply.github.com>
2024-01-16 20:28:41 +00:00

26 lines
1.1 KiB
Smarty

{{/*
Renders the Persistent Volume Claim objects required by the chart.
*/}}
{{- define "bjw-s.common.render.pvcs" -}}
{{- /* Generate pvc as required */ -}}
{{- range $key, $pvc := .Values.persistence -}}
{{- /* Enable PVC by default, but allow override */ -}}
{{- $pvcEnabled := true -}}
{{- if hasKey $pvc "enabled" -}}
{{- $pvcEnabled = $pvc.enabled -}}
{{- end -}}
{{- if and $pvcEnabled (eq (default "persistentVolumeClaim" $pvc.type) "persistentVolumeClaim") (not $pvc.existingClaim) -}}
{{- $pvcValues := (mustDeepCopy $pvc) -}}
{{- /* Create object from the raw PVC values */ -}}
{{- $pvcObject := (include "bjw-s.common.lib.pvc.valuesToObject" (dict "rootContext" $ "id" $key "values" $pvcValues)) | fromYaml -}}
{{- /* Perform validations on the PVC before rendering */ -}}
{{- include "bjw-s.common.lib.pvc.validate" (dict "rootContext" $ "object" $pvcValues) -}}
{{- /* Include the PVC class */ -}}
{{- include "bjw-s.common.class.pvc" (dict "rootContext" $ "object" $pvcValues) | nindent 0 -}}
{{- end -}}
{{- end -}}
{{- end -}}