Skip to content

✨ Start the reconcile backoff at 1s and cap it at 5m - #2373

Draft
corioliskraft wants to merge 1 commit into
syself:mainfrom
corioliskraft:1757-reconcile-backoff
Draft

corioliskraft wants to merge 1 commit into
syself:mainfrom
corioliskraft:1757-reconcile-backoff

Conversation

@corioliskraft

@corioliskraft corioliskraft commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Problem: after a reconcile error, controller-runtime requeues the object with its default per-object backoff: 5ms, doubled up to 1000s. So one failing object can call the HCloud or Robot API about 10 times in the first 5s. All objects that use the same Hetzner secret share its API rate limit.

Solution: each of the 7 controllers that reconcile Hetzner objects gets its own backoff. It starts at 1s and doubles up to 5m. A watch event or a resync can start a reconcile sooner. The new flag --backoff-base-delay sets the base delay.

Which issue(s) this PR fixes:

Fixes #1757

Special notes for your reviewer:

  • The base delay is a flag, --backoff-base-delay (default 1s), as proposed in the issue.
  • Each controller gets its own backoff, as @abdullah599 asked in the issue. The backoff counts failures by name and namespace, so one shared backoff would mix the counts of an HCloudMachine and its HCloudRemediation with the same name.
  • GuestCSRReconciler and CRDMigrator keep the default backoff, because they make no Hetzner API calls.

TODOs:

  • squash commits
  • add unit tests

The Hetzner controllers used the default per-object rate limiter of
controller-runtime: 5ms, doubled up to 1000s. An object that kept
failing could call the HCloud or Robot API about 10 times in the first
5s, which can hit the API rate limit.

Now, after a reconcile error or a Requeue without RequeueAfter, the
delay for an object starts at 1s and doubles up to 5m. A watch event or
a resync can start a reconcile sooner.

The new flag --backoff-base-delay sets the base delay (default 1s). The
manager does not start when the value is 0 or less, or larger than 5m.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use custom exponential backoff: Wait longer to avoid rate-limit.

1 participant