feat: add template common.cronJob

This commit is contained in:
Chi-En Wu
2020-04-20 16:38:09 +08:00
parent 6fbe885937
commit bddaab6942

34
templates/_cronjob.yaml Normal file
View File

@ -0,0 +1,34 @@
{{/* vim: set filetype=mustache: */}}
{{- define "common.cronJob.pod" -}}
spec:
restartPolicy: OnFailure
{{- end -}}
{{- define "common.cronJob.tpl" -}}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
{{ include "common.metadata" . | nindent 2 }}
spec:
schedule: "{{ .Values.cronJob.schedule }}"
{{- with .Values.cronJob.concurrencyPolicy }}
concurrencyPolicy: {{ . }}
{{- end }}
{{- with .Values.cronJob.failedJobsHistoryLimit }}
failedJobsHistoryLimit: {{ . }}
{{- end }}
{{- with .Values.cronJob.successfulJobsHistoryLimit }}
successfulJobsHistoryLimit: {{ . }}
{{- end }}
jobTemplate:
metadata:
{{ include "common.metadata" . | nindent 6 }}
spec:
template:
{{ include "common.pod-template" (list . "common.cronJob.pod") | nindent 8 }}
{{- end -}}
{{- define "common.cronJob" -}}
{{- include "common.utils.flattenCall" (list "common.utils.merge" . "common.cronJob.tpl") -}}
{{- end -}}