helm-charts/charts/library/common/templates/classes/_cronjob.tpl
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 8f149f7514
feat: Release common version 1.5.0 (#141)
* feat(common): omit replicas field in Deployment if null is given (#134)
* feat(common): Add cron job backoff limit (#137)
* feat(common): add hostPID and hostIPC (#140)

Signed-off-by: Maurits <75321636+maurits-funda@users.noreply.github.com>
Signed-off-by: Gabe Cook <gabe565@gmail.com>
Signed-off-by: Angel Nunez Mencias <git@angelnu.com>
Co-authored-by: Maurits <75321636+maurits-funda@users.noreply.github.com>
Co-authored-by: Gabe Cook <gabe565@gmail.com>
Co-authored-by: Angel Nunez Mencias <git@angelnu.com>
2023-05-08 11:15:49 +02:00

47 lines
1.9 KiB
Smarty

{{/*
This template serves as a blueprint for Cronjob objects that are created
using the common library.
*/}}
{{- define "bjw-s.common.class.cronjob" -}}
{{- $restartPolicy := default "Never" .Values.controller.restartPolicy -}}
{{- if and (ne $restartPolicy "Never") (ne $restartPolicy "OnFailure") -}}
{{- fail (printf "Not a valid restartPolicy for CronJob (%s)" $restartPolicy) -}}
{{- end -}}
{{- $_ := set .Values.controller "restartPolicy" $restartPolicy -}}
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}
{{- with include "bjw-s.common.lib.controller.metadata.labels" . }}
labels: {{- . | nindent 4 }}
{{- end }}
{{- with include "bjw-s.common.lib.controller.metadata.annotations" . }}
annotations: {{- . | nindent 4 }}
{{- end }}
spec:
concurrencyPolicy: "{{ .Values.controller.cronjob.concurrencyPolicy }}"
startingDeadlineSeconds: {{ .Values.controller.cronjob.startingDeadlineSeconds }}
schedule: "{{ .Values.controller.cronjob.schedule }}"
successfulJobsHistoryLimit: {{ .Values.controller.cronjob.successfulJobsHistory }}
failedJobsHistoryLimit: {{ .Values.controller.cronjob.failedJobsHistory }}
jobTemplate:
spec:
{{- with .Values.controller.cronjob.ttlSecondsAfterFinished }}
ttlSecondsAfterFinished: {{ . }}
{{- end }}
backoffLimit: {{ .Values.controller.cronjob.backoffLimit }}
template:
metadata:
{{- with include ("bjw-s.common.lib.metadata.podAnnotations") . }}
annotations:
{{- . | nindent 12 }}
{{- end }}
labels:
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 12 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 12 }}
{{- end }}
spec:
{{- include "bjw-s.common.lib.controller.pod" . | nindent 10 }}
{{- end -}}