_validation.tpl 874 B

12345678910111213141516171819202122
  1. {{/* Metadata Validation */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" $caller) -}}
  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.metadata.validation" -}}
  10. {{- $objectData := .objectData -}}
  11. {{- $caller := .caller -}}
  12. {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}}
  13. {{- fail (printf "%s - Expected <labels> to be a dictionary, but got [%v]" $caller (kindOf $objectData.labels)) -}}
  14. {{- end -}}
  15. {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}}
  16. {{- fail (printf "%s - Expected <annotations> to be a dictionary, but got [%v]" $caller (kindOf $objectData.annotations)) -}}
  17. {{- end -}}
  18. {{- end -}}