From 7f8a43f836bb9ee01dc8c9a0a9607fba76e8e837 Mon Sep 17 00:00:00 2001 From: "wuhua.ck" Date: Tue, 1 Mar 2022 16:23:16 +0800 Subject: [PATCH] add flag watchNamespace --- ray-operator/main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ray-operator/main.go b/ray-operator/main.go index e0adeffef1..de83a6a9c0 100644 --- a/ray-operator/main.go +++ b/ray-operator/main.go @@ -34,11 +34,17 @@ func main() { var enableLeaderElection bool var probeAddr string var reconcileConcurrency int + var watchNamespace string flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "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, "enable-leader-election", false, "Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.") flag.IntVar(&reconcileConcurrency, "reconcile-concurrency", 1, "max concurrency for reconciling") + flag.StringVar( + &watchNamespace, + "watch-namespace", + "", + "Watch custom resources in the namespace, ignore other namespaces. If empty, all namespaces will be watched.") opts := zap.Options{ Development: true, } @@ -56,6 +62,7 @@ func main() { HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, LeaderElectionID: "ray-operator-leader", + Namespace: watchNamespace, }) if err != nil { setupLog.Error(err, "unable to start manager")