Strip managed fields from controller-runtime cache - #3327
Merged
Conversation
tbavelier
force-pushed
the
tbavelier/controller-runtime-cache-optimizations
branch
from
August 5, 2026 08:34
5286b35 to
f486148
Compare
|
🎯 Code Coverage (details) 🔗 Commit SHA: 63bc16e | Docs | Datadog PR Page | Give us feedback! |
tbavelier
force-pushed
the
tbavelier/controller-runtime-cache-optimizations
branch
from
August 5, 2026 11:17
f486148 to
63bc16e
Compare
tbavelier
marked this pull request as ready for review
August 5, 2026 11:22
Mathew-Estafanous
approved these changes
Aug 5, 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.
What does this PR do?
Strips
metadata.managedFieldsfrom objects before storing them in the controller-runtime cache.Motivation
The operator does not inspect cached managed fields. The controller-runtime documentation notes that using this transform can significantly reduce cache memory usage. Live Kubernetes objects and field ownership are unchanged.
Additional Notes
The initial version also registered controller-runtime field indexes for the
app.kubernetes.io/part-oflabel on resource types managed by the DatadogAgent reconcilers. Stale-resource cleanup then usedclient.MatchingFieldsto avoid scanning every cached object of each type.Staging profiling on
genesectandenteishowed no consistent memory or CPU improvement, while reconcile p99 improved only ongenesectand regressed onentei. The indexing changes were therefore removed to avoid the additional manager setup, fake-client wiring, and test complexity.Minimum Agent Versions
Describe your test plan
Automated coverage verifies that the default cache transform removes managed fields.
go test ./pkg/configandmake lintpass.QA: This will be tested in staging by validating normal reconciliation and cache behavior.
Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel