Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Commit

Permalink
add leadElectionNamespace arg (#216)
Browse files Browse the repository at this point in the history
* add leadElectionNamespace arg

Signed-off-by: yanxun <[email protected]>

* change var name

Signed-off-by: yanxun <[email protected]>

* make leaderElectionNamespace's default value empty

Signed-off-by: yanxun <[email protected]>

Co-authored-by: yanxun <[email protected]>
  • Loading branch information
Diddaa and SevenYoung authored Sep 24, 2020
1 parent ef46dd6 commit 8cde76d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cmd/oam-kubernetes-runtime/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func init() {
}

func main() {
var metricsAddr, logFilePath string
var metricsAddr, logFilePath, leaderElectionNamespace string
var enableLeaderElection, logCompress bool
var logRetainDate int
var certDir string
Expand All @@ -45,6 +45,8 @@ func main() {
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric 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.StringVar(&leaderElectionNamespace, "leader-election-namespace", "",
"Determines the namespace in which the leader election configmap will be created.")
flag.StringVar(&logFilePath, "log-file-path", "", "The address the metric endpoint binds to.")
flag.IntVar(&logRetainDate, "log-retain-date", 7, "The number of days of logs history to retain.")
flag.BoolVar(&logCompress, "log-compress", true, "Enable compression on the rotated logs.")
Expand All @@ -71,12 +73,13 @@ func main() {

oamLog := ctrl.Log.WithName("oam-kubernetes-runtime")
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "oam-kubernetes-runtime",
Port: webhookPort,
CertDir: certDir,
Scheme: scheme,
MetricsBindAddress: metricsAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "oam-kubernetes-runtime",
LeaderElectionNamespace: leaderElectionNamespace,
Port: webhookPort,
CertDir: certDir,
})
if err != nil {
oamLog.Error(err, "unable to create a controller manager")
Expand Down

0 comments on commit 8cde76d

Please sign in to comment.