mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 16:37:04 +02:00
Co-authored-by: Maurits <75321636+maurits-funda@users.noreply.github.com> Co-authored-by: Noam Lerner <bugok@users.noreply.github.com>
26 lines
1.1 KiB
Smarty
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 -}}
|