Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify namespace permissions before adding ns controller #1914

Merged
merged 8 commits into from
May 31, 2022
10 changes: 7 additions & 3 deletions pkg/cmd/start/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.Warn("skipping reconciliation for namespaces, do not have permissions to list and watch namespaces")
}

if err := esv1controllers.NewReconciler(client, clientReader).SetupWithManager(mgr); err != nil {
Expand Down