From 2ff0d428d3d8cbe7f8a8fb347a5078d51338e31c Mon Sep 17 00:00:00 2001 From: Peter Braun Date: Tue, 1 Jun 2021 11:22:45 +0200 Subject: [PATCH] fix: add watch namespace back to mgr --- main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 0cc95159c..d70fece31 100644 --- a/main.go +++ b/main.go @@ -110,8 +110,15 @@ func main() { ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) + namespace, err := k8sutil.GetWatchNamespace() + if err != nil { + log.Log.Error(err, "failed to get watch namespace") + os.Exit(1) + } + mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ Scheme: scheme, + Namespace: namespace, MetricsBindAddress: metricsAddr, Port: 9443, HealthProbeBindAddress: probeAddr, @@ -122,11 +129,6 @@ func main() { setupLog.Error(err, "unable to start manager") os.Exit(1) } - namespace, err := k8sutil.GetWatchNamespace() - if err != nil { - log.Log.Error(err, "failed to get watch namespace") - os.Exit(1) - } if scanAll && flagNamespaces != "" { fmt.Fprint(os.Stderr, "--scan-all and --namespaces both set. Please provide only one")