_jobValidation.tpl 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. {{/* Job Validation */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.lib.workload.jobValidation" (dict "objectData" $objectData) -}}
  4. rootCtx: The root context of the chart.
  5. objectData:
  6. completionMode: The completionMode of the object.
  7. completions: The completions of the object.
  8. parallelism: The parallelism of the object.
  9. */}}
  10. {{- define "ix.v1.common.lib.workload.jobValidation" -}}
  11. {{- $objectData := .objectData -}}
  12. {{- if $objectData.completionMode -}}
  13. {{- $completionMode := $objectData.completionMode -}}
  14. {{- if not (mustHas $completionMode (list "Indexed" "NonIndexed")) -}}
  15. {{- fail (printf "Job - Expected <completionMode> to be one of [Indexed, NonIndexed], but got [%v]" $completionMode) -}}
  16. {{- end -}}
  17. {{- if eq $completionMode "Indexed" -}}
  18. {{- if not $objectData.completions -}}
  19. {{- fail "Job - Expected <completions> to be set when <completionMode> is set to [Indexed]" -}}
  20. {{- end -}}
  21. {{- if not $objectData.parallelism -}}
  22. {{- fail "Job - Expected <parallelism> to be set when <completionMode> is set to [Indexed]" -}}
  23. {{- end -}}
  24. {{- end -}}
  25. {{- end -}}
  26. {{- end -}}