Skip to content

[CONTP-1709] Support enabling datadoginstrumentation crd controller#3002

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 10 commits into
mainfrom
mathew.estafanous/instrumentation-crd-feature
Jun 10, 2026
Merged

[CONTP-1709] Support enabling datadoginstrumentation crd controller#3002
gh-worker-dd-mergequeue-cf854d[bot] merged 10 commits into
mainfrom
mathew.estafanous/instrumentation-crd-feature

Conversation

@Mathew-Estafanous

@Mathew-Estafanous Mathew-Estafanous commented May 12, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Enables the DatadogInstrumentation CRD controller in the cluster agent, when the cluster agent version meets the minimum requirement (>= 7.81.0). Users can opt in via the agent.datadoghq.com/instrumentation-crd-enabled: "false" annotation on the DatadogAgent resource.

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_ENABLED to 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

  1. Added unit tests in instrumentationcrd/feature_test.go.

Manual QA

  1. Deploy custom operator
  2. Deploy DDA (no extra config needed — feature is on by default):
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
  name: datadog
spec:
  global:
    logLevel: "info"
    clusterName: <YOUR_CLUSTER_NAME>
    credentials:
      apiSecret:
        secretName: datadog-secret
        keyName: api-key
      appSecret:
        secretName: datadog-secret
        keyName: app-key
    kubelet:
      tlsVerify: false
  features:
    apm:
      instrumentation:
        enabled: true
  1. Check that DCA and node agents have DD_INSTRUMENTATION_CRD_CONTROLLER_ENABLED: "true"
image
  1. A cluster role and binding created with necessary datadoginstrumentation RBACs.
image image

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label
  • All commits are signed (see: signing commits)

@Mathew-Estafanous Mathew-Estafanous self-assigned this May 12, 2026
@Mathew-Estafanous Mathew-Estafanous added this to the v1.27.0 milestone May 12, 2026
@Mathew-Estafanous Mathew-Estafanous added the enhancement New feature or request label May 12, 2026
@Mathew-Estafanous Mathew-Estafanous changed the title feat: add instrumentation controller crd feature feat: Add instrumentation controller crd feature May 12, 2026
@Mathew-Estafanous
Mathew-Estafanous marked this pull request as ready for review May 12, 2026 12:58
@Mathew-Estafanous
Mathew-Estafanous requested a review from a team May 12, 2026 12:58
@Mathew-Estafanous
Mathew-Estafanous requested review from a team as code owners May 12, 2026 12:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b15c1b4da

ℹ️ 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".

Comment thread config/manager/kustomization.yaml Outdated
Comment on lines +108 to +109
func (f *instrumentationCRDFeature) ManageSingleContainerNodeAgent(feature.PodTemplateManagers, string) error {
return nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Configure instrumentation env var for single-container agents

The new feature never configures node-agent env vars when SingleContainerStrategy is used because ManageSingleContainerNodeAgent is a no-op. In that mode the reconciler calls ManageSingleContainerNodeAgent instead of ManageNodeAgent, so DD_INSTRUMENTATION_CRD_CONTROLLER_ENABLED is not added to the node agent container and the instrumentation CRD flow is only partially enabled.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single container node is a legacy configuration and won't be supported by this feature.

@Mathew-Estafanous
Mathew-Estafanous force-pushed the mathew.estafanous/instrumentation-crd-feature branch from 2b15c1b to c216052 Compare May 12, 2026 13:07
@codecov-commenter

codecov-commenter commented May 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.85714% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.32%. Comparing base (f6aeb7b) to head (e83efa3).
⚠️ Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
...datadogagent/feature/instrumentationcrd/feature.go 61.76% 25 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (62.85%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3002      +/-   ##
==========================================
+ Coverage   43.56%   44.32%   +0.75%     
==========================================
  Files         343      354      +11     
  Lines       29771    30785    +1014     
==========================================
+ Hits        12970    13645     +675     
- Misses      15967    16261     +294     
- Partials      834      879      +45     
Flag Coverage Δ
unittests 44.32% <62.85%> (+0.75%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...roller/datadogagent/component/clusteragent/rbac.go 22.88% <ø> (-42.54%) ⬇️
internal/controller/datadogagent/controller.go 52.94% <ø> (+4.94%) ⬆️
...r/datadogagent/feature/instrumentationcrd/const.go 100.00% <100.00%> (ø)
...nal/controller/datadogagent/feature/utils/utils.go 0.00% <ø> (ø)
...datadogagent/feature/instrumentationcrd/feature.go 61.76% <61.76%> (ø)

... and 23 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6aeb7b...e83efa3. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@datadog-official

datadog-official Bot commented May 12, 2026

Copy link
Copy Markdown

Code Coverage  Pipelines

Fix all issues with BitsAI

🛑 Gate Violations

🎯 1 Code Coverage issue detected

A Patch coverage percentage gate may be blocking this PR.

Patch coverage: 63.64% (threshold: 80.00%)

⚠️ Warnings

🚦 1 Pipeline job failed

DataDog/datadog-operator | build_operator_image_fips_arm64   View in Datadog   GitLab

ℹ️ Info

🎯 Code Coverage (details)
Patch Coverage: 63.64%
Overall Coverage: 44.60% (+0.69%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e83efa3 | Docs | Datadog PR Page | Give us feedback!

@Mathew-Estafanous Mathew-Estafanous modified the milestones: v1.27.0, v1.28.0 May 12, 2026

@levan-m levan-m left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. will approve once switched to experimental annotation.

@Mathew-Estafanous Mathew-Estafanous changed the title feat: Add instrumentation controller crd feature [CONTP-1709] Enable datadoginstrumentation crd controller by default Jun 9, 2026
@Mathew-Estafanous Mathew-Estafanous changed the title [CONTP-1709] Enable datadoginstrumentation crd controller by default [CONTP-1709] Support enabling datadoginstrumentation crd controller Jun 10, 2026
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 25a5943 into main Jun 10, 2026
51 of 53 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the mathew.estafanous/instrumentation-crd-feature branch June 10, 2026 18:51
Mathew-Estafanous added a commit that referenced this pull request Jun 11, 2026
…3002) (#3125)

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



(cherry picked from commit 25a5943)

Co-authored-by: Mathew Estafanous <[email protected]>
Co-authored-by: levan-m <[email protected]>
Co-authored-by: mathew.estafanous <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants