Skip to content

feat: Add instrumentation controller crd feature#3002

Open
Mathew-Estafanous wants to merge 4 commits into
mainfrom
mathew.estafanous/instrumentation-crd-feature
Open

feat: Add instrumentation controller crd feature#3002
Mathew-Estafanous wants to merge 4 commits into
mainfrom
mathew.estafanous/instrumentation-crd-feature

Conversation

@Mathew-Estafanous
Copy link
Copy Markdown
Contributor

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

What does this PR do?

Adds a feature.instrumentationCRD feature that'll be used to enable the DatadogInstrumentation CRD controller in the cluster agent and node agent's AD provider.

The feature depends on:

  1. Admission controller being enabled.
  2. Cluster Agent RBACs added (done automatically).

Motivation

Without this feature, enabling instrumentation CRD controller requires manually adding DD_INSTRUMENTATION_CRD_CONTROLLER_ENABLED to both cluster and node agents. Additionally there'd be no enforcement of admission controller or rbac pre-requisites.

Minimum Agent Versions

Are there minimum versions of the Datadog Agent and/or Cluster Agent required?

  • Agent: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

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

Manual QA

  1. Deploy custom operator
  2. Deploy DDA with instrumentationCRD enabled.
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:
    instrumentationCRD:
      enabled: true
    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
Copy link
Copy Markdown

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

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 👍 / 👎.

@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
Copy link
Copy Markdown

codecov-commenter commented May 12, 2026

Codecov Report

❌ Patch coverage is 51.21951% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.59%. Comparing base (bed889f) to head (d8fdb7f).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...datadogagent/feature/instrumentationcrd/feature.go 60.60% 24 Missing and 2 partials ⚠️
pkg/testutils/builder.go 0.00% 7 Missing ⚠️
pkg/testutils/ddai_builder.go 0.00% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3002      +/-   ##
==========================================
- Coverage   40.76%   40.59%   -0.17%     
==========================================
  Files         332      334       +2     
  Lines       28197    28272      +75     
==========================================
- Hits        11494    11477      -17     
- Misses      15928    16018      +90     
- Partials      775      777       +2     
Flag Coverage Δ
unittests 40.59% <51.21%> (-0.17%) ⬇️

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 48.00% <ø> (ø)
...r/datadogagent/feature/instrumentationcrd/const.go 100.00% <100.00%> (ø)
pkg/testutils/builder.go 0.00% <0.00%> (ø)
pkg/testutils/ddai_builder.go 0.00% <0.00%> (ø)
...datadogagent/feature/instrumentationcrd/feature.go 60.60% <60.60%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bed889f...d8fdb7f. 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
Copy link
Copy Markdown

datadog-official Bot commented May 12, 2026

Code Coverage

Fix all issues with BitsAI

🛑 Gate Violations

🎯 1 Code Coverage issue detected

A Patch coverage percentage gate may be blocking this PR.

Patch coverage: 52.38% (threshold: 80.00%)

ℹ️ Info

🎯 Code Coverage (details)
Patch Coverage: 52.38%
Overall Coverage: 40.88% (-0.19%)

Useful? React with 👍 / 👎

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

@Mathew-Estafanous Mathew-Estafanous modified the milestones: v1.27.0, v1.28.0 May 12, 2026
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.

4 participants