You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/02/23 14:35:58 UTC
[GitHub] [apisix-ingress-controller] tao12345666333 commented on a change in pull request #882: fix: endless retry if namespace doesn't exist
tao12345666333 commented on a change in pull request #882:
URL: https://github.com/apache/apisix-ingress-controller/pull/882#discussion_r812956644
##########
File path: pkg/ingress/namespace.go
##########
@@ -100,24 +104,32 @@ func (c *namespaceController) sync(ctx context.Context, ev *types.Event) error {
if err != nil {
return err
} else {
- // if labels of namespace contains the watchingLabels, the namespace should be set to controller.watchingNamespace
+ // if labels of namespace contains the watchingLabels, the namespace should be set to controller.watchingNamespaces
if c.controller.watchingLabels.IsSubsetOf(namespace.Labels) {
- c.controller.watchingNamespace.Store(namespace.Name, struct{}{})
+ c.controller.watchingNamespaces.Store(namespace.Name, struct{}{})
}
}
} else { // type == types.EventDelete
namespace := ev.Tombstone.(*corev1.Namespace)
- if _, ok := c.controller.watchingNamespace.Load(namespace.Name); ok {
- c.controller.watchingNamespace.Delete(namespace.Name)
+ if _, ok := c.controller.watchingNamespaces.Load(namespace.Name); ok {
+ c.controller.watchingNamespaces.Delete(namespace.Name)
}
- // do nothing, if the namespace did not in controller.watchingNamespace
+ // do nothing, if the namespace did not in controller.watchingNamespaces
}
return nil
}
func (c *namespaceController) handleSyncErr(event *types.Event, err error) {
name := event.Object.(string)
if err != nil {
+ if k8serrors.IsNotFound(err) && event.Type != types.EventDelete {
+ log.Infow("sync namespace but not found, ignore",
+ zap.String("event_type", event.Type.String()),
+ zap.String("namespace", event.Object.(string)),
+ )
+ c.workqueue.Forget(event)
Review comment:
yep
--
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-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org