Support operator watch specify namespace (#180)
diff --git a/main.go b/main.go
index 7aae21a..c0196a0 100644
--- a/main.go
+++ b/main.go
@@ -61,6 +61,8 @@
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
+ var watchNamespace string
+ flag.StringVar(&watchNamespace, "watch-namespace", os.Getenv("WATCH_NAMESPACE"), "The namespace to watch, if not specified, all namespaces will be watched")
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8383", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
@@ -81,6 +83,7 @@
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "2516c052.apache.org",
+ Namespace: watchNamespace,
})
if err != nil {
setupLog.Error(err, "unable to start manager")