Skip to content

Commit 193faf3

Browse files
UPSTREAM: <carry>: Fix leaderelection settings
This is a manual backport of #249 to fix leaderelection settings Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
1 parent a3cfcc6 commit 193faf3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmd/manager/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
_ "k8s.io/client-go/plugin/pkg/client/auth"
4040
"k8s.io/klog/v2"
4141
"k8s.io/klog/v2/textlogger"
42+
"k8s.io/utils/ptr"
4243
ctrl "sigs.k8s.io/controller-runtime"
4344
crcache "sigs.k8s.io/controller-runtime/pkg/cache"
4445
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -167,7 +168,13 @@ func main() {
167168
HealthProbeBindAddress: probeAddr,
168169
LeaderElection: enableLeaderElection,
169170
LeaderElectionID: "9c4404e7.operatorframework.io",
170-
Cache: cacheOptions,
171+
// Recommended Leader Election values
172+
// https://github.com/openshift/enhancements/blob/61581dcd985130357d6e4b0e72b87ee35394bf6e/CONVENTIONS.md#handling-kube-apiserver-disruption
173+
LeaseDuration: ptr.To(137 * time.Second),
174+
RenewDeadline: ptr.To(107 * time.Second),
175+
RetryPeriod: ptr.To(26 * time.Second),
176+
177+
Cache: cacheOptions,
171178
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
172179
// when the Manager ends. This requires the binary to immediately end when the
173180
// Manager is stopped, otherwise, this setting is unsafe. Setting this significantly

0 commit comments

Comments
 (0)