Skip to content

Commit

Permalink
[main] Fixing options
Browse files Browse the repository at this point in the history
* Config file options were not applied
  • Loading branch information
didierofrivia committed Oct 20, 2022
1 parent d751419 commit 57cdd9d
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func main() {
configFile string
err error
)

flag.StringVar(&metricsAddr, "metrics-bind-address", ":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, "leader-elect", false,
Expand All @@ -111,7 +110,14 @@ func main() {
"Command-line flags override configuration from this file.")
flag.Parse()

options := ctrl.Options{Scheme: scheme}
options := ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "f139389e.kuadrant.io",
}
if configFile != "" {
options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile))
if err != nil {
Expand All @@ -120,14 +126,7 @@ func main() {
}
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "f139389e.kuadrant.io",
})
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options)
if err != nil {
setupLog.Error(err, "unable to start manager")
os.Exit(1)
Expand Down

0 comments on commit 57cdd9d

Please sign in to comment.