_validation.tpl 949 B

123456789101112131415161718192021222324252627
  1. {{/* Configmap Validation */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.lib.imagePullSecret.validation" (dict "objectData" $objectData) -}}
  4. objectData:
  5. labels: The labels of the imagePullSecret.
  6. annotations: The annotations of the imagePullSecret.
  7. data: The data of the imagePullSecret.
  8. */}}
  9. {{- define "ix.v1.common.lib.imagePullSecret.validation" -}}
  10. {{- $objectData := .objectData -}}
  11. {{- if not $objectData.data -}}
  12. {{- fail "Image Pull Secret - Expected non-empty <data>" -}}
  13. {{- end -}}
  14. {{- if not (kindIs "map" $objectData.data) -}}
  15. {{- fail (printf "Image Pull Secret - Expected <data> to be a dictionary, but got [%v]" (kindOf $objectData.data)) -}}
  16. {{- end -}}
  17. {{- range $key := (list "username" "password" "registry" "email") -}}
  18. {{- if not (get $objectData.data $key) -}}
  19. {{- fail (printf "Image Pull Secret - Expected non-empty <%s>" $key) -}}
  20. {{- end -}}
  21. {{- end -}}
  22. {{- end -}}