[CONTP-1504] Create DatadogCSIDriver from DDA when createDatadogCSIDriver=true#2857
Draft
[CONTP-1504] Create DatadogCSIDriver from DDA when createDatadogCSIDriver=true#2857
Conversation
Define the DatadogCSIDriver, DatadogCSIDriverSpec, DatadogCSIDriverOverride, and DatadogCSIDriverStatus types in api/datadoghq/v1alpha1. The CRD enables declarative management of the Datadog CSI Driver via the operator, replacing the standalone Helm chart deployment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Controller-runtime wiring for the DatadogCSIDriver reconciler. Watches the primary CR with GenerationChangedPredicate, owned DaemonSets for all changes (including status), and CSIDriver objects via label-based enqueue for drift detection on the cluster-scoped resource. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements the reconciliation logic for the DatadogCSIDriver controller: - Deferred SSA status patch with ObservedGeneration tracking - CSIDriver object management with Get+DeepEqual+Update for full drift reversion - DaemonSet management with the same pattern, including label enforcement - Override system with merge-by-name semantics (env vars, volumes, mounts) - Image resolution via pkg/images (supports tag-only overrides) - Finalizer-based cleanup of the cluster-scoped CSIDriver on deletion - Comprehensive unit tests covering creation, updates, drift, deletion, overrides Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Register the controller in setup.go with a feature flag and add the -datadogCSIDriverEnabled flag (default: false) to cmd/main.go. Also registers the storagev1 scheme required for CSIDriver object management. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Treat the DatadogCSIDriver as a desired-state object like DDAI: if someone modifies it externally, reconcile it back to the operator's desired state on the next loop. Uses apiequality.Semantic.DeepEqual to compare specs and kubernetes.UpdateFromObject to update. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2857 +/- ##
==========================================
+ Coverage 40.06% 40.12% +0.06%
==========================================
Files 319 320 +1
Lines 28039 28096 +57
==========================================
+ Hits 11233 11274 +41
- Misses 15983 15991 +8
- Partials 823 831 +8
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:
|
…te-ddcsi-from-dda
5 tasks
…o to consolide with const.go
…te-ddcsi-from-dda
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?
When
spec.global.csi.enabled=trueand the newspec.global.csi.createDatadogCSIDriver=truefield is set, the DatadogAgent controller automatically creates a DatadogCSIDriver custom resource owned by the DDA.This gives users a single-CR experience: configure CSI on their DatadogAgent and the operator handles creating the DatadogCSIDriver. The DatadogCSIDriver controller then reconciles it (DaemonSet, CSIDriver object, etc.).
Key behaviors:
createDatadogCSIDriverdefaults tofalse— no behavior change for existing usersMotivation
Simplify the user experience for CSI driver setup. Instead of requiring users to create both a DatadogAgent and a separate DatadogCSIDriver, they can opt into automatic creation from their DDA spec.
Additional Notes
--datadogCSIDriverEnabled).Minimum Agent Versions
N/A — this is an operator-level feature.
Describe your test plan
Unit tests in
ddcsi_test.gocover:Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel