improwised-charts/charts/erpnext/templates/job-backup-sites.yaml

63 lines
1.9 KiB
YAML

{{- if .Values.migrateJob.backup }}
apiVersion: batch/v1
kind: Job
metadata:
name: backup-sites-{{ template "erpnext.fullname" . }}-{{ date "20060102150405" .Release.Now }}
labels:
{{- include "erpnext.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
backoffLimit: 1
template:
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "erpnext.serviceAccountName" $ }}
securityContext:
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
containers:
- name: backup
image: "{{ .Values.pythonImage.repository }}:{{ .Values.pythonImage.tag }}"
args: ["backup"]
imagePullPolicy: {{ .Values.pythonImage.pullPolicy }}
env:
- name: "WITH_FILES"
value: "1"
securityContext:
{{- toYaml $.Values.securityContext | nindent 12 }}
volumeMounts:
- name: sites-dir
mountPath: /home/frappe/frappe-bench/sites
restartPolicy: Never
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: sites-dir
{{- if .Values.persistence.worker.enabled }}
persistentVolumeClaim:
{{- if .Values.persistence.worker.existingClaim }}
claimName: {{ .Values.persistence.worker.existingClaim }}
{{- else }}
claimName: {{ template "erpnext.fullname" . }}
{{- end }}
readOnly: false
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}