30 lines
957 B
YAML
30 lines
957 B
YAML
{{- if .Values.backupJob.enable }}
|
|
# cronjob that creates etcdbackups using the etcd backup serviceaccount
|
|
apiVersion: batch/v1beta1
|
|
kind: CronJob
|
|
metadata:
|
|
name: etcd-backup
|
|
spec:
|
|
schedule: {{ .Values.backupJob.schedule | quote }}
|
|
jobTemplate:
|
|
spec:
|
|
template:
|
|
spec:
|
|
serviceAccountName: {{ include "call-nested" (list . "etcd-operator" "etcd-operator.serviceAccountName") }}
|
|
containers:
|
|
- name: etcd-backup
|
|
image: lachlanevenson/k8s-kubectl
|
|
command:
|
|
- /bin/sh
|
|
- "-ec"
|
|
- |
|
|
sed -e "s|<NOW>|$(date '+%Y-%m-%d_%H:%M:%S')|g" /var/etcd_backup/backup_cr.yaml | kubectl create -f -
|
|
volumeMounts:
|
|
- name: backup-config
|
|
mountPath: /var/etcd_backup
|
|
restartPolicy: OnFailure
|
|
volumes:
|
|
- name: backup-config
|
|
configMap:
|
|
name: backup-config
|
|
{{- end }} |