Skip to content

Commit

Permalink
tidb-backup: add restoreUsingExistingVolume option (#1708)
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyguava authored Feb 17, 2020
1 parent fe3c3ee commit b4cda09
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion charts/tidb-backup/templates/backup-pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{{- if (or (eq .Values.mode "backup") (eq .Values.mode "scheduled-restore")) }}
{{- if (or (eq .Values.mode "backup") (eq .Values.mode "scheduled-restore") (and (eq .Values.mode "restore") (not .Values.restoreUsingExistingVolume))) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
{{- if eq .Values.mode "restore" }}
name: restore-{{ tpl .Values.name . }}
{{- else }}
name: {{ tpl .Values.name . }}
{{- end }}
labels:
app.kubernetes.io/name: {{ template "chart.name" . }}
app.kubernetes.io/managed-by: tidb-operator
Expand Down
4 changes: 3 additions & 1 deletion charts/tidb-backup/templates/restore-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ spec:
volumes:
- name: data
persistentVolumeClaim:
{{- if .Values.scheduledBackupName }}
{{- if not .Values.restoreUsingExistingVolume }}
claimName: restore-{{ .Values.name }}
{{- else if .Values.scheduledBackupName }}
claimName: {{ .Values.name }}-scheduled-backup
{{- else }}
claimName: {{ .Values.name }}
Expand Down
5 changes: 5 additions & 0 deletions charts/tidb-backup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ restoreOptions: "-t 16"
# When a GC happens, the current time minus this value is the safe point.
tikvGCLifeTime: 720h

# By default, restores are performed by binding to an existing volume containing backup data.
# To restore from gcp, ceph, or s3, set this to false to create a new volume to load the backup into
# This setting only affects the "restore" mode.
restoreUsingExistingVolume: true

# By default, the backup/restore uses PV to store/load backup data
# You can choose to store/load backup data to/from gcp, ceph or s3 bucket by enabling the following corresponding section:

Expand Down

0 comments on commit b4cda09

Please sign in to comment.