Skip to content

Commit 250d923

Browse files
committed
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 <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 4437ccc commit 250d923

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
diff --git a/internal/runtime/controller.go b/internal/runtime/controller.go
2+
index 902116a..4cbe4c3 100644
3+
--- a/internal/runtime/controller.go
4+
+++ b/internal/runtime/controller.go
5+
@@ -171,10 +171,14 @@ func NewObjectStorageControllerWithClientset(identity string, leaderLockName str
6+
threadiness: threads,
7+
8+
ResyncPeriod: 30 * time.Second,
9+
- // leader election
10+
- LeaseDuration: 150 * time.Second,
11+
- RenewDeadline: 120 * time.Second,
12+
- RetryPeriod: 60 * time.Second,
13+
+ // Leader election. The COSI controller and the per-driver sidecar both
14+
+ // run single-replica, so leader election provides no HA — it only gates
15+
+ // how fast a freshly recreated pod takes over. Use the standard
16+
+ // Kubernetes leader-election timings instead of the upstream 150/120/60s
17+
+ // so a recreated pod resumes reconciliation in ~15s rather than ~150s.
18+
+ LeaseDuration: 15 * time.Second,
19+
+ RenewDeadline: 10 * time.Second,
20+
+ RetryPeriod: 2 * time.Second,
21+
22+
opMap: &sync.Map{},
23+
}, nil

0 commit comments

Comments
 (0)