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

Restore PVs regardless of the reclaim policy #6850

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

27149chen
Copy link
Contributor

@27149chen 27149chen commented Sep 20, 2023

Please add a summary of your change

This pr want to handle the following use case

  1. alice has two clusters and one storage which is shared by both clusters
  2. alice want to backup a pod+pvc (with Delete policy) in cluster A and restore it to cluster B
  3. no data copy is required, but the field spec.csi.volumeHandle should not be changed, so pv must be restored, not recreated

the solution is:

  1. add an annotaion to the Restore object: velero.io/restore-pvs: pv1,pv2,pv3
  2. When restoring pv, if the pv name appears in above annotaion, restore it regardless of the reclaim policy

Does your change fix a particular issue?

Fixes #6864

Please indicate you've done the following:

  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

Signed-off-by: lou <[email protected]>
@@ -1826,11 +1829,45 @@ func hasPodVolumeBackup(unstructuredPV *unstructured.Unstructured, ctx *restoreC
return found
}

func hasRestorePVAnnotation(unstructuredPV *unstructured.Unstructured, ctx *restoreContext) bool {
annotation, ok := ctx.restore.GetAnnotations()["velero.io/restore-pvs"]
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, moved

@ywk253100
Copy link
Contributor

@27149chen Could you open an issue for this use case and involve more maintainers to discuss?

We have so many different kinds of customization logic to handle different use cases which we try to avoid. If this isn't a common case, we'd like to not introduce such changes.

@27149chen
Copy link
Contributor Author

@27149chen Could you open an issue for this use case and involve more maintainers to discuss?

We have so many different kinds of customization logic to handle different use cases which we try to avoid. If this isn't a common case, we'd like to not introduce such changes.

@ywk253100 issue created: #6864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can not restore PVs with Delete policy for Shared Storages
3 participants