_validation.tpl 674 B

123456789101112131415161718192021
  1. {{/* Configmap Validation */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.lib.configmap.validation" (dict "objectData" $objectData) -}}
  4. objectData:
  5. labels: The labels of the configmap.
  6. annotations: The annotations of the configmap.
  7. data: The data of the configmap.
  8. */}}
  9. {{- define "ix.v1.common.lib.configmap.validation" -}}
  10. {{- $objectData := .objectData -}}
  11. {{- if not $objectData.data -}}
  12. {{- fail "ConfigMap - Expected non-empty <data>" -}}
  13. {{- end -}}
  14. {{- if not (kindIs "map" $objectData.data) -}}
  15. {{- fail (printf "ConfigMap - Expected <data> to be a dictionary, but got [%v]" (kindOf $objectData.data)) -}}
  16. {{- end -}}
  17. {{- end -}}