main.go: Add support for configuring leader election namespace
via command line
@@ -57,6 +57,7 @@ func main() {
var (
metricsAddr string
enableLeaderElection bool
+ leaderElectionNamespace string
watchNamespace string
profilerAddress string
awsClusterConcurrency int
@@ -86,6 +87,13 @@ func main() {
"Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces.",
)
+ flag.StringVar(
+ &leaderElectionNamespace,
+ "leader-election-namespace",
+ "",
+ "Namespace that the controller performs leader election in. If unspecified, the controller will discover which namespace it is running in.",
+ )
+
flag.StringVar(
&profilerAddress,
"profiler-address",
@@ -142,6 +150,7 @@ func main() {
MetricsBindAddress: metricsAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "controller-leader-election-capa",
+ LeaderElectionNamespace: leaderElectionNamespace,
SyncPeriod: &syncPeriod,
Namespace: watchNamespace,
EventBroadcaster: broadcaster,
