Skip to content

Commit

Permalink
Merge pull request grafana#423 from pb82/fix-watch-namespace
Browse files Browse the repository at this point in the history
fix: add watch namespace back to mgr
  • Loading branch information
pb82 authored Jun 2, 2021
2 parents a39e64c + 2ff0d42 commit 87b78f1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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")
Expand Down

0 comments on commit 87b78f1

Please sign in to comment.