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 label-based ownership (part-of pattern) - DaemonSet management with drift detection via generation tracking - 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 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>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2844 +/- ##
==========================================
+ Coverage 39.24% 39.74% +0.50%
==========================================
Files 314 318 +4
Lines 27288 27812 +524
==========================================
+ Hits 10708 11054 +346
- Misses 15792 15944 +152
- Partials 788 814 +26
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:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87ed63e94c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if current.Labels == nil || | ||
| current.Labels[kubernetes.AppKubernetesManageByLabelKey] != "datadog-operator" || | ||
| current.Labels[kubernetes.AppKubernetesPartOfLabelKey] != expectedPartOf { | ||
| logger.Info("Updating CSIDriver ownership labels", "csidriver", driverName) |
There was a problem hiding this comment.
Reconcile CSIDriver spec drift on existing objects
When a CSIDriver already exists, this branch only checks ownership labels and returns without reconciling current.Spec against buildCSIDriverObject(instance).Spec. That means out-of-band edits to fields like attachRequired, podInfoOnMount, or lifecycle modes will persist indefinitely, even though the controller watches CSIDriver events for drift. The result is that the operator can report success while leaving an unintended CSI API configuration in place.
Useful? React with 👍 / 👎.
| return ctrl.Result{}, nil | ||
| } | ||
|
|
||
| driverName := getCSIDriverName(instance) |
There was a problem hiding this comment.
Track previous CSIDriver name for finalizer cleanup
Finalizer cleanup always deletes only getCSIDriverName(instance), i.e. the current spec value. If .spec.csiDriverName is changed from one name to another, reconcile can create/manage the new object but the previously managed cluster-scoped CSIDriver is never removed; deleting the CR later cleans up only the latest name and leaves the old one orphaned.
Useful? React with 👍 / 👎.
|
|
||
| // SecurityContext holds pod-level security attributes. | ||
| // +optional | ||
| SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"` |
There was a problem hiding this comment.
Nevermind, I have just noticed we also have pod level security context in helm here.
And in the operator we can override container-level security context via the container overrides.
|
Replaced with #2856 |
What does this PR do?
DatadogCSIDriverCRD and controllerMotivation
Additional Notes
This is best reviewed commit by commit:
Minimum Agent Versions
Are there minimum versions of the Datadog Agent and/or Cluster Agent required?
Describe your test plan
TBD
Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel