enable discovery by default on supported agent versions#2598
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86e657310d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
86e6573 to
3818a56
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3818a56ce9
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3818a56 to
4ba7ff3
Compare
|
@codex review |
…vice-discovery-defaulting # Conflicts: # test/datadog/baseline/manifests/gke_autopilot_usm.yaml # test/datadog/baseline/manifests/usm_daemonset_default.yaml
|
- bump version for datadog to 3.202.0 (minor-version) - update changelog for datadog with version 3.202.0 - update readme for datadog
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4b4faa67d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
40871f3 to
f4b4faa
Compare
- bump version for observability-pipelines-worker to 2.15.5 (patch-version) - update changelog for observability-pipelines-worker with version 2.15.5 - update readme for observability-pipelines-worker
- update readme for observability-pipelines-worker
- update readme for observability-pipelines-worker
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
#2643) [datadog] auto-enable discovery on `latest` and `7` tags The `get-agent-version` fallback substituted `7.67.0` for the single-component tags `latest` and `7`, which is below the `>=7.78.0` threshold that auto-enables service discovery (introduced in #2598). As a result, users on these floating tags never got a system-probe container or `system-probe-lite`, despite the actual `latest` image supporting it. Bump the fallback to `7.78.0` so the chart treats `latest`/`7` like the current agent and auto-enables discovery with `system-probe-lite`. [datadog] expand 3.209.0 CHANGELOG entry to match PR scope The fallback bump affects several version-gated code paths besides discovery (ADP, -fips-full, standalone DDOT FIPS, DD_USE_DOGSTATSD). Reword the changelog so it matches the release note in the PR description. Merge remote-tracking branch 'origin/main' into vitkyrka/disco-latest # Conflicts: # charts/datadog/CHANGELOG.md Merge remote-tracking branch 'origin/main' into vitkyrka/disco-latest # Conflicts: # charts/datadog/CHANGELOG.md # charts/datadog/Chart.yaml # charts/datadog/README.md Co-authored-by: vincent.whitchurch <[email protected]>
### What does this PR do?
Adds a Kubernetes E2E sanity test for the Datadog Agent's discovery feature, mirroring (in spirit) the existing Linux VM suite in `test/new-e2e/tests/discovery/linux_test.go`. The new suite at `test/new-e2e/tests/discovery/k8s_test.go`:
- Provisions a Kind-on-EC2 cluster (`provkindvm`) with the agent installed via Helm and an `nginx` workload.
- Runs `TestNginxDiscovered` in two sub-tests covering both discovery modes:
- `system-probe-lite` — discovery enabled alone; the agent execs into `system-probe-lite` per `cmd/system-probe/subcommands/run/splite.go`.
- `system-probe` — adds `datadog.systemProbe.enableOOMKill: true` so the agent's `shouldExecSPLite` keeps the full binary running.
- Asserts on the matched nginx process: TCP port 80 listener, `ServiceDiscovery.GeneratedServiceName == {nginx, SOURCE_COMMAND_LINE}`, `ApmInstrumentation == false`, `InjectionState == NOT_INJECTED`, non-empty `ContainerId`.
- Pins the Helm chart version to `3.213.0`; the framework default (`3.155.1`) predates both the discovery template (chart 3.205.0, DataDog/helm-charts#2598) and the `latest`/`7` → `7.78.x` fallback fix (chart 3.213.0, DataDog/helm-charts#2643).
### Motivation
https://datadoghq.atlassian.net/browse/DSCVR-385
There is no k8s e2e for discovery today. DataDog/helm-charts#2634 fixed a bug in discovery on k8s related to the seccomp profile; the change went undetected before merge because nothing exercises the discovery flow on a Helm-installed agent. This suite closes that gap with a smoke-level check that the discovery payload reaches fakeintake in both modes.
The k8s suite is narrower than `linux_test.go` (single workload, smoke-level assertions), at least for now. This is to avoid having to add new app definitions at this point for a basic test. The VM suite continues to be the exhaustive per-language source of truth.
### Describe how you validated your changes
Ran locally against AWS twice with `E2E_DEV_MODE=true dda inv -- -e new-e2e-tests.run --targets ./tests/discovery --run TestK8sTestSuite --stack-name-suffix v2`:
```
--- PASS: TestK8sTestSuite (364.64s)
--- PASS: TestK8sTestSuite/TestNginxDiscovered (...)
--- PASS: TestK8sTestSuite/TestNginxDiscovered/system-probe-lite
--- PASS: TestK8sTestSuite/TestNginxDiscovered/system-probe
```
Lint: `golangci-lint run ./test/new-e2e/tests/discovery/...` clean (0 issues).
### Additional Notes
A few quirks worth flagging for reviewers:
- **Forced DaemonSet rollout via pod annotation.** Toggling `datadog.systemProbe.enableOOMKill` between sub-tests only mutates the chart-rendered configmap; the chart's `daemonset.yaml` has no `checksum/system-probe-yaml` annotation tying the pod template to that configmap, so the existing pod stays alive across the change. The suite writes a `agents.podAnnotations.discovery-e2e-mode: "spl"/"sp"` that intentionally differs per sub-test to bump the pod-template hash and force a rollout.
- **Tracer metadata / language detection out of scope.** Nginx is C/native so `language` and `serviceDiscovery.tracerMetadata` aren't populated. The two natural ways to extend this — switch to (or add) an OTel-instrumented Go server (`apps-calendar-go` — no `K8sAppDefinition` yet) or a `dd-trace-go`-instrumented app (`apps-tracegen` predates the memfd-tracer-metadata feature in `dd-trace-go.v1`) — both require cross-repo work in `test-infra-definitions`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: vincent.whitchurch <[email protected]>
### What does this PR do?
Adds a Kubernetes E2E sanity test for the Datadog Agent's discovery feature, mirroring (in spirit) the existing Linux VM suite in `test/new-e2e/tests/discovery/linux_test.go`. The new suite at `test/new-e2e/tests/discovery/k8s_test.go`:
- Provisions a Kind-on-EC2 cluster (`provkindvm`) with the agent installed via Helm and an `nginx` workload.
- Runs `TestNginxDiscovered` in two sub-tests covering both discovery modes:
- `system-probe-lite` — discovery enabled alone; the agent execs into `system-probe-lite` per `cmd/system-probe/subcommands/run/splite.go`.
- `system-probe` — adds `datadog.systemProbe.enableOOMKill: true` so the agent's `shouldExecSPLite` keeps the full binary running.
- Asserts on the matched nginx process: TCP port 80 listener, `ServiceDiscovery.GeneratedServiceName == {nginx, SOURCE_COMMAND_LINE}`, `ApmInstrumentation == false`, `InjectionState == NOT_INJECTED`, non-empty `ContainerId`.
- Pins the Helm chart version to `3.213.0`; the framework default (`3.155.1`) predates both the discovery template (chart 3.205.0, DataDog/helm-charts#2598) and the `latest`/`7` → `7.78.x` fallback fix (chart 3.213.0, DataDog/helm-charts#2643).
### Motivation
https://datadoghq.atlassian.net/browse/DSCVR-385
There is no k8s e2e for discovery today. DataDog/helm-charts#2634 fixed a bug in discovery on k8s related to the seccomp profile; the change went undetected before merge because nothing exercises the discovery flow on a Helm-installed agent. This suite closes that gap with a smoke-level check that the discovery payload reaches fakeintake in both modes.
The k8s suite is narrower than `linux_test.go` (single workload, smoke-level assertions), at least for now. This is to avoid having to add new app definitions at this point for a basic test. The VM suite continues to be the exhaustive per-language source of truth.
### Describe how you validated your changes
Ran locally against AWS twice with `E2E_DEV_MODE=true dda inv -- -e new-e2e-tests.run --targets ./tests/discovery --run TestK8sTestSuite --stack-name-suffix v2`:
```
--- PASS: TestK8sTestSuite (364.64s)
--- PASS: TestK8sTestSuite/TestNginxDiscovered (...)
--- PASS: TestK8sTestSuite/TestNginxDiscovered/system-probe-lite
--- PASS: TestK8sTestSuite/TestNginxDiscovered/system-probe
```
Lint: `golangci-lint run ./test/new-e2e/tests/discovery/...` clean (0 issues).
### Additional Notes
A few quirks worth flagging for reviewers:
- **Forced DaemonSet rollout via pod annotation.** Toggling `datadog.systemProbe.enableOOMKill` between sub-tests only mutates the chart-rendered configmap; the chart's `daemonset.yaml` has no `checksum/system-probe-yaml` annotation tying the pod template to that configmap, so the existing pod stays alive across the change. The suite writes a `agents.podAnnotations.discovery-e2e-mode: "spl"/"sp"` that intentionally differs per sub-test to bump the pod-template hash and force a rollout.
- **Tracer metadata / language detection out of scope.** Nginx is C/native so `language` and `serviceDiscovery.tracerMetadata` aren't populated. The two natural ways to extend this — switch to (or add) an OTel-instrumented Go server (`apps-calendar-go` — no `K8sAppDefinition` yet) or a `dd-trace-go`-instrumented app (`apps-tracegen` predates the memfd-tracer-metadata feature in `dd-trace-go.v1`) — both require cross-repo work in `test-infra-definitions`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: vincent.whitchurch <[email protected]>
What this PR does / why we need it:
This PR enables Service Discovery by default on agents >=7.78, which will use the new System-Probe-Lite binary for low-resource overhead. The version is determined based on the image tag. We treat every unparseable tag as "latest". This is to be consistent with the operator behaviour.
The change makes the distinction between default enablement, and an explicit one. This allows users of an agent <7.78 to still enable discovery if they truly wants it, via system-probe (much higher overhead).
Which issue this PR fixes
DSCVR-396
Special notes for your reviewer:
This PR uses the fallback mechanism of System-Probe to decide to start System-Probe-Lite. This is done in order to avoid a drift between the Helm chart & the agent in the handling of the fallback decision (i.e we would have to maintain a list of system-probe feature which could be easily missed when adding new features. Missing it could cause wrong behaviors like not enabling system-probe when we actually should for another feature, for example).
Using system-probe to control the fallback decision, like in bare-Linux & Docker installations, avoid this sort of issues, but this means that we will see a spike in memory consumption due to system-probe's size itself (~70MiB). Once the fallback to System-Probe-Lite happens, the memory use is expected to fallback to ~3.4MiB (measured in dogfooding).
Fallback behaviour + system-probe container creation tested with Kind and the following cases:
container status
get-agent-versionpolicyChecklist
<chartName>/minor-version,<chartName>/patch-version, or<chartName>/no-version-bump)datadogordatadog-operatorchart or value changes, update the test baselines (run:make update-test-baselines)datadogchart changes, received ✅ from a member of your teamGitHub CI takes care of the below, but are still required:
.github/helm-docs.sh)CHANGELOG.mdhas been updatedREADME.md