Skip to content

Commit d7c42e8

Browse files
onlymellbweekface
onlymellb
authored andcommitted
support restore tidb cluster from a specified scheduled backup dir (#804)
1 parent fb130f1 commit d7c42e8

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

charts/tidb-backup/templates/restore-job.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ spec:
3939
{{- end }}
4040
env:
4141
- name: BACKUP_NAME
42-
value: {{ .Values.name | quote }}
42+
value: {{ .Values.scheduledBackupName | default .Values.name | quote }}
4343
{{- if .Values.gcp }}
4444
- name: GOOGLE_APPLICATION_CREDENTIALS
4545
value: /gcp/credentials.json
@@ -69,10 +69,14 @@ spec:
6969
volumes:
7070
- name: data
7171
persistentVolumeClaim:
72+
{{- if .Values.scheduledBackupName }}
73+
claimName: {{ .Values.clusterName }}-scheduled-backup
74+
{{- else }}
7275
claimName: {{ .Values.name }}
76+
{{- end }}
7377
{{- if .Values.gcp }}
7478
- name: gcp-credentials
7579
secret:
7680
secretName: {{ .Values.gcp.secretName }}
7781
{{- end }}
78-
{{- end }}
82+
{{- end -}}

charts/tidb-backup/values.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66
clusterName: demo
77

88
mode: backup # backup | restore | scheduled-restore
9-
# name is the backup name
9+
10+
# name is the backup dir name and pvc name for ad-hoc backup and restore
1011
name: fullbackup-{{ date "200601021504" .Release.Time }}
12+
13+
# scheduledBackupName is the name of a scheduled backup directory,
14+
# used to restore the tidb cluster from scheduled backup.
15+
# scheduledBackupName: scheduled-backup-20190822-041004
16+
1117
image:
1218
pullPolicy: IfNotPresent
1319
# https://github.com/pingcap/tidb-cloud-backup
@@ -81,4 +87,4 @@ s3: {}
8187
# secretName is the name of the secret which stores s3 object store access key and secret key
8288
# You can create the secret by:
8389
# kubectl create secret generic s3-backup-secret --namespace=<namespace> --from-literal=access_key=<access-key> --from-literal=secret_key=<secret-key>
84-
# secretName: s3-backup-secret
90+
# secretName: s3-backup-secret

0 commit comments

Comments
 (0)