-
Notifications
You must be signed in to change notification settings - Fork 146
[CONTP-1503] Add standalone DatadogCSIDriver controller #2856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gh-worker-dd-mergequeue-cf854d
merged 14 commits into
main
from
tbavelier/csi-driver-standalone-v2
Apr 8, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2454b86
Add DatadogCSIDriver CRD types and generated manifests
tbavelier 3e5e846
Add DatadogCSIDriver outer controller with RBAC markers
tbavelier af2010c
Add DatadogCSIDriver reconciler, DaemonSet and CSIDriver builders
tbavelier fae3f32
Wire DatadogCSIDriver controller into operator startup
tbavelier 2034c4d
Merge branch 'main' into tbavelier/csi-driver-standalone-v2
tbavelier 0d23610
remove unnecessary variable declaration
tbavelier a98d54c
fix test after merging main
tbavelier e81e212
Scope csidriver RBAC to Datadog driver
tbavelier 9633847
Add comment why these were re-implemented but could be extracted for …
tbavelier 08bf9c1
Move DD_APM_ENABLED to shared controller constants
tbavelier 2b7940c
Move image tag and registries to proper package and delete defaults.g…
tbavelier 877cf9c
Remove useless variable after constant driver name
tbavelier 2174793
Switch to context based logging
tbavelier 9cd13e2
Merge branch 'main' into tbavelier/csi-driver-standalone-v2
tbavelier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| // Unless explicitly stated otherwise all files in this repository are licensed | ||
| // under the Apache License Version 2.0. | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
| // Copyright 2016-present Datadog, Inc. | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| corev1 "k8s.io/api/core/v1" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
|
||
| "github.com/DataDog/datadog-operator/api/datadoghq/common" | ||
| "github.com/DataDog/datadog-operator/api/datadoghq/v2alpha1" | ||
| ) | ||
|
|
||
| // CSI driver container name constants | ||
| const ( | ||
| CSINodeDriverContainerName = "csi-node-driver" | ||
| CSINodeDriverRegistrarContainerName = "csi-node-driver-registrar" | ||
| ) | ||
|
|
||
| // DatadogCSIDriverSpec defines the desired state of DatadogCSIDriver | ||
| // +k8s:openapi-gen=true | ||
| type DatadogCSIDriverSpec struct { | ||
| // CSIDriverImage is the image configuration for the main CSI node driver container. | ||
| // Default image: gcr.io/datadoghq/csi-driver:1.2.1 | ||
| // +optional | ||
| CSIDriverImage *v2alpha1.AgentImageConfig `json:"csiDriverImage,omitempty"` | ||
|
|
||
| // RegistrarImage is the image configuration for the CSI node driver registrar sidecar. | ||
| // Default image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.0.1 | ||
| // +optional | ||
| RegistrarImage *v2alpha1.AgentImageConfig `json:"registrarImage,omitempty"` | ||
|
|
||
| // APMSocketPath is the host path to the APM socket. | ||
| // Default: /var/run/datadog/apm.socket | ||
| // +optional | ||
| APMSocketPath *string `json:"apmSocketPath,omitempty"` | ||
|
|
||
| // DSDSocketPath is the host path to the DogStatsD socket. | ||
| // Default: /var/run/datadog/dsd.socket | ||
| // +optional | ||
| DSDSocketPath *string `json:"dsdSocketPath,omitempty"` | ||
|
|
||
| // Override allows customization of the CSI driver DaemonSet pod template. | ||
| // +optional | ||
| Override *DatadogCSIDriverOverride `json:"override,omitempty"` | ||
| } | ||
|
|
||
| // DatadogCSIDriverOverride provides override capabilities for the CSI driver DaemonSet. | ||
| // +k8s:openapi-gen=true | ||
| type DatadogCSIDriverOverride struct { | ||
| // AdditionalLabels provides labels that are added to the CSI driver DaemonSet pods. | ||
| // +optional | ||
| Labels map[string]string `json:"labels,omitempty"` | ||
|
|
||
| // Annotations provides annotations that are added to the CSI driver DaemonSet pods. | ||
| // +optional | ||
| Annotations map[string]string `json:"annotations,omitempty"` | ||
|
|
||
| // NodeSelector is a map of key-value pairs. For the CSI driver pod to run on a | ||
| // specific node, the node must have these key-value pairs as labels. | ||
| // +optional | ||
| NodeSelector map[string]string `json:"nodeSelector,omitempty"` | ||
|
|
||
| // Tolerations configure the CSI driver DaemonSet pod tolerations. | ||
| // +optional | ||
| // +listType=atomic | ||
| Tolerations []corev1.Toleration `json:"tolerations,omitempty"` | ||
|
|
||
| // Affinity specifies the pod's scheduling constraints. | ||
| // +optional | ||
| Affinity *corev1.Affinity `json:"affinity,omitempty"` | ||
|
|
||
| // PriorityClassName indicates the pod's priority. | ||
| // +optional | ||
| PriorityClassName *string `json:"priorityClassName,omitempty"` | ||
|
|
||
| // SecurityContext holds pod-level security attributes. | ||
| // +optional | ||
| SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"` | ||
|
|
||
| // UpdateStrategy is the DaemonSet update strategy configuration. | ||
| // +optional | ||
| UpdateStrategy *common.UpdateStrategy `json:"updateStrategy,omitempty"` | ||
|
tbavelier marked this conversation as resolved.
|
||
|
|
||
| // Containers allows overriding container-level configuration for the CSI driver containers. | ||
| // Valid keys are: "csi-node-driver" and "csi-node-driver-registrar". | ||
| // +optional | ||
| Containers map[string]*v2alpha1.DatadogAgentGenericContainer `json:"containers,omitempty"` | ||
|
|
||
| // Volumes specifies additional volumes to add to the CSI driver DaemonSet pods. | ||
| // +optional | ||
| // +listType=map | ||
| // +listMapKey=name | ||
| Volumes []corev1.Volume `json:"volumes,omitempty"` | ||
|
|
||
| // Env specifies additional environment variables for all containers. | ||
| // +optional | ||
| // +listType=map | ||
| // +listMapKey=name | ||
| Env []corev1.EnvVar `json:"env,omitempty"` | ||
|
|
||
| // ServiceAccountName sets the ServiceAccount used by the CSI driver DaemonSet. | ||
| // +optional | ||
| ServiceAccountName *string `json:"serviceAccountName,omitempty"` | ||
| } | ||
|
|
||
| // DatadogCSIDriverStatus defines the observed state of DatadogCSIDriver | ||
| // +k8s:openapi-gen=true | ||
| type DatadogCSIDriverStatus struct { | ||
| // ObservedGeneration is the most recent generation observed for this resource. | ||
| // +optional | ||
| ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
|
|
||
| // Conditions represents the latest available observations of the DatadogCSIDriver's current state. | ||
| // +optional | ||
| // +listType=map | ||
| // +listMapKey=type | ||
| Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
|
|
||
| // DaemonSet tracks the status of the CSI driver DaemonSet. | ||
| // +optional | ||
| DaemonSet *v2alpha1.DaemonSetStatus `json:"daemonSet,omitempty"` | ||
|
|
||
| // CSIDriverName is the name of the managed CSIDriver Kubernetes object. | ||
| // +optional | ||
| CSIDriverName string `json:"csiDriverName,omitempty"` | ||
| } | ||
|
|
||
| // DatadogCSIDriver is the Schema for the datadogcsidrivers API | ||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:subresource:status | ||
| // +kubebuilder:resource:path=datadogcsidrivers,shortName=ddcsi | ||
| // +kubebuilder:printcolumn:name="status",type="string",JSONPath=".status.daemonSet.status" | ||
| // +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp" | ||
| // +k8s:openapi-gen=true | ||
| type DatadogCSIDriver struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec DatadogCSIDriverSpec `json:"spec,omitempty"` | ||
| Status DatadogCSIDriverStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // DatadogCSIDriverList contains a list of DatadogCSIDriver | ||
| // +kubebuilder:object:root=true | ||
| type DatadogCSIDriverList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []DatadogCSIDriver `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&DatadogCSIDriver{}, &DatadogCSIDriverList{}) | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we miss this option?
https://github.com/DataDog/helm-charts/blob/0cc29a3c2e7107bc9de81e68137517b0087209a1/charts/datadog-csi-driver/values.yaml#L65-L70
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, by "design", I did not include it in the CRD to have it default true, and users have the possibility of disabling it with an override should they desire: do you think it should be present in the CRD, do we expect users (tho we mostly expect people to rely on automatic creation from DDA ?) to play with it a lot ? Do we expect more fields in the APM section in the future / does it belong within a struct with other options we expect to introduce ?
Here's how it can be disabled at the moment (override takes precedence on any default/already set variable):