mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
50 lines
2 KiB
Smarty
50 lines
2 KiB
Smarty
{{/*
|
|
This template serves as a blueprint for Cronjob objects that are created
|
|
using the common library.
|
|
*/}}
|
|
{{- define "bjw-s.common.class.cronjob" -}}
|
|
{{- $rootContext := .rootContext -}}
|
|
{{- $cronjobObject := .object -}}
|
|
|
|
{{- $labels := merge
|
|
(dict "app.kubernetes.io/component" $cronjobObject.identifier)
|
|
($cronjobObject.labels | default dict)
|
|
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
|
-}}
|
|
{{- $annotations := merge
|
|
($cronjobObject.annotations | default dict)
|
|
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
|
-}}
|
|
---
|
|
apiVersion: batch/v1
|
|
kind: CronJob
|
|
metadata:
|
|
name: {{ $cronjobObject.name }}
|
|
{{- with $labels }}
|
|
labels: {{- toYaml . | nindent 4 -}}
|
|
{{- end }}
|
|
{{- with $annotations }}
|
|
annotations: {{- toYaml . | nindent 4 -}}
|
|
{{- end }}
|
|
spec:
|
|
concurrencyPolicy: "{{ $cronjobObject.cronjob.concurrencyPolicy }}"
|
|
startingDeadlineSeconds: {{ $cronjobObject.cronjob.startingDeadlineSeconds }}
|
|
schedule: "{{ $cronjobObject.cronjob.schedule }}"
|
|
successfulJobsHistoryLimit: {{ $cronjobObject.cronjob.successfulJobsHistory }}
|
|
failedJobsHistoryLimit: {{ $cronjobObject.cronjob.failedJobsHistory }}
|
|
jobTemplate:
|
|
spec:
|
|
{{- with $cronjobObject.cronjob.ttlSecondsAfterFinished }}
|
|
ttlSecondsAfterFinished: {{ . }}
|
|
{{- end }}
|
|
backoffLimit: {{ $cronjobObject.cronjob.backoffLimit }}
|
|
template:
|
|
metadata:
|
|
{{- with (include "bjw-s.common.lib.pod.metadata.annotations" (dict "rootContext" $rootContext "controllerObject" $cronjobObject)) }}
|
|
annotations: {{ . | nindent 12 }}
|
|
{{- end -}}
|
|
{{- with (include "bjw-s.common.lib.pod.metadata.labels" (dict "rootContext" $rootContext "controllerObject" $cronjobObject)) }}
|
|
labels: {{ . | nindent 12 }}
|
|
{{- end }}
|
|
spec: {{ include "bjw-s.common.lib.pod.spec" (dict "rootContext" $rootContext "controllerObject" $cronjobObject) | nindent 10 }}
|
|
{{- end -}}
|