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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]