Skip to content

Commit

Permalink
fix: Add missing leader election flags, remove cloud-config-file flag
Browse files Browse the repository at this point in the history
+ remove statically defined and deprecated port
  • Loading branch information
hrak committed Aug 13, 2024
1 parent 3b67bab commit 0e9a10a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func init() {
}

var (
cloudConfigFile string
enableLeaderElection bool
leaderElectionLeaseDuration time.Duration
leaderElectionRenewDeadline time.Duration
Expand All @@ -97,11 +96,6 @@ var (
)

func initFlags(fs *pflag.FlagSet) {
fs.StringVar(
&cloudConfigFile,
"cloud-config-file",
"/config/cloud-config",
"Overrides the default path to the cloud-config file that contains the CloudStack credentials.")
fs.StringVar(
&metricsAddr,
"metrics-bind-addr",
Expand All @@ -118,6 +112,14 @@ func initFlags(fs *pflag.FlagSet) {
false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
fs.DurationVar(&leaderElectionLeaseDuration, "leader-elect-lease-duration", 15*time.Second,
"Interval at which non-leader candidates will wait to force acquire leadership (duration string)")

fs.DurationVar(&leaderElectionRenewDeadline, "leader-elect-renew-deadline", 10*time.Second,
"Duration that the leading controller manager will retry refreshing leadership before giving up (duration string)")

fs.DurationVar(&leaderElectionRetryPeriod, "leader-elect-retry-period", 2*time.Second,
"Duration the LeaderElector clients should wait between tries of actions (duration string)")
fs.StringVar(
&watchNamespace,
"namespace",
Expand Down Expand Up @@ -241,7 +243,6 @@ func main() {
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "capc-leader-election-controller",
Expand Down

0 comments on commit 0e9a10a

Please sign in to comment.