Disable client caching for Pods - #5082
Merged
caseydavenport merged 1 commit intoJul 21, 2026
Merged
Conversation
Pods are read only by label/namespace selector from a few controllers, so route those reads to the apiserver instead of holding every pod in a shared informer.
coutinhop
approved these changes
Jul 21, 2026
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.
The operator's controller-runtime client caches every object type it reads, so the first cached pod read starts a shared informer that lists and watches every pod in the cluster and holds them all in memory. Nothing needs a full in-memory pod cache - the handful of controllers that read pods (status diagnosis, dex/guardian proxy resolution, finalizer cleanup, CSR validation) all query by label and namespace, and a couple do single Gets by name, and all run conditionally in specific situations and aren't part of steady-state.
This adds Pod to the client's
DisableForlist so those reads go straight to the apiserver. The label/namespace selectors that were previously applied client-side over the cached store now become server-side filters, so responses are smaller too.Measured with a throwaway envtest harness (synthetic pods, heap after 2x GC):
The uncached footprint stays flat regardless of cluster size.
Depends on #4987, which removes the pod
spec.nodeNamefield index. That index starts the shared pod informer on its own, so this change only fully takes effect once #4987 lands - merge this after #4987. This PR doesn't include #4987's commits; I'll rebase once it merges.