Skip to content

📖predicate: clarify predicates don't reduce cache memory - #3562

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
GellertBabel:docs/clarify-predicate-cache-memory
Jul 25, 2026
Merged

📖predicate: clarify predicates don't reduce cache memory#3562
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
GellertBabel:docs/clarify-predicate-cache-memory

Conversation

@GellertBabel

Copy link
Copy Markdown
Contributor

Clarifies in the Predicate godoc that predicates only filter which events are enqueued for reconciliation — they do not reduce what the informer cache stores. Every watched object is still held in memory regardless of whether a predicate rejects its events.

Adds a short pointer to the mechanisms that actually bound cache memory for a Kind: a label/field selector (cache.Options / cache.ByObject), a cache.ByObject Transform, or client.Options.Cache.DisableFor.

This is a source of confusion (and OOMKills) for controllers watching Kinds with many or large objects, e.g. Secrets in a namespace that also holds large, unrelated objects.

Fixes #3552

@kubernetes-prow kubernetes-prow Bot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jul 24, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from sbueringer and vincepri July 24, 2026 11:44
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 24, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: GellertBabel / name: Gellért Bábel (e879bd2)

@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @GellertBabel!

It looks like this is your first PR to kubernetes-sigs/controller-runtime 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/controller-runtime has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow kubernetes-prow Bot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 24, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @GellertBabel. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 24, 2026
@GellertBabel
GellertBabel force-pushed the docs/clarify-predicate-cache-memory branch from 3c9e868 to e879bd2 Compare July 24, 2026 11:46
@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jul 24, 2026
Comment thread pkg/predicate/predicate.go Outdated

// Predicate filters events before enqueuing the keys.
//
// NOTE: Predicates only filter which events are enqueued for reconciliation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This first sentence just repeats the info two lines above. Please just say "This setting doesn't impact what the cache stores, use cache.Options to configure that. Keep in mind that cache.Options are global to all users of the cache." or some such.

Please do not mention individual cache option names here, they could change and are already documented in cache.Options. Suggesting to use cache.Disable for is also pretty nonsensical, you never want to disable the cache for an object you have a source configured for.

Signed-off-by: Gellért Bábel <gellert.babel@ericsson.com>
@GellertBabel
GellertBabel force-pushed the docs/clarify-predicate-cache-memory branch from e879bd2 to 5062d6c Compare July 25, 2026 20:51
@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 25, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 7cef5423a6c6e3a518f5c2a77668889a8401738c

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, GellertBabel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 25, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit d3cf8dd into kubernetes-sigs:main Jul 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Predicates don't reduce cache memory — informer caches full objects for every watched resource

2 participants