2021-12-01 12:35:18 +00:00
|
|
|
{{- if .Values.clusterBackup.enabled }}
|
|
|
|
apiVersion: batch/v1
|
|
|
|
kind: CronJob
|
|
|
|
metadata:
|
|
|
|
name: kubezero-backup
|
|
|
|
namespace: kube-system
|
|
|
|
spec:
|
|
|
|
schedule: "0 * * * *"
|
|
|
|
jobTemplate:
|
|
|
|
spec:
|
|
|
|
backoffLimit: 1
|
2022-04-08 15:10:17 +00:00
|
|
|
activeDeadlineSeconds: 300
|
2021-12-21 15:05:08 +00:00
|
|
|
ttlSecondsAfterFinished: 3600
|
2021-12-01 12:35:18 +00:00
|
|
|
template:
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: kubezero-admin
|
|
|
|
image: "{{ .Values.clusterBackup.image.name }}:{{ .Values.clusterBackup.image.tag }}"
|
|
|
|
imagePullPolicy: Always
|
|
|
|
command: ["kubezero.sh"]
|
|
|
|
args:
|
|
|
|
- backup
|
|
|
|
volumeMounts:
|
|
|
|
- name: host
|
|
|
|
mountPath: /host
|
|
|
|
- name: workdir
|
|
|
|
mountPath: /tmp
|
|
|
|
env:
|
|
|
|
- name: DEBUG
|
|
|
|
value: "1"
|
|
|
|
- name: RESTIC_REPOSITORY
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: kubezero-backup-restic
|
|
|
|
key: repository
|
|
|
|
- name: RESTIC_PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: kubezero-backup-restic
|
|
|
|
key: password
|
2021-12-03 21:16:22 +00:00
|
|
|
{{- with .Values.clusterBackup.extraEnv }}
|
|
|
|
{{- toYaml . | nindent 12 }}
|
|
|
|
{{- end }}
|
2021-12-01 12:35:18 +00:00
|
|
|
#securityContext:
|
|
|
|
# readOnlyRootFilesystem: true
|
|
|
|
hostNetwork: true
|
|
|
|
volumes:
|
|
|
|
- name: host
|
|
|
|
hostPath:
|
|
|
|
path: /
|
|
|
|
type: Directory
|
|
|
|
- name: workdir
|
|
|
|
emptyDir: {}
|
|
|
|
nodeSelector:
|
|
|
|
node-role.kubernetes.io/control-plane: ""
|
|
|
|
tolerations:
|
|
|
|
- key: node-role.kubernetes.io/master
|
|
|
|
effect: NoSchedule
|
|
|
|
restartPolicy: Never
|
|
|
|
{{- end }}
|