Skip to content

Strip managed fields from controller-runtime cache - #3327

Merged
tbavelier merged 1 commit into
mainfrom
tbavelier/controller-runtime-cache-optimizations
Aug 5, 2026
Merged

Strip managed fields from controller-runtime cache#3327
tbavelier merged 1 commit into
mainfrom
tbavelier/controller-runtime-cache-optimizations

Conversation

@tbavelier

@tbavelier tbavelier commented Aug 5, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Strips metadata.managedFields from 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-of label on resource types managed by the DatadogAgent reconcilers. Stale-resource cleanup then used client.MatchingFields to avoid scanning every cached object of each type.

Staging profiling on genesect and entei showed no consistent memory or CPU improvement, while reconcile p99 improved only on genesect and regressed on entei. The indexing changes were therefore removed to avoid the additional manager setup, fake-client wiring, and test complexity.

Minimum Agent Versions

  • Agent: N/A
  • Cluster Agent: N/A

Describe your test plan

Automated coverage verifies that the default cache transform removes managed fields. go test ./pkg/config and make lint pass.

QA: This will be tested in staging by validating normal reconciliation and cache behavior.

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label
  • All commits are signed (see: signing commits)

@tbavelier tbavelier added qa/skip-qa enhancement New feature or request labels Aug 5, 2026 — with ChatGPT Codex Connector
@tbavelier tbavelier added this to the v1.30.0 milestone Aug 5, 2026
@tbavelier
tbavelier force-pushed the tbavelier/controller-runtime-cache-optimizations branch from 5286b35 to f486148 Compare August 5, 2026 08:34
@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Aug 5, 2026

Copy link
Copy Markdown

Code Coverage

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 47.75% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 63bc16e | Docs | Datadog PR Page | Give us feedback!

@tbavelier
tbavelier force-pushed the tbavelier/controller-runtime-cache-optimizations branch from f486148 to 63bc16e Compare August 5, 2026 11:17
@tbavelier tbavelier changed the title Optimize controller-runtime cache usage Strip managed fields from controller-runtime cache Aug 5, 2026
@tbavelier
tbavelier marked this pull request as ready for review August 5, 2026 11:22
@tbavelier
tbavelier requested a review from a team August 5, 2026 11:22
@tbavelier
tbavelier merged commit d8aa04f into main Aug 5, 2026
39 checks passed
@tbavelier
tbavelier deleted the tbavelier/controller-runtime-cache-optimizations branch August 5, 2026 13:19
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.

2 participants