From f844a2bc30a3b2aeafbcbfaee3e153493948ce1a Mon Sep 17 00:00:00 2001 From: Mengxin Liu Date: Tue, 14 Sep 2021 14:17:13 +0800 Subject: [PATCH] fix: re-check ns annotation to avoid annotations lost (cherry picked from commit c71620ce129baf8cc2434129ba965440eebb3ed2) --- pkg/controller/namespace.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/controller/namespace.go b/pkg/controller/namespace.go index 2930b0ba17c..587c578ca74 100644 --- a/pkg/controller/namespace.go +++ b/pkg/controller/namespace.go @@ -65,6 +65,12 @@ func (c *Controller) enqueueUpdateNamespace(old, new interface{}) { c.updateNpQueue.Add(np) } } + + // in case annotations are removed by other controllers + if newNs.Annotations == nil || newNs.Annotations[util.LogicalSwitchAnnotation] == "" { + klog.Warningf("no logical switch annotation for ns %s", newNs.Name) + c.addNamespaceQueue.Add(newNs.Name) + } } func (c *Controller) runAddNamespaceWorker() {