diff --git a/internal/leaderelection/leaderelection.go b/internal/leaderelection/leaderelection.go index ceb14c889..babd5450a 100644 --- a/internal/leaderelection/leaderelection.go +++ b/internal/leaderelection/leaderelection.go @@ -136,9 +136,13 @@ func newLeaderElectionConfig(namespace, leaseName, identity string, internalClie identity: identity, }, ReleaseOnCancel: true, // semantics for correct release handled by releaseLock.Update and controllersWithLeaderElector below - LeaseDuration: 60 * time.Second, - RenewDeadline: 15 * time.Second, - RetryPeriod: 5 * time.Second, + + // Copied from defaults used in OpenShift since we want the same semantics: + // https://github.com/openshift/library-go/blob/e14e06ba8d476429b10cc6f6c0fcfe6ea4f2c591/pkg/config/leaderelection/leaderelection.go#L87-L109 + LeaseDuration: 137 * time.Second, + RenewDeadline: 107 * time.Second, + RetryPeriod: 26 * time.Second, + Callbacks: leaderelection.LeaderCallbacks{ OnStartedLeading: func(_ context.Context) { plog.Debug("leader gained", "identity", identity) diff --git a/test/integration/leaderelection_test.go b/test/integration/leaderelection_test.go index 2a5b1f97a..caecb59ec 100644 --- a/test/integration/leaderelection_test.go +++ b/test/integration/leaderelection_test.go @@ -205,7 +205,7 @@ func waitForIdentity(ctx context.Context, t *testing.T, namespace *corev1.Namesp } out = lease return lease.Spec.HolderIdentity != nil && identities.Has(*lease.Spec.HolderIdentity), nil - }, 3*time.Minute, time.Second) + }, 5*time.Minute, time.Second) return out }