_cronjobSpec.tpl 1.6 KB

12345678910111213141516171819202122232425262728293031
  1. {{/* CronJob Spec */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.lib.workload.cronjobSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) -}}
  4. rootCtx: The root context of the chart.
  5. objectData:
  6. schedule: The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
  7. concurrencyPolicy: Allow, Forbid, or Replace. Defaults to Allow.
  8. failedJobsHistoryLimit: The number of failed finished jobs to retain. Defaults to 1.
  9. successfulJobsHistoryLimit: The number of successful finished jobs to retain. Defaults to 3.
  10. startingDeadlineSeconds: Optional deadline in seconds for starting the job if it misses scheduled time for any reason. Defaults to nil.
  11. timezone: The timezone name. Defaults to .Values.TZ
  12. +jobSpec data
  13. */}}
  14. {{- define "ix.v1.common.lib.workload.cronjobSpec" -}}
  15. {{- $objectData := .objectData -}}
  16. {{- $rootCtx := .rootCtx -}}
  17. {{- $suspend := $objectData.suspend | default false -}}
  18. {{- if (include "ix.v1.common.helper.isStopped" $rootCtx) -}}
  19. {{- $suspend = true -}}
  20. {{- end }}
  21. timeZone: {{ (tpl ($objectData.timezone | default $rootCtx.Values.TZ) $rootCtx) | quote }}
  22. schedule: {{ (tpl $objectData.schedule $rootCtx) | quote }}
  23. concurrencyPolicy: {{ $objectData.concurrencyPolicy | default "Forbid" }}
  24. failedJobsHistoryLimit: {{ $objectData.failedJobsHistoryLimit | default 1 }}
  25. successfulJobsHistoryLimit: {{ $objectData.successfulJobsHistoryLimit | default 3 }}
  26. startingDeadlineSeconds: {{ $objectData.startingDeadlineSeconds | default nil }}
  27. suspend: {{ $suspend }}
  28. jobTemplate:
  29. spec:
  30. {{- include "ix.v1.common.lib.workload.jobSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 4 }}
  31. {{- end -}}