From 4698c9a58c5e5b137e2596301702265100d1afc8 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Tue, 19 Dec 2023 16:32:52 +0100 Subject: [PATCH] Properly configure namespace selector This accidentally did not get `if`-wrapped in eaa2a8c2fe78e3b7d5aa9fcedc7757b3c4005f51, breaking the configuration option to watch single namespace. Signed-off-by: Hidde Beydals --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 2f8349744..4f5050399 100644 --- a/main.go +++ b/main.go @@ -228,8 +228,10 @@ func main() { }, } - mgrConfig.Cache.DefaultNamespaces = map[string]ctrlcache.Config{ - watchNamespace: {}, + if watchNamespace != "" { + mgrConfig.Cache.DefaultNamespaces = map[string]ctrlcache.Config{ + watchNamespace: {}, + } } mgr, err := ctrl.NewManager(restConfig, mgrConfig)