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 * * * *"
|
2022-11-09 16:08:22 +00:00
|
|
|
concurrencyPolicy: "Replace"
|
2021-12-01 12:35:18 +00:00
|
|
|
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
|
2022-04-08 20:11:36 +00:00
|
|
|
image: "{{ .Values.clusterBackup.image.name }}:{{ default .Chart.AppVersion .Values.clusterBackup.image.tag }}"
|
2021-12-01 12:35:18 +00:00
|
|
|
imagePullPolicy: Always
|
|
|
|
command: ["kubezero.sh"]
|
|
|
|
args:
|
|
|
|
- backup
|
|
|
|
volumeMounts:
|
|
|
|
- name: host
|
|
|
|
mountPath: /host
|
2024-04-15 13:25:01 +00:00
|
|
|
#readOnly: true
|
2021-12-01 12:35:18 +00:00
|
|
|
- name: workdir
|
|
|
|
mountPath: /tmp
|
2024-03-22 17:04:41 +00:00
|
|
|
env:
|
2021-12-01 12:35:18 +00:00
|
|
|
- name: DEBUG
|
2022-08-24 15:13:39 +00:00
|
|
|
value: ""
|
2021-12-01 12:35:18 +00:00
|
|
|
- name: RESTIC_REPOSITORY
|
2024-03-22 17:04:41 +00:00
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
2021-12-01 12:35:18 +00:00
|
|
|
name: kubezero-backup-restic
|
|
|
|
key: repository
|
|
|
|
- name: RESTIC_PASSWORD
|
2024-03-22 17:04:41 +00:00
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
2021-12-01 12:35:18 +00:00
|
|
|
name: kubezero-backup-restic
|
2024-03-22 17:04:41 +00:00
|
|
|
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: ""
|
2023-10-02 12:57:25 +00:00
|
|
|
priorityClassName: system-cluster-critical
|
2021-12-01 12:35:18 +00:00
|
|
|
tolerations:
|
2022-10-27 12:27:42 +00:00
|
|
|
- key: node-role.kubernetes.io/control-plane
|
|
|
|
effect: NoSchedule
|
2021-12-01 12:35:18 +00:00
|
|
|
restartPolicy: Never
|
|
|
|
{{- end }}
|