diff --git a/pkg/controllers/binding/binding_controller.go b/pkg/controllers/binding/binding_controller.go index 2ff1fea71..7741c5c1c 100644 --- a/pkg/controllers/binding/binding_controller.go +++ b/pkg/controllers/binding/binding_controller.go @@ -116,6 +116,9 @@ func (c *ResourceBindingController) syncBinding(binding *workv1alpha2.ResourceBi workload, err := helper.FetchWorkload(c.DynamicClient, c.InformerManager, c.RESTMapper, binding.Spec.Resource) if err != nil { if apierrors.IsNotFound(err) { + // It might happen when the resource template has been removed but the garbage collector hasn't removed + // the ResourceBinding which dependent on resource template. + // So, just return without retry(requeue) would save unnecessary loop. return controllerruntime.Result{}, nil } klog.Errorf("Failed to fetch workload for resourceBinding(%s/%s). Error: %v.", diff --git a/pkg/controllers/binding/cluster_resource_binding_controller.go b/pkg/controllers/binding/cluster_resource_binding_controller.go index 163b9cc5a..14c34e259 100644 --- a/pkg/controllers/binding/cluster_resource_binding_controller.go +++ b/pkg/controllers/binding/cluster_resource_binding_controller.go @@ -109,6 +109,9 @@ func (c *ClusterResourceBindingController) syncBinding(binding *workv1alpha2.Clu workload, err := helper.FetchWorkload(c.DynamicClient, c.InformerManager, c.RESTMapper, binding.Spec.Resource) if err != nil { if apierrors.IsNotFound(err) { + // It might happen when the resource template has been removed but the garbage collector hasn't removed + // the ClusterResourceBinding which dependent on resource template. + // So, just return without retry(requeue) would save unnecessary loop. return controllerruntime.Result{}, nil } klog.Errorf("Failed to fetch workload for clusterResourceBinding(%s). Error: %v.", binding.GetName(), err)