tokers commented on a change in pull request #740: URL: https://github.com/apache/apisix-ingress-controller/pull/740#discussion_r748950390
########## File path: pkg/ingress/ingress.go ########## @@ -184,14 +185,64 @@ func (c *ingressController) sync(ctx context.Context, ev *types.Event) error { } func (c *ingressController) handleSyncErr(obj interface{}, err error) { + ev := obj.(*types.Event) + event := ev.Object.(kube.IngressEvent) + namespace, name, errLocal := cache.SplitMetaNamespaceKey(event.Key) + if errLocal != nil { + log.Errorf("invalid resource key: %s", event.Key) + return + } + + var ing kube.Ingress + switch event.GroupVersion { + case kube.IngressV1: + ing, err = c.controller.ingressLister.V1(namespace, name) + case kube.IngressV1beta1: + ing, err = c.controller.ingressLister.V1beta1(namespace, name) + case kube.IngressExtensionsV1beta1: + ing, err = c.controller.ingressLister.ExtensionsV1beta1(namespace, name) + } + if err == nil { + // add status + if ev.Type != types.EventDelete { + if errLocal == nil { + switch ing.GroupVersion() { + case kube.IngressV1: + c.controller.recordStatus(ing.V1(), _resourceSynced, nil, metav1.ConditionTrue, ing.V1().GetGeneration()) + case kube.IngressV1beta1: + c.controller.recordStatus(ing.V1beta1(), _resourceSynced, nil, metav1.ConditionTrue, ing.V1beta1().GetGeneration()) + case kube.IngressExtensionsV1beta1: + c.controller.recordStatus(ing.ExtensionsV1beta1(), _resourceSynced, nil, metav1.ConditionTrue, ing.ExtensionsV1beta1().GetGeneration()) + } + } else { + log.Errorw("failed split namespace/name", + zap.Error(errLocal), + ) + } + } c.workqueue.Forget(obj) return } log.Warnw("sync ingress failed, will retry", zap.Any("object", obj), zap.Error(err), ) + + if errLocal == nil { + switch ing.GroupVersion() { + case kube.IngressV1: + c.controller.recordStatus(ing.V1(), _resourceSynced, err, metav1.ConditionTrue, ing.V1().GetGeneration()) Review comment: This is the case that the `errLocal` is `nil`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org