[Backport v1.26] Add cache namespace options for DatadogCSIDriver controller#2940
Merged
[Backport v1.26] Add cache namespace options for DatadogCSIDriver controller#2940
Conversation
* Add DdCSIDriver cache env var * Fix DaemonSet cache coverage for DatadogCSIDriver in separate namespace When DD_CSIDRIVER_WATCH_NAMESPACE differs from DD_AGENT_WATCH_NAMESPACE, the owned DaemonSet falls outside DefaultNamespaces, causing cache errors. Explicitly add DaemonSet to ByObject with the union of both namespace sets. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit f41ef99)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.26 #2940 +/- ##
==========================================
+ Coverage 40.67% 40.68% +0.01%
==========================================
Files 321 321
Lines 28482 28492 +10
==========================================
+ Hits 11584 11593 +9
- Misses 16043 16044 +1
Partials 855 855
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
tbavelier
approved these changes
Apr 27, 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.
Backport f41ef99 from #2934.
What does this PR do?
Adds cache namespace configuration for the
DatadogCSIDrivercontroller, consistent with all other controllers.Introduces
DD_CSIDRIVER_WATCH_NAMESPACEenv var (falls back toWATCH_NAMESPACE), wiresDatadogCSIDriverEnabledintoconfig.CacheOptions(), and adds test coverage.Motivation
The
DatadogCSIDrivercontroller was the only controller missing its own cache namespace entry. Without it, the controller fell back toDefaultNamespaces(driven byDD_AGENT_WATCH_NAMESPACE/WATCH_NAMESPACE) instead of having its ownDD_CSIDRIVER_WATCH_NAMESPACEoverride.Additionally,
DatadogCSIDriveris unique among controllers in that it creates and reconciles a native k8sDaemonSet, which must also be accessible from the cache. If the CSIDriver is deployed in a different namespace than the agent (e.g.DD_CSIDRIVER_WATCH_NAMESPACE=default,DD_AGENT_WATCH_NAMESPACE=system), theDaemonSetfalls outsideDefaultNamespacesand causes:The fix explicitly adds
DaemonSettoByObjectwith the union of agent and CSIDriver namespaces. UsingDefaultNamespacesinstead would over-cache all other GVKs (Secrets, ConfigMaps, etc.) in the CSIDriver namespace unnecessarily.Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel