Skip to content

Commit

Permalink
Resolve conflict with PR vmware-tanzu#180
Browse files Browse the repository at this point in the history
plugin workflow determines whether to restore depends on PVC has
the VolumeSnapshot annotation, so change to check the annotation
from the pvcFromBackup, not the modified pvc.

Signed-off-by: Xun Jiang <[email protected]>
  • Loading branch information
Xun Jiang committed Jul 19, 2023
1 parent 77ee0b4 commit 6a5a13e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ site/vendor

.vs

_tiltbuild
_tiltbuild
coverage.out
2 changes: 1 addition & 1 deletion internal/restore/pvc_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (p *PVCRestoreItemAction) Execute(input *velero.RestoreItemActionExecuteInp
}
logger.Infof("DataDownload %s/%s is created successfully.", dataDownload.Namespace, dataDownload.Name)
} else {
volumeSnapshotName, ok := pvc.Annotations[util.VolumeSnapshotLabel]
volumeSnapshotName, ok := pvcFromBackup.Annotations[util.VolumeSnapshotLabel]
if !ok {
logger.Info("Skipping PVCRestoreItemAction for PVC , PVC does not have a CSI volumesnapshot.")
// Make no change in the input PVC.
Expand Down
2 changes: 1 addition & 1 deletion internal/restore/pvc_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ func TestExecute(t *testing.T) {
DataSourceRef(&corev1api.TypedLocalObjectReference{APIGroup: &snapshotv1api.SchemeGroupVersion.Group, Kind: util.VolumeSnapshotKindName, Name: "testVS"}).
Result(),
vs: builder.ForVolumeSnapshot("velero", "testVS").ObjectMeta(builder.WithAnnotations(util.VolumeSnapshotRestoreSize, "10Gi")).Result(),
expectedPVC: builder.ForPersistentVolumeClaim("velero", "testPVC").ObjectMeta(builder.WithAnnotations("velero.io/volume-snapshot-name", "testVS")).Result(),
expectedPVC: builder.ForPersistentVolumeClaim("velero", "testPVC").Result(),
},
{
name: "Restore from VolumeSnapshot without volume-snapshot-name annotation",
Expand Down

0 comments on commit 6a5a13e

Please sign in to comment.