Files
chart/library/common/templates/lib/storage/_validation.tpl
Stavros Kois 1e5e1b8ef8 NAS-123350 / 24.04 / Add support in common for nfs/smb pvc (#1422)
* Empty-Commit

* temp commit

* make sure that we use the pv

* typo

* add validation

* typo

* cleanup validation and add secret for smb

* revert

* add some tets

* add more tests

* add more tests

* more tests

* rename to share

* rename

* moar tests

* clean

* add some docs

* fix name uniqueness and tests

* make mountOptions validation a bit better

* update docs
2023-08-24 17:40:31 +03:00

23 lines
948 B
Smarty

{{/* Persistence Validation */}}
{{/* Call this template:
{{ include "ix.v1.common.lib.persistence.validation" (dict "objectData" $objectData) -}}
objectData:
rootCtx: The root context of the chart.
objectData: The persistence object.
*/}}
{{- define "ix.v1.common.lib.persistence.validation" -}}
{{- $rootCtx := .rootCtx -}}
{{- $objectData := .objectData -}}
{{- $types := (list "smb-pv-pvc" "nfs-pv-pvc" "ix-zfs-pvc" "pvc" "emptyDir" "hostPath" "ixVolume" "secret" "configmap" "device") -}}
{{- if not (mustHas $objectData.type $types) -}}
{{- fail (printf "Persistence - Expected <type> to be one of [%s], but got [%s]" (join ", " $types) $objectData.type) -}}
{{- end -}}
{{- if and $objectData.targetSelector (not (kindIs "map" $objectData.targetSelector)) -}}
{{- fail (printf "Persistence - Expected <targetSelector> to be [dict], but got [%s]" (kindOf $objectData.targetSelector)) -}}
{{- end -}}
{{- end -}}