From bded448d5629263efcb98e8d5f7229d90e487ff7 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Wed, 24 Jun 2026 19:44:58 +0300 Subject: [PATCH] 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 Signed-off-by: Aleksei Sviridkin (cherry picked from commit 250d92323dac3ea9af46633f58ac22b9318bf465) --- .../93-shorten-leaderelection-lease.diff | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 packages/system/objectstorage-controller/images/objectstorage/patches/93-shorten-leaderelection-lease.diff diff --git a/packages/system/objectstorage-controller/images/objectstorage/patches/93-shorten-leaderelection-lease.diff b/packages/system/objectstorage-controller/images/objectstorage/patches/93-shorten-leaderelection-lease.diff new file mode 100644 index 000000000..1181f62e6 --- /dev/null +++ b/packages/system/objectstorage-controller/images/objectstorage/patches/93-shorten-leaderelection-lease.diff @@ -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