legacy pvr controller for restic path

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2025-06-16 17:22:04 +08:00
parent dddf764620
commit 6274593840
4 changed files with 28 additions and 2 deletions
@@ -41,7 +41,6 @@ import (
"github.com/vmware-tanzu/velero/internal/credentials"
veleroapishared "github.com/vmware-tanzu/velero/pkg/apis/velero/shared"
velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
"github.com/vmware-tanzu/velero/pkg/datapath"
"github.com/vmware-tanzu/velero/pkg/exposer"
@@ -205,7 +204,7 @@ func (c *PodVolumeRestoreReconcilerLegacy) SetupWithManager(mgr ctrl.Manager) er
// The pod may not being scheduled at the point when its PVRs are initially reconciled.
// By watching the pods, we can trigger the PVR reconciliation again once the pod is finally scheduled on the node.
pred := kube.NewAllEventPredicate(func(obj client.Object) bool {
pvr := obj.(*velerov1.PodVolumeRestore)
pvr := obj.(*velerov1api.PodVolumeRestore)
return isLegacyPVR(pvr)
})
@@ -65,6 +65,28 @@ func TestFindVolumeRestoresForPodLegacy(t *testing.T) {
},
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "pvr3",
Labels: map[string]string{
velerov1api.PodUIDLabel: string(pod.GetUID()),
},
},
Spec: velerov1api.PodVolumeRestoreSpec{
UploaderType: "kopia",
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "pvr4",
Labels: map[string]string{
velerov1api.PodUIDLabel: string(pod.GetUID()),
},
},
Spec: velerov1api.PodVolumeRestoreSpec{
UploaderType: "restic",
},
},
},
}).Build()
requests = reconciler.findVolumeRestoresForPod(context.Background(), pod)