From 57f1c703d1762bf6dc535a4910935b197742712c Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 26 Oct 2023 18:15:19 +0800 Subject: [PATCH] fix: cached namespaces --- main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index f2665e0..37031f4 100644 --- a/main.go +++ b/main.go @@ -110,19 +110,21 @@ func main() { setupLog.Error(err, "unable to start manager") os.Exit(1) } - ctrlOptions.NewCache = cache.MultiNamespacedCacheBuilder(bentoDeploymentNamespaces) - setupLog.Info("starting manager", "bento deployment namespaces", bentoDeploymentNamespaces) + namespaces := bentoDeploymentNamespaces + namespaces = append(namespaces, commonconfig.GetYataiSystemNamespaceFromEnv()) + ctrlOptions.NewCache = cache.MultiNamespacedCacheBuilder(namespaces) + setupLog.Info("starting manager", "cached namespaces", namespaces) } else { setupLog.Info("starting manager", "bento deployment namespaces", "all") } - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrlOptions) + mgr, err := ctrl.NewManager(restConf, ctrlOptions) if err != nil { setupLog.Error(err, "unable to start manager") os.Exit(1) } - discoveryClient, err := discovery.NewDiscoveryClientForConfig(ctrl.GetConfigOrDie()) + discoveryClient, err := discovery.NewDiscoveryClientForConfig(restConf) if err != nil { setupLog.Error(err, "unable to create discovery client") os.Exit(1)