fix(objectstorage-controller): shorten COSI leader-election lease

The controller and the per-driver sidecar both run single-replica, so leader
election provides no high availability -- it only governs how quickly a freshly
recreated pod takes over. With the upstream 150s lease duration a recreated
provisioner pod stalls reconciliation for up to 150s while it waits out the
stale lease still held by the previous, now-deleted pod. Lower the lease timings
to the standard Kubernetes values (15s/10s/2s) so a recreated pod resumes
reconciliation in roughly 15s.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
(cherry picked from commit 250d92323d)
This commit is contained in:
Aleksei Sviridkin authored and Myasnikov Daniil committed 2026-08-04 13:18:15 +05:00
1 parent d9c6f579de
commit bded448d56
1 file changed
+23
@@ -0,0 +1,23 @@
diff --git a/internal/runtime/controller.go b/internal/runtime/controller.go
index 902116a..4cbe4c3 100644
--- a/internal/runtime/controller.go
+++ b/internal/runtime/controller.go
@@ -171,10 +171,14 @@ func NewObjectStorageControllerWithClientset(identity string, leaderLockName str
threadiness: threads,
ResyncPeriod: 30 * time.Second,
- // leader election
- LeaseDuration: 150 * time.Second,
- RenewDeadline: 120 * time.Second,
- RetryPeriod: 60 * time.Second,
+ // Leader election. The COSI controller and the per-driver sidecar both
+ // run single-replica, so leader election provides no HA — it only gates
+ // how fast a freshly recreated pod takes over. Use the standard
+ // Kubernetes leader-election timings instead of the upstream 150/120/60s
+ // so a recreated pod resumes reconciliation in ~15s rather than ~150s.
+ LeaseDuration: 15 * time.Second,
+ RenewDeadline: 10 * time.Second,
+ RetryPeriod: 2 * time.Second,
opMap: &sync.Map{},
}, nil