Skip to content

Commit 878fc39

Browse files
Merge pull request #20579 from ramr/namespace-label-fix
Fix issue where routes are not cleaned up when a namespace label is deleted or updated.
2 parents 3614a5b + 0296836 commit 878fc39

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/router/controller/router_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ func (c *RouterController) processNamespace(eventType watch.EventType, ns *kapi.
132132
}
133133

134134
func (c *RouterController) UpdateNamespaces() {
135-
namespaces := c.FilteredNamespaceNames
135+
// Note: Need to clone the filtered namespace names or else any updates
136+
// we make locally in processNamespace() will be immediately
137+
// reflected to plugins in the chain beneath us. This creates
138+
// cleanup issues as old == new in Plugin.HandleNamespaces().
139+
namespaces := sets.NewString(c.FilteredNamespaceNames.List()...)
136140

137141
glog.V(4).Infof("Updating watched namespaces: %v", namespaces)
138142
if err := c.Plugin.HandleNamespaces(namespaces); err != nil {

pkg/router/template/router.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ func (r *templateRouter) commitAndReload() error {
351351
}
352352

353353
r.stateChanged = false
354-
r.dynamicallyConfigured = true
355354
if r.dynamicConfigManager != nil {
355+
r.dynamicallyConfigured = true
356356
r.dynamicConfigManager.Notify(RouterEventReloadStart)
357357
}
358358

@@ -510,6 +510,10 @@ func (r *templateRouter) FilterNamespaces(namespaces sets.String) {
510510
delete(r.state, k)
511511
r.stateChanged = true
512512
}
513+
514+
if r.stateChanged {
515+
r.dynamicallyConfigured = false
516+
}
513517
}
514518

515519
// CreateServiceUnit creates a new service named with the given id.

0 commit comments

Comments
 (0)