60 lines
2.0 KiB
YAML
60 lines
2.0 KiB
YAML
{{- if .Values.cronjob.enabled -}}
|
|
apiVersion: batch/v1
|
|
kind: CronJob
|
|
metadata:
|
|
name: purge-files
|
|
labels:
|
|
{{- include "gateway.labels" . | nindent 4 }}
|
|
app.kubernetes.io/component: cronjob
|
|
spec:
|
|
schedule: "{{ .Values.cronjob.schedule }}"
|
|
jobTemplate:
|
|
spec:
|
|
ttlSecondsAfterFinished: {{ .Values.cronjob.job_ttl }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "gateway.labels" . | nindent 12 }}
|
|
app.kubernetes.io/component: cronjob
|
|
spec:
|
|
{{- with .Values.global.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: purge-files-job
|
|
image: {{ default .Values.global.initContainers.image .Values.cronjob.image | quote }}
|
|
args:
|
|
- /bin/sh
|
|
- -c
|
|
- echo "purging event files older than {{ .Values.cronjob.older_than }}"; find /events -type f -mtime {{ .Values.cronjob.older_than }} -exec rm -rf {} \;
|
|
volumeMounts:
|
|
- name: eventsvol
|
|
mountPath: "/events"
|
|
{{- with .Values.global.initContainers.resources }}
|
|
resources:
|
|
{{ toYaml . | nindent 14 }}
|
|
{{- end }}
|
|
{{- with .Values.global.initContainers.securityContext }}
|
|
securityContext:
|
|
{{- toYaml . | nindent 14 }}
|
|
{{- end }}
|
|
restartPolicy: OnFailure
|
|
volumes:
|
|
- name: eventsvol
|
|
persistentVolumeClaim:
|
|
claimName: {{ .Values.cronjob.claimName }}
|
|
{{- with .Values.cronjob.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.cronjob.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.cronjob.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- end }}
|