layer1: align router watcher flow step 23

This commit is contained in:
Naeel
2026-04-26 10:29:43 +03:00
parent 33a08f00b3
commit 346399d35f
2 changed files with 17 additions and 2 deletions
@@ -0,0 +1,15 @@
# 2026-04-26 — NamespaceManager rewrite, step 23
## Цель шага
Свести текущий watcher flow и новый subscriber flow `router` к одному helper.
## Что меняем
1. `router/ns_watcher.go` больше не дублирует add/resync логику.
2. Watcher вызывает `registerRouterNamespace()`.
## Что НЕ меняем
- не переключаем `StartNSWatcher()` на `NamespaceManager`;
- не меняем внешний API watcher-а.
+2 -2
View File
@@ -46,7 +46,7 @@ func StartNSWatcher(
if ns == "" {
return
}
if err := ts.AddNamespace(ctx, ns, mgr); err != nil {
if err := registerRouterNamespace(ctx, ns, ts, mgr); err != nil {
logger.Error("router.NSWatcher: AddNamespace failed",
zap.String("namespace", ns), zap.Error(err))
}
@@ -56,7 +56,7 @@ func StartNSWatcher(
if !ok || !utils.IsManagedNamespace(nsObj.Labels) {
return
}
if err := ts.AddNamespace(ctx, nsObj.Name, mgr); err != nil {
if err := registerRouterNamespace(ctx, nsObj.Name, ts, mgr); err != nil {
logger.Error("router.NSWatcher: AddNamespace failed",
zap.String("namespace", nsObj.Name), zap.Error(err))
}