[Backport v1.28] [CONTP-1709] Support enabling datadoginstrumentation crd controller#3125
Conversation
…3002) feat: add instrumentation controller crd feature fix: remove default rbac test chore: add instrumentation env var to single container chore: change rbac name Merge branch 'main' into mathew.estafanous/instrumentation-crd-feature switch to annotation (#3080) * switch to annotation * fix linter instrumentation crd feature on by default minimum required version is 7.81 enable feature with annotation switch to disable by default Co-authored-by: levan-m <[email protected]> Co-authored-by: mathew.estafanous <[email protected]> (cherry picked from commit 25a5943)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90be8d0bf1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| managers.EnvVar().AddEnvVarToContainer( | ||
| apicommon.UnprivilegedSingleAgentContainerName, | ||
| &corev1.EnvVar{ | ||
| Name: DDInstrumentationCRDControllerEnabled, | ||
| Value: "true", |
There was a problem hiding this comment.
Do not enable the DCA controller on node agents
The DDAI agent reconciler calls ManageSingleContainerNodeAgent/ManageNodeAgent for every enabled feature while building the node-agent DaemonSet, so enabling the annotation also injects DD_INSTRUMENTATION_CRD_CONTROLLER_ENABLED=true into node-agent pods (and the multi-container method below does the same). This variable is the cluster-agent controller switch, while the RBAC added by this feature is bound only to the cluster-agent ServiceAccount, so node agents can start the controller without the permissions it needs; these NodeAgent methods should no-op.
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.28 #3125 +/- ##
==========================================
- Coverage 43.44% 43.31% -0.14%
==========================================
Files 350 352 +2
Lines 29994 30049 +55
==========================================
- Hits 13031 13015 -16
- Misses 16091 16161 +70
- Partials 872 873 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
🛑 Gate Violations
ℹ️ Info🎯 Code Coverage (details) Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 90be8d0 | Docs | Datadog PR Page | Give us feedback! |
Backport 25a5943 from #3002.
What does this PR do?
Enables the
DatadogInstrumentationCRD controller in the cluster agent, when the cluster agent version meets the minimum requirement (>= 7.81.0). Users can opt in via theagent.datadoghq.com/instrumentation-crd-enabled: "false"annotation on theDatadogAgentresource.Necessary RBACs for the controller to operate are automatically added when the feature is enabled.
Motivation
Previously, enabling the instrumentation CRD controller required manually adding
DD_INSTRUMENTATION_CRD_CONTROLLER_ENABLEDto both cluster and node agents. There was also no enforcement of the admission controller or RBAC prerequisites. This PR wires it up automatically for users meeting the version threshold.Describe how you validated your changes
instrumentationcrd/feature_test.go.Manual QA
Check that DCA and node agents have
DD_INSTRUMENTATION_CRD_CONTROLLER_ENABLED: "true"<img width="511" height="61" alt="image" src="https://github.com/user-attachments/assets/997d5648-2fd7-4e40-aabe-962ebbb95df8" />
A cluster role and binding created with necessary datadoginstrumentation RBACs.
<img width="1301" height="111" alt="image" src="https://github.com/user-attachments/assets/b7210b81-b862-43ae-9f86-56f60b48227b" />
<img width="1175" height="83" alt="image" src="https://github.com/user-attachments/assets/e7d3fa42-7053-45b0-81d0-58d1fbfd8e85" />
Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel