feat(controllers): add exponential backoff rate limiter to all contro… - #388
Open
geoffrey1330 wants to merge 2 commits into
Open
feat(controllers): add exponential backoff rate limiter to all contro…#388geoffrey1330 wants to merge 2 commits into
geoffrey1330 wants to merge 2 commits into
Conversation
…oid backoff-delayed duplicates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…llers
Add exponential backoff rate limiter to all controllers
Fixes #138.
All 18 controllers were requeueing on errors with fixed intervals, causing
thundering-herd retry storms against the backend when it was degraded. When
every controller fails at the same time, they all retry at the same wall-clock
time — keeping sbcli saturated and delaying recovery.
This wires an exponential backoff rate limiter (base 5 s, max 5 min) into
every controller's
SetupWithManagervia a shareddefaultControllerOptions()helper. When a controller returns
ctrl.Result{}, err, successive retries forthe same object back off to 10 s, 20 s, 40 s … up to 5 min, then reset once
the object reconciles successfully.
RequeueAfterreturns used for intentional polling (waiting for node online,drain slot checks, sync intervals) are unaffected.
Fix: prevent duplicate backend calls when status patches fail after mutations
A subtle risk introduced by exponential backoff: if a backend POST succeeds
(e.g. trigger migrate, promote, suspend) but the subsequent status patch fails,
returning
ctrl.Result{}, errcauses the controller to back off — then retrywith
Triggered=falsestill in status, firing the same backend call again.Status patches that follow a successful backend mutation now return
ctrl.Result{Requeue: true}, nilinstead ofctrl.Result{}, err. Thisrequeues immediately without triggering backoff, retrying only the status patch
until it lands. Once
Triggered=trueis persisted the controller moves forwardnormally — no duplicate calls.
Applied across
StorageNodeOps,SimplyblocksStorageCluster, andVolumeMigrationcontrollers.Test Result