Skip to content

fix(core): Enforce rolling-window reconciliation rate limits - #3744

Draft
ash-thakur-rh wants to merge 2 commits into
operator-framework:mainfrom
ash-thakur-rh:issue-3740
Draft

ash-thakur-rh wants to merge 2 commits into
operator-framework:mainfrom
ash-thakur-rh:issue-3740

Conversation

@ash-thakur-rh

@ash-thakur-rh ash-thakur-rh commented Dec 4, 2026 •

Copy link
Copy Markdown

Fixes #3740, where a fixed-window reset could allow extra reconciliations within a rolling interval.

  • Adds SlidingWindowRateLimiter to enforce the configured limit over any rolling window per resource.
  • Stores recent grants in a per-resource ring buffer that grows on demand, with amortized O(1) work per permit check.
  • Applies permit-limit changes to existing resource state while retaining grants still in the window.
  • Deprecates LinearRateLimiter and keeps it as the default for compatibility, delegating to SlidingWindowRateLimiter.
  • A future major release can remove LinearRateLimiter and switch the default to SlidingWindowRateLimiter.

Testing

  • Deterministic tests cover rolling boundaries through both limiters, exact permit expiry, per-resource isolation, limit changes, and sparse traffic at large limits.
  • Configuration tests verify that the default retains the legacy type and controllers can opt into SlidingWindowRateLimiter.

Add SlidingWindowRateLimiter and keep the deprecated LinearRateLimiter
as the default for compatibility. Both use a per-resource ring buffer
to track when permits expire.

Fixes operator-framework#3740

Signed-off-by: Ashish Thakur <ashishth@redhat.com>
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 4, 2026
@coderabbitai

coderabbitai Bot commented Dec 4, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Signed-off-by: Ashish Thakur <ashishth@redhat.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LinearRateLimiter is a fixed-window counter and allows up to 2x the configured rate across window boundaries

1 participant