# helm_charts_cron.yaml
{{- if ne .Values.schedule "now" -}}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: {{ template "mysqldump.fullname" . }}
  labels:
{{ include "mysqldump.labels" . | indent 4 }}
spec:
  schedule: "{{ .Values.schedule }}"
  successfulJobsHistoryLimit: {{ .Values.successfulJobsHistoryLimit }}
  failedJobsHistoryLimit: {{ .Values.failedJobsHistoryLimit }}
  concurrencyPolicy: Forbid
  jobTemplate:
    metadata:
      labels:
        app: {{ template "mysqldump.name" . }}
        chart: {{ template "mysqldump.chart" . }}
        cronjob-name: {{ template "mysqldump.fullname" . }}
        release: "{{ .Release.Name }}"
        heritage: "{{ .Release.Service }}"
    spec:
      backoffLimit: 1
      template:
{{- $file := .Files.Get "files/job.tpl" }}
{{ tpl $file . | indent 8 }}
{{ end }}