From c06036c52f7d32d11a32f9b27dba0379b035b509 Mon Sep 17 00:00:00 2001 From: Ruben Vargas Date: Sun, 29 May 2022 11:56:52 -0500 Subject: [PATCH 1/2] verify namespace permissions before adding ns controller Signed-off-by: Ruben Vargas --- pkg/cmd/start/bootstrap.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/start/bootstrap.go b/pkg/cmd/start/bootstrap.go index bee6290cc..42dc07ca5 100644 --- a/pkg/cmd/start/bootstrap.go +++ b/pkg/cmd/start/bootstrap.go @@ -356,9 +356,13 @@ func setupControllers(ctx context.Context, mgr manager.Manager) { os.Exit(1) } - if err := appsv1controllers.NewNamespaceReconciler(client, clientReader, schema).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Namespace") - os.Exit(1) + if viper.GetBool(v1.ConfigEnableNamespaceController) { + if err := appsv1controllers.NewNamespaceReconciler(client, clientReader, schema).SetupWithManager(mgr); err != nil { + setupLog.Error(err, "unable to create controller", "controller", "Namespace") + os.Exit(1) + } + } else { + log.Trace("skipping reconciliation for namespaces, do not have permissions to list and watch namespaces") } if err := esv1controllers.NewReconciler(client, clientReader).SetupWithManager(mgr); err != nil { From 16cd96f97a56e30cdd5a205f55c8f33ccd027a9d Mon Sep 17 00:00:00 2001 From: Ruben Vargas Date: Mon, 30 May 2022 09:43:51 -0500 Subject: [PATCH 2/2] change log level when ns controller is disabled Signed-off-by: Ruben Vargas --- pkg/cmd/start/bootstrap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/start/bootstrap.go b/pkg/cmd/start/bootstrap.go index 42dc07ca5..88e38878e 100644 --- a/pkg/cmd/start/bootstrap.go +++ b/pkg/cmd/start/bootstrap.go @@ -362,7 +362,7 @@ func setupControllers(ctx context.Context, mgr manager.Manager) { os.Exit(1) } } else { - log.Trace("skipping reconciliation for namespaces, do not have permissions to list and watch namespaces") + log.Warn("skipping reconciliation for namespaces, do not have permissions to list and watch namespaces") } if err := esv1controllers.NewReconciler(client, clientReader).SetupWithManager(mgr); err != nil {