Start supporting the use case of no cluster agent #3549
<picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok-light.svg" alt="Pipelines" align="center" /></picture> <a target='_blank' href='https://app.datadoghq.com/ci/code-coverage/github.com%2Fdatadog%2Fdatadog-operator/pull-requests/3549'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/code-coverage-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/code-coverage-ok-light.svg" alt="Code Coverage" align="center" /></picture></a>
🎯 Code Coverage (<a target='_blank' href='https://app.datadoghq.com/ci/code-coverage/github.com%2Fdatadog%2Fdatadog-operator/pull-requests/3549'>details</a>)<br>• <strong><span title="Percentage of modified executable lines covered by tests in this PR">Patch Coverage</span></strong>: 92.86%<br>• <strong><span title="Percentage of all executable lines covered by tests in the entire codebase">Overall Coverage</span></strong>: 53.95% <span title="Change in overall coverage compared to the base branch">(+1.43%)</span><br>
<sub>
This comment will be updated automatically if new data arrives. <br />
🔗 Commit SHA: 4d3b88e | <a href="https://docs.datadoghq.com/integrations/guide/source-code-integration/#pr-comments">Docs</a> | <a href="https://app.datadoghq.com/ci/pull-request/Z2l0aHViLmNvbS9kYXRhZG9nL2RhdGFkb2ctb3BlcmF0b3IvMzU0OQ==?referrer=pr-comment">View more details</a> | Give us <a href="https://dd.enterprise.slack.com/archives/C07E3U2QRMM">feedback</a>!
</sub>
This explicit override is skipped with SingleContainerStrategy: reconciliation calls ManageSingleContainerNodeAgent instead of this method, and that hook is still a no-op. A disabled service-discovery feature therefore omits DD_DISCOVERY_ENABLED=false from the unprivileged single-agent container, allowing the Agent >= 7.78 default to enable it again. Please have the single-container hook write the resolved value to UnprivilegedSingleAgentContainerName and add a regression case for that strategy.
<!-- ccr-overview-v2 -->
Copilot review overview
🟡 Changes recommended
Disabled service discovery is not propagated when using the single-container strategy.
Review effort: Balanced
Findings: 1 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture>
<details open>
<summary><strong>Open (1)</strong></summary>
</details>
<details>
<summary><strong>What changed in this PR</strong></summary>
Adds support for running node agents without a Cluster Agent.
Changes:
| File | Description |
| ---- | ----------- |
| feature/servicediscovery/feature.go | Explicitly configures service discovery state. |
| feature/servicediscovery/feature_test.go | Tests explicit disabling. |
| feature/orchestratorexplorer/feature.go | Skips Cluster Agent resources when disabled. |
| feature/orchestratorexplorer/feature_test.go | Tests disabled Cluster Agent behavior. |
| feature/kubernetesstatecore/feature.go | Suppresses KSM Core resources. |
| feature/kubernetesstatecore/feature_test.go | Tests suppression. |
| feature/kubernetesactions/feature.go | Disables Kubernetes Actions. |
| feature/kubernetesactions/feature_test.go | Tests disabling. |
| feature/instrumentationcrd/feature.go | Disables Instrumentation CRD integration. |
| feature/instrumentationcrd/feature_test.go | Tests disabling. |
| feature/helmcheck/feature.go | Suppresses Helm check resources. |
| feature/helmcheck/feature_test.go | Tests suppression. |
| feature/externalmetrics/feature.go | Suppresses external metrics resources. |
| feature/externalmetrics/feature_test.go | Tests suppression. |
| feature/eventcollection/feature.go | Suppresses event collection resources. |
| feature/eventcollection/feature_test.go | Tests suppression. |
| feature/enabledefault/feature.go | Overrides Cluster Agent availability environment variables. |
| feature/enabledefault/feature_test.go | Tests environment overrides. |
| feature/cspm/feature.go | Disables CSPM without a Cluster Agent. |
| feature/cspm/feature_test.go | Tests disabling. |
| feature/controlplanemonitoring/feature.go | Suppresses control-plane monitoring resources. |
| feature/controlplanemonitoring/feature_test.go | Tests suppression. |
| feature/autoscaling/feature.go | Disables Cluster Agent-backed autoscaling. |
| feature/autoscaling/feature_test.go | Tests disabling. |
| feature/appsec/feature.go | Disables AppSec injection. |
| feature/appsec/feature_test.go | Tests disabling. |
| feature/admissioncontroller/feature.go | Prevents unbacked admission webhooks. |
| feature/admissioncontroller/feature_test.go | Tests disabling. |
</details>
---
💡 <a href="/DataDog/datadog-operator/new/main?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>
<sub><sub>!P2 Badge</sub></sub> Mark the supported no-Cluster-Agent mode as non-conflicting
When clusterAgent.disabled is true, this only records a flag; the returned ClusterAgent.IsRequired remains true. checkComponentEnabledWithOverride therefore treats every no-Cluster-Agent DDAI as an OverrideReconcileConflict and the component reconciler persists that condition, even though the new documentation presents this as a supported configuration. Return a false Cluster Agent requirement in this mode so normal no-DCA installations do not remain in a conflict status.
Useful? React with 👍 / 👎.
<sub><sub>!P2 Badge</sub></sub> Disable default Cluster Checks with the Cluster Agent
Cluster Checks is defaulted to enabled, but feature/clusterchecks.Configure has no clusterAgent.disabled gate. Consequently this new no-Cluster-Agent configuration still enables the Cluster Checks provider on node agents (the committed golden contains DD_EXTRA_CONFIG_PROVIDERS=clusterchecks endpointschecks) even though this change removes the Cluster Agent Service that schedules those checks. Gate Cluster Checks along with the other Cluster-Agent-only features before documenting it as automatically disabled.
Useful? React with 👍 / 👎.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d915997ba
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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".
</details>
This false wins over every feature requirement during merging, but not every Cluster-Agent-only feature is gated on the override. In particular, privateactionrunner.Configure still marks the Cluster Agent required for cluster-agent.datadoghq.com/private-action-runner-enabled; it is classified as enabled before this merge and ManageDependencies still creates its Cluster Agent ConfigMap (and can trigger the GKE Autopilot rejection gate), while this value silently suppresses the Deployment. Gate the cluster-side private action runner on override.clusterAgent.disabled as well, or centralize filtering of Cluster-Agent-only features before enabled-feature/dependency processing.
<!-- ccr-overview-v2 -->
Copilot review overview
🟡 Changes recommended
Cluster-side private action runner configuration remains enabled and can create dependencies or block reconciliation when the Cluster Agent is disabled.
Review effort: Balanced
Findings: 1 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture>
<details open>
<summary><strong>Open (1)</strong></summary>
</details>
<details>
<summary><strong>Resolved since last review (1)</strong></summary>
</details>
Approved these changes.
The explicit false now masks the Cluster Agent requirement from APM single-step instrumentation, but APM has not been taught to honor this override. feature/apm.Configure still initializes SSI and ManageNodeAgent can enable language-detection reporting when SSI is enabled, while this merge prevents the Cluster Agent that serves the admission instrumentation from being deployed. Gate only the SSI portion of APM on override.clusterAgent.disabled (while preserving ordinary node APM) so this does not produce another half-configured Cluster-Agent-dependent feature.
<!-- ccr-overview-v2 -->
Copilot review overview
🟡 Changes recommended
APM single-step instrumentation remains partially configured node-side even though its Cluster Agent requirement is masked.
Review effort: Balanced
Findings: 1 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture>
<details open>
<summary><strong>Open (1)</strong></summary>
</details>
<details>
<summary><strong>Resolved since last review (1)</strong></summary>
</details>
False positive, test added to verify
minor nit: unsure if the init containers care about this value
I don't think the service discovery feature is related to the Cluster Agent. This feature isn't about k8s services. For whatever reason a service == a process which can be detected on the Agent via system-probe / system-probe-lite. This should remain on without the cluster agent.
edge case: the datadog agent profiles set cluster agent to be disabled on the profiles because we don't want to re-create the DCA. However, the user may still have the DCA enabled in the original DDA. This would result in all Agents in profiles not being able to contact the cluster agent?
https://github.com/DataDog/datadog-operator/pull/3586 would fix that edge case and needs to be merged alongside (ideally this is before/same day so that nightly images don't bug)... still thinking about other potential solutions.
Approved these changes.
@agagniere, I changed milestone to 1.33 for to have a bit more time for reviewing and possibly changing the approach.
override.Component.disabled conflates 'don't create component' with 'component doesn't exist' which leads to issues @gabedos mentioned above.
DCA disabled check is in the wrong place in my opinion. Bunch of features duplicate identical check to compute required components based on the override and exit early. requiredComponent is more nuanced, based on what product/feature/component is enabled since features may still work without some of the components. E.g. kubernetesstatecore can run on node agents without DCA and collect limited telemetry.
I think handling clusterAgent.disabled shouldn't be solved on feature level, rather on DDA/DDAI where each DDAI can get a clear signal whether it owns the component, uses existing component or component doesn't exist at all.
@levan-m So if I understand correctly, you would prefer a toggle to disable the cluster agent outside of override ? Works for me, which team shall own this change ?
dd-gplassard
agagniere
What does this PR do?
When the cluster agent is disabled, others components like the core agent should know about it, to stop trying to contact it.
1.
DD_CLUSTER_AGENT_ENABLEDhardcoded "true" — the foundational switch the node agent uses to decide whether to even try reaching a cluster agent. Wrong on every single node-agent container and the init-config init container, regardless of config. Root cause behind several of the symptoms below.2. admissionController — runs a webhook server inside the cluster agent. With it disabled, the Service/RBAC still got created and webhooks still registered pointing at nothing — the Kubernetes API server would block pod admission trying to reach a webhook with no backend. Most severe single-feature bug; this is an outage risk, not just an orphan.
3. instrumentationCrd — defaults to enabled (agent ≥ 7.82.0). Node agent kept registering the instrumentation-checks autodiscovery provider and spamming connection errors against a cluster agent Service that doesn't exist.
4. serviceDiscovery — explicit false silently dropped; agent's own ≥7.78.0 auto-on default won instead.
5. kubeStateMetricsCore — default-enabled, orphaned RBAC+ConfigMap bound to a nonexistent ServiceAccount.
6. eventCollection — default-enabled, same RBAC-orphan shape.
7. orchestratorExplorer — default-enabled, RBAC orphan (node-side disable env var was already correct, only the cluster-agent-side RBAC leaked).
8. controlPlaneMonitoring — default-enabled, orphaned ConfigMaps.
9. CSPM — opt-in, but ties node-side check requirement to the cluster agent requirement; same RBAC-orphan shape.
10. autoscaling — opt-in, RBAC orphan (already tagged for component-scoped cleanup, so lower practical risk, but still shouldn't be created).
11. helmCheck — opt-in, RBAC orphan.
12. kubernetesActions — opt-in, RBAC orphan.
13. externalMetricsServer — opt-in, orphaned Service/RBAC/APIService.
14. appsec injector — opt-in (annotation/CRD-gated), RBAC orphan; lowest blast radius since it requires the most explicit user configuration to trigger at all.
15. serviceDiscovery — the disabled-state env var fix (item 4) only covered
ManageNodeAgent;ManageSingleContainerNodeAgentwas still a no-op, so underSingleContainerStrategya disabled config never reached the unprivileged-single-agent container and the agent's own ≥7.78.0 auto-on default won anyway.16. DCA token Secret and Service — created unconditionally in
manageDDADependenciesWithDDAIregardless ofoverride.clusterAgent.disabled, left behind with no consumer.17.
DD_CLUSTER_AGENT_AUTH_TOKEN— written on the node agent based on merged feature requirements only, not the override; after fixing item 16 this left asecretKeyRefpointing at a Secret that no longer exists, which would have broken pod startup.18. enabledefault — always set
ClusterAgent.IsRequired: true, so merging it withoverride.clusterAgent.disabledmadecheckComponentEnabledWithOverridetreat every no-Cluster-AgentDatadogAgentas a feature/override conflict, persisting anOverrideReconcileConflictstatus condition on an otherwise supported configuration. Found by Copilot/Codex PR review.19. clusterChecks — default-enabled, no
clusterAgent.disabledgate at all; missed in the original audit. LeftDD_EXTRA_CONFIG_PROVIDERS=clusterchecks endpointscheckson the node agent pointing at a Cluster Agent that would never dispatch those checks. Found by Codex PR review.Motivation
For reInvent we want to provide DD features on top of the DDOT collector, and so require the DD agent, while features that can be done via OTel like k8s explorer are handled by DDOT. In particular this means that the cluster agent should not be present.
OTAGENT-1387
Testing
Added
testdata/no-cluster-agent-dda.yaml+ a golden-file fixture (internal/controller/testutils/renderer) that renders a DatadogAgent with the cluster agent disabled and several cluster-agent-dependent features (kubeStateMetricsCore, orchestratorExplorer, serviceDiscovery) also enabled, to lock in that no Cluster Agent Deployment/Service/RBAC/token Secret is produced and that the node agent resolves correctly on its own.Docs
Added a "Running without the Cluster Agent" section to
docs/cluster_agent_setup.mdplus an example manifest (examples/datadogagent/datadog-agent-without-clusteragent.yaml) — previouslyoverride.clusterAgent.disabledwas undocumented.Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel[1]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
[OTAGENT-1387]: https://datadoghq.atlassian.net/browse/OTAGENT-1387?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ