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
+1
View File
@@ -0,0 +1 @@
Fix issue #8963, add legacy PVR controller for Restic path
+4
View File
@@ -311,6 +311,10 @@ func (s *nodeAgentServer) run() {
s.logger.WithError(err).Fatal("Unable to create the pod volume restore controller")
}
if err := controller.InitLegacyPodVolumeRestoreReconciler(s.mgr.GetClient(), s.mgr, s.kubeClient, s.dataPathMgr, s.namespace, s.config.resourceTimeout, s.logger); err != nil {
s.logger.WithError(err).Fatal("Unable to create the legacy pod volume restore controller")
}
dataUploadReconciler := controller.NewDataUploadReconciler(
s.mgr.GetClient(),
s.mgr,
@@ -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)