Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidb-backup: add restoreUsingExistingVolume option #1708

Merged
merged 2 commits into from
Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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