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

CSI PVC restoring as-is with same original volume handle when VolumeSnapshot is not present with RestorePVs as true #8493

Open
mayankagg9722 opened this issue Dec 6, 2024 · 3 comments
Labels
Area/CSI Related to Container Storage Interface support Restore

Comments

@mayankagg9722
Copy link
Contributor

mayankagg9722 commented Dec 6, 2024

What steps did you take and what happened:

  1. Having CSI dynamic PVC and PVs in the cluster. Performing velero backup with snapshotVolumes: false
  2. Restoring with this backup in the same cluster to different namespace. (performing namespace mapping).

Behaviour during Backup: Volume Snapshot are not taken as snapshotVolumes is set to False, but PVC YAMLs are backed up.

Issue During Restore: During restore velero is also restoring PVC Yamls as-is in the cluster with the same original volume handle, causing conflict if original PVC already exists in the cluster when RestorePVs=true

image

There are 2 different behaviours currently with velero restore:

  1. RestorePVs=false

Here, restore of PVC yaml happens but velero is removing the volumehandle which is leading to new PV getting provisioned in the cluster ( this is the right behaviour).

pvc.Spec.VolumeName = ""

  1. RestorePVs=true

Here, restore of PVC yaml happening with same original volume handle in the cluster and velero is not removing the volumehandle which is leading to PVC provisioning failed (we need to improve this behaviour).

Creation of PVC Yaml during restore:
https://github.com/vmware-tanzu/velero/blob/aa7ca1515926fa029e4d2f4d12e712f5e639a9ef/pkg/restore/restore.go#L1513C3-L1513C33

What did you expect to happen:
We expect volume handle from the PVC should be removed so that dynamic volume creation can happen at the time of restore of PVC YAML even when restored with flag RestorePVs=true when volume snapshot is not present.

Error:

image

Logs:

RestorePVs=false
image

RestorePVs=true

image

Vote on this issue!

This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.

  • 👍 for "I would like to see this bug fixed as soon as possible"
  • 👎 for "There are more important bugs to focus on right now"
@ywk253100
Copy link
Contributor

ywk253100 commented Dec 9, 2024

@mayankagg9722 Could you explain a bit more about why you expect RestorePVs=true to work in your case?
Per my understanding, RestorePVs=false already meets your requirement and RestorePVs=ture works as design.

@mayankagg9722
Copy link
Contributor Author

@ywk253100 If snapshots for the volumes do not exist, the behavior should remain consistent regardless of whether the restorePVs setting is enabled or disabled during the restore process.

Expected behavior: If Velero attempts to restore PVC YAMLs for which snapshots are unavailable, it should still create the PVC YAMLs but omit the volumeHandle. This ensures that new PVs can be dynamically provisioned.

@kaovilai
Copy link
Member

We expect volume handle from the PVC should be removed so that dynamic volume creation can happen at the time of restore of PVC YAML even when restored with flag RestorePVs=true when volume snapshot is not present.

If you completely delete NS containing PVC and PV and restore from backup.. I would expect the same PV name to be created and used when not restoring from a snapshot.

The example scenario only happens if your backup inclulde PVC and PV yaml and you restore to a different NS perhaps right?

@kaovilai kaovilai added the Area/CSI Related to Container Storage Interface support label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/CSI Related to Container Storage Interface support Restore
Projects
None yet
Development

No branches or pull requests

3 participants