Skip to content

Commit 2c5ec0e

Browse files
0OCPBUGS-49622: Backport of PR #249
This is a manual backport of openshift/operator-framework-operator-controller#249 to fix leaderelection settings Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
1 parent 0def8b3 commit 2c5ec0e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cmd/manager/main.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import (
4242
_ "k8s.io/client-go/plugin/pkg/client/auth"
4343
"k8s.io/klog/v2"
4444
"k8s.io/klog/v2/textlogger"
45+
"k8s.io/utils/ptr"
4546
ctrl "sigs.k8s.io/controller-runtime"
4647
crcache "sigs.k8s.io/controller-runtime/pkg/cache"
4748
"sigs.k8s.io/controller-runtime/pkg/certwatcher"
@@ -203,8 +204,14 @@ func main() {
203204
HealthProbeBindAddress: probeAddr,
204205
LeaderElection: enableLeaderElection,
205206
LeaderElectionID: "catalogd-operator-lock",
206-
WebhookServer: webhookServer,
207-
Cache: cacheOptions,
207+
// Recommended Leader Election values
208+
// https://github.com/openshift/enhancements/blob/61581dcd985130357d6e4b0e72b87ee35394bf6e/CONVENTIONS.md#handling-kube-apiserver-disruption
209+
LeaseDuration: ptr.To(137 * time.Second),
210+
RenewDeadline: ptr.To(107 * time.Second),
211+
RetryPeriod: ptr.To(26 * time.Second),
212+
213+
WebhookServer: webhookServer,
214+
Cache: cacheOptions,
208215
})
209216
if err != nil {
210217
setupLog.Error(err, "unable to create manager")

0 commit comments

Comments
 (0)