{{- if .Values.mu_cron.enabled }} apiVersion: batch/v1beta1 kind: CronJob metadata: name: {{ template "wordpress.fullname" . }} labels: app: {{ include "wordpress.name" . }} chart: {{ include "wordpress.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} annotations: {{ toYaml .Values.mu_cron.cronjob.annotations | indent 4 }} spec: schedule: "{{ .Values.mu_cron.cronjob.schedule }}" concurrencyPolicy: Forbid {{- with .Values.mu_cron.cronjob.failedJobsHistoryLimit }} failedJobsHistoryLimit: {{ . }} {{- end }} {{- with .Values.mu_cron.cronjob.successfulJobsHistoryLimit }} successfulJobsHistoryLimit: {{ . }} {{- end }} jobTemplate: metadata: labels: app.kubernetes.io/name: {{ include "wordpress.name" . }} app.kubernetes.io/managed-by: {{ .Release.Service }} spec: template: metadata: labels: app.kubernetes.io/name: {{ include "wordpress.name" . }} app.kubernetes.io/managed-by: {{ .Release.Service }} spec: restartPolicy: Never {{- if (default .Values.image.pullSecrets .Values.mu_cron.cronjob.image.pullSecrets) }} imagePullSecrets: {{- range (default .Values.image.pullSecrets .Values.mu_cron.cronjob.image.pullSecrets) }} - name: {{ . }} {{- end }} {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ default .Values.image.repository .Values.mu_cron.cronjob.image.repository }}:{{ default .Values.image.tag .Values.mu_cron.cronjob.image.tag }}" imagePullPolicy: {{ default .Values.image.pullPolicy .Values.mu_cron.cronjob.image.pullPolicy }} command: [ "curl" ] args: {{- if .Values.mu_cron.cronjob.curlInsecure }} - "-k" {{- end }} - "--fail" - "-L" # TODO: How do I send the secret? - "http://{{ .Release.Service }}/{{ .Values.mu_cron.cronjob.path }}" resources: {{ toYaml (default .Values.resources .Values.mu_cron.cronjob.resources) | indent 16 }} {{- with (default .Values.nodeSelector .Values.mu_cron.cronjob.nodeSelector) }} nodeSelector: {{ toYaml . | indent 12 }} {{- end }} {{- with (default .Values.affinity .Values.mu_cron.cronjob.affinity) }} affinity: {{ toYaml . | indent 12 }} {{- end }} {{- with (default .Values.tolerations .Values.mu_cron.cronjob.tolerations) }} tolerations: {{ toYaml . | indent 12 }}: {{- end }} {{- end }}