_deploymentValidation.tpl 1.0 KB

123456789101112131415161718192021222324252627282930
  1. {{/* Deployment Validation */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.lib.workload.deploymentValidation" (dict "objectData" $objectData) -}}
  4. rootCtx: The root context of the chart.
  5. objectData:
  6. strategy: The strategy of the object.
  7. rollingUpdate: The rollingUpdate of the object.
  8. */}}
  9. {{- define "ix.v1.common.lib.workload.deploymentValidation" -}}
  10. {{- $objectData := .objectData -}}
  11. {{- if $objectData.strategy -}}
  12. {{- $strategy := $objectData.strategy -}}
  13. {{- $strategies := (list "Recreate" "RollingUpdate") -}}
  14. {{- if not (mustHas $strategy $strategies) -}}
  15. {{- fail (printf "Deployment - Expected <strategy> to be one of [%s], but got [%v]" (join ", " $strategies) $strategy) -}}
  16. {{- end -}}
  17. {{- end -}}
  18. {{- if $objectData.rollingUpdate -}}
  19. {{- $rollUp := $objectData.rollingUpdate -}}
  20. {{- if and $rollUp (not (kindIs "map" $rollUp)) -}}
  21. {{- fail (printf "Deployment - Expected <rollingUpdate> to be a dictionary, but got [%v]" (kindOf $rollUp)) -}}
  22. {{- end -}}
  23. {{- end -}}
  24. {{- end -}}