Skip to content

Commit dd4ec64

Browse files
authored
Support operator watch specify namespace (#180)
1 parent 6a2f93b commit dd4ec64

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ func main() {
6161
var metricsAddr string
6262
var enableLeaderElection bool
6363
var probeAddr string
64+
var watchNamespace string
65+
flag.StringVar(&watchNamespace, "watch-namespace", os.Getenv("WATCH_NAMESPACE"), "The namespace to watch, if not specified, all namespaces will be watched")
6466
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8383", "The address the metric endpoint binds to.")
6567
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
6668
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
@@ -81,6 +83,7 @@ func main() {
8183
HealthProbeBindAddress: probeAddr,
8284
LeaderElection: enableLeaderElection,
8385
LeaderElectionID: "2516c052.apache.org",
86+
Namespace: watchNamespace,
8487
})
8588
if err != nil {
8689
setupLog.Error(err, "unable to start manager")

0 commit comments

Comments
 (0)