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

refactor backup #301

Merged
merged 12 commits into from
Mar 12, 2019
Merged

refactor backup #301

merged 12 commits into from
Mar 12, 2019

Conversation

tennix
Copy link
Member

@tennix tennix commented Mar 6, 2019

This PR refactors ad-hoc backup charts and uses external secrets to do the backup and restore.

@tennix tennix marked this pull request as ready for review March 7, 2019 02:13
@tennix tennix requested review from weekface, xiaojingchen and gregwebs and removed request for weekface March 7, 2019 02:13
charts/tidb-cluster/values.yaml Outdated Show resolved Hide resolved
charts/tidb-backup/values.yaml Outdated Show resolved Hide resolved
@weekface
Copy link
Contributor

weekface commented Mar 7, 2019

@shuijing198799 PTAL

@gregwebs
Copy link
Contributor

gregwebs commented Mar 7, 2019

The mode parameter is creative :) But maybe it means that backup & restore should be separate charts?

I think the operation guide needs mention of using helm namespacing of ad-hoc backup/restore.

@@ -1,8 +1,8 @@
{{- if .Values.backup.create }}
{{- if eq .Values.mode "backup" }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you validate the mode? Maybe have {{- if neq .Values.mode "restore" && neq .Values.mode "backup" }} ERROR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that should be added. But I can't find any document about fail or error in Helm template.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a fail function. Helm says they have Sprig functions. http://masterminds.github.io/sprig/flow_control.html

gregwebs
gregwebs previously approved these changes Mar 7, 2019
Copy link
Contributor

@gregwebs gregwebs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@tennix
Copy link
Member Author

tennix commented Mar 7, 2019

The backup and restore have a lot of parameters in common, and the chart is really simple. Making it two separate charts is unnecessary.

Modified the variables in `values.yaml` and then create restore job using the following command:

```shell
$ helm install charts/tidb-backup --name=<backup-name> --namespace=${namespace}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one would likely be running this with -set mode=restore rather than modifying that in values.yaml.

Then run the following command to create an ad-hoc backup job:

```shell
$ helm install charts/tidb-backup --name=<backup-name> --namespace=${namespace}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would give an example where the backup name is unique:

helm install charts/tidb-backup --namespace=${namespace} --name=tidb-backup-$(date -u '+%F-%T') 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar for the restore below

@gregwebs
Copy link
Contributor

gregwebs commented Mar 8, 2019

I agree that backup & restore are very similar. I would only make it two separate charts if we can share almost all the files. This could be done with symlinks. But helm charts also support sub-charts and passing values down (we do that for GCP marketplace), which would be another approach.

shuijing198799
shuijing198799 previously approved these changes Mar 11, 2019
@shuijing198799
Copy link
Contributor

GLTM

@tennix
Copy link
Member Author

tennix commented Mar 11, 2019

/run-e2e-tests

1 similar comment
@weekface
Copy link
Contributor

/run-e2e-tests

@tennix
Copy link
Member Author

tennix commented Mar 11, 2019

/run-e2e-tests

Copy link
Contributor

@shuijing198799 shuijing198799 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@xiaojingchen xiaojingchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xiaojingchen xiaojingchen merged commit a3da61d into pingcap:master Mar 12, 2019
yahonda pushed a commit that referenced this pull request Dec 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants