Skip to content

Commit

Permalink
Increase leader election retry period
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckal777 committed Dec 14, 2021
1 parent e13755b commit 26b6ee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 1 addition & 3 deletions e2e/cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"backup": "off",
"spec": {
"openstack": {
"routerID": "07c17911-0624-4933-b693-282c5447adfe",
"networkID": "a7ec6c35-4e17-4e97-aa2b-0d93e56bb6c7",
"lbSubnetID": "98697330-3e9e-4308-b351-eec5fcffe5b7"
"routerID": "c7a8528b-0c86-4cb7-b6e2-c258d60bed47"
},
"version": "1.20.8",
"serviceCIDR": "198.18.192.0/18",
Expand Down
19 changes: 11 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"flag"
"fmt"
"os"
"time"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
Expand Down Expand Up @@ -77,7 +78,6 @@ func main() {
flag.Parse()

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

if kubecontext == "" {
kubecontext = os.Getenv("KUBECONTEXT")
}
Expand All @@ -88,14 +88,17 @@ func main() {
}
setupLog.Info("Loaded kubeconfig", "context", kubecontext, "host", restConfig.Host)

leaderElectionRetry := 5 * time.Second //nolint:gomnd
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443, //nolint:gomnd
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "maintenance-controller-leader-election.cloud.sap",
EventBroadcaster: event.NewNodeBroadcaster(),
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443, //nolint:gomnd
HealthProbeBindAddress: probeAddr,
EventBroadcaster: event.NewNodeBroadcaster(),
LeaderElectionResourceLock: "leases",
LeaderElection: enableLeaderElection,
LeaderElectionID: "maintenance-controller-leader-election.cloud.sap",
RetryPeriod: &leaderElectionRetry,
})
if err != nil {
setupLog.Error(err, "unable to start manager")
Expand Down

0 comments on commit 26b6ee2

Please sign in to comment.