if workload is not found, skip to ensure work

Signed-off-by: jingxueli <jingxueli@trip.com>
This commit is contained in:
ljx李静雪 2022-04-21 19:50:18 +08:00 committed by jingxueli
parent 28a6c2c767
commit 4953fbcd9e
2 changed files with 6 additions and 0 deletions

View File

@ -115,6 +115,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) {
return controllerruntime.Result{}, nil
}
klog.Errorf("Failed to fetch workload for resourceBinding(%s/%s). Error: %v.",
binding.GetNamespace(), binding.GetName(), err)
return controllerruntime.Result{Requeue: true}, err

View File

@ -108,6 +108,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) {
return controllerruntime.Result{}, nil
}
klog.Errorf("Failed to fetch workload for clusterResourceBinding(%s). Error: %v.", binding.GetName(), err)
return controllerruntime.Result{Requeue: true}, err
}