Skip to content

fix(controller): reduce memory by filtering ReplicaSet informer#4666

Open
blkperl wants to merge 2 commits intoargoproj:masterfrom
blkperl:reduce-memory-replicaset-informer
Open

fix(controller): reduce memory by filtering ReplicaSet informer#4666
blkperl wants to merge 2 commits intoargoproj:masterfrom
blkperl:reduce-memory-replicaset-informer

Conversation

@blkperl
Copy link
Copy Markdown
Member

@blkperl blkperl commented Mar 21, 2026

Fixes #2552

Use a separate replicaSetInformerFactory with WithTweakListOptions to limit the ReplicaSet informer cache to only ReplicaSets that have the rollouts-pod-template-hash label (i.e. those owned by Rollouts).

This avoids caching ReplicaSets from Deployments and other controllers, significantly reducing memory usage on clusters with large numbers of ReplicaSets.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional with a list of types and scopes found here, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed my commits with DCO
  • My builds are green. Try syncing with master if they are not.
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • I have run all tests locally (including the flaky ones) and they pass on my workstation
  • I have used LLM/AI/Agent tools for this PR but I am responsible for all code of this PR
  • I understand what the code does and WHY/HOW it works in several scenarios
  • I know if my code is just adding new functionality or changing old functionality for existing users
  • My organization is added to USERS.md.

…llout-managed only. Fixes argoproj#2552

Use a separate replicaSetInformerFactory with WithTweakListOptions to limit
the ReplicaSet informer cache to only ReplicaSets that have the
rollouts-pod-template-hash label (i.e. those owned by Rollouts).

This avoids caching ReplicaSets from Deployments and other controllers,
significantly reducing memory usage on clusters with large numbers of
ReplicaSets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: William Van Hevelingen <william.vanhevelingen@acquia.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.94%. Comparing base (e046515) to head (36bc32d).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4666      +/-   ##
==========================================
+ Coverage   84.86%   84.94%   +0.07%     
==========================================
  Files         164      164              
  Lines       18954    18965      +11     
==========================================
+ Hits        16086    16109      +23     
+ Misses       2007     2001       -6     
+ Partials      861      855       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 21, 2026

Published E2E Test Results

  4 files    4 suites   3h 33m 58s ⏱️
120 tests 111 ✅  7 💤 2 ❌
482 runs  452 ✅ 28 💤 2 ❌

For more details on these failures, see this check.

Results for commit 36bc32d.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 21, 2026

Published Unit Test Results

2 443 tests   2 443 ✅  3m 18s ⏱️
  129 suites      0 💤
    1 files        0 ❌

Results for commit 36bc32d.

♻️ This comment has been updated with latest results.

Signed-off-by: William Van Hevelingen <william.vanhevelingen@acquia.com>
@blkperl blkperl marked this pull request as ready for review March 21, 2026 20:27
@sonarqubecloud
Copy link
Copy Markdown

@zachaller
Copy link
Copy Markdown
Collaborator

I really like this PR, do you have any personal graphs or anythign that can show the savings a bit. It seems logical I am just curious if/what you have seen?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce operator memory usage by using an informer with limited scope

2 participants