k8s/helm-charts/dashy/charts/common/templates/lib/scaleCertificate/_validation.tpl

19 lines
661 B
Smarty
Raw Normal View History

2023-11-16 19:42:02 +10:00
{{/* Certificate Validation */}}
{{/* Call this template:
{{ include "tc.v1.common.lib.scaleCertificate.validation" (dict "objectData" $objectData) -}}
objectData: The object data of the certificate.
*/}}
{{- define "tc.v1.common.lib.scaleCertificate.validation" -}}
{{- $objectData := .objectData -}}
{{- if not $objectData.id -}}
{{- fail "Certificate - Expected non-empty <id>" -}}
{{- end -}}
{{- if and $objectData.targetSelector (not (kindIs "map" $objectData.targetSelector)) -}}
{{- fail (printf "Certificate - Expected <targetSelector> to be a [map], but got [%s]" (kindOf $objectData.targetSelector)) -}}
{{- end -}}
{{- end -}}