test(e2e/discovery): add k8s test using Helm charts#50666
Conversation
…Fargate fakeintake The datadog-agent container in the fakeintake task definition forwards metrics to the DDdev org for dashboards. It is not required for the fakeintake service itself to function — the fakeintake container is the essential one for test correctness. When the monitoring sidecar fails its health check (e.g. due to a broken NAT gateway in one of the ECS subnets), the ECS service never reaches STABLE, causing the whole test to time out. Marking it non-essential lets the ECS service become healthy as soon as the actual fakeintake container passes its health check. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Toggles DD_DISCOVERY_ENABLED and DD_DISCOVERY_USE_SYSTEM_PROBE_LITE on the system-probe container. Chart key path matches tests/cws/kind_test.go. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
TestK8sTestSuite deploys the existing nginx workload and verifies that the agent's discovery feature reports it on tcp/80. Covers both system-probe-lite and system-probe modes via Helm. This is a sanity check that the discovery flow works end-to-end on k8s; deep per-language assertions remain the VM suite's job. Closes the gap that allowed DataDog/helm-charts#2634 to ship without detection. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- getAgentPod: fail fast with t.Fatalf when no agent pod has a ready system-probe container, instead of silently falling back to a possibly-terminating pod. - TestNginxDiscovered: flush fakeintake before validateDiscoveryMode so the second mode's assertion can't be satisfied by stale payloads from the first mode. - Drop K8s infix from validateDiscoveryMode and dumpDebugInfo; the receiver already disambiguates from linuxTestSuite's methods of the same name. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Add datadog.discovery.enabled: true so the chart deploys the system-probe container. Without this, the chart's should-enable-system-probe template returns false (agent version resolves below the 7.78.0 auto-enable threshold) and our container-level env vars have no effect because the container itself isn't deployed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Drop dual-mode iteration (system-probe-lite / system-probe). The env-var override that was meant to flip modes at runtime (DD_DISCOVERY_USE_SYSTEM_PROBE_LITE) doesn't take effect because the chart-generated /etc/datadog-agent/system-probe.yaml wins, and the chart's discovery-use-system-probe-lite template resolves to false on QA agent versions below 7.78.0. Also drop validateDiscoveryMode and the post-UpdateEnv pod-readiness race they exposed. The k8s test is now a pure sanity check: deploy nginx, wait for fakeintake to receive a process payload reporting tcp/80, done. Whichever discovery mode the chart picks is fine. Mode-switching coverage can return as a follow-up once the chart exposes a values key for use_system_probe_lite or we configure system-probe.yaml directly. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Lint nit caught by gopls slicescontains rule. Pure simplification. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The chart's get-agent-version helper eagerly maps both "latest" and "7" to a 7.67.0 floor for version comparison, so without an explicit pin the chart picks full system-probe (its 7.78.0 SPL auto-enable threshold is gated off). Pin agents.image.tag to 7.78.0 so the lite path is exercised by default both locally and in CI. Then cover full system-probe too: enable datadog.systemProbe.enableOOMKill in the second sub-test to add a non-discovery system-probe feature. The agent's shouldExecSPLite logic only exec's into system-probe-lite when discovery is the only enabled module, so this forces the full binary. Pod-readiness after UpdateEnv is wrapped in EventuallyWithT to handle the daemonset roll between sub-tests. Also log the matched nginx process payload so we can iterate on service-name and language assertions in a follow-up once we see what fields the agent actually populates. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The framework default chart version (test/e2e-framework/components/ datadog/agent/kubernetes_helm.go HelmVersion = 3.155.1) predates the discovery-use-system-probe-lite template (added in chart 3.205.0 via DataDog/helm-charts#2598). Without bumping the chart version, SPL is never enabled regardless of agent image tag or datadog.discovery.enabled setting. Pin per-test via kubernetesagentparams.WithHelmChartVersion so the framework default doesn't have to change. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Toggling datadog.systemProbe.enableOOMKill via helm values only
mutates the chart-rendered configmap; it doesn't change the
DaemonSet pod template, and the chart's daemonset.yaml has no
checksum/system-probe-yaml annotation tying the pod template to
that configmap. Result: the existing pod stays alive between
sub-tests, system-probe-lite keeps running, and the sub-test
expecting full system-probe fails.
Replace the EnableOOMKill bool with a Mode string ("spl"/"sp")
that drives both the OOMKill toggle and a unique
agents.podAnnotations.discovery-e2e-mode value. The annotation
change shifts the pod template hash so k8s rolls the DaemonSet
when the mode flips.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…on state Beyond the bare nginx-on-tcp/80 check, also verify what the discovery pipeline populates on the matched process: - ServiceDiscovery.GeneratedServiceName.Name == "nginx" - ServiceDiscovery.GeneratedServiceName.Source == COMMAND_LINE - ServiceDiscovery.ApmInstrumentation == false (no tracer) - Process.InjectionState == INJECTION_NOT_INJECTED - Process.ContainerId is populated (proves the discovery → tagger pipeline correlated the process with its container) nginx is C/native so language detection doesn't fire and there's no tracer metadata to assert. Language + tracer assertions can come in a follow-up that adds an instrumented Go workload (the existing apps-calendar-go image is a fit but has no K8sAppDefinition yet). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chart 3.213.0 ships DataDog/helm-charts#2643 which bumps the get-agent-version fallback for the single-component tags "latest" and "7" from 7.67.0 to 7.78.3. With that fix the chart treats either tag like a current agent and the discovery >=7.78.0 auto-enable threshold is met without an explicit agents.image.tag override. Drop the 7.78.0 pin and the doNotCheckTag escape hatch. The framework's default image (gcr.io/datadoghq/agent:latest locally, the pipeline-built tag in CI) now flows through to a chart that will enable SPL on both. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This comment has been minimized.
This comment has been minimized.
Files inventory check summaryFile checks results against ancestor ef81861a: Results for datadog-agent_7.80.0~devel.git.615.2d9c1fc.pipeline.112700002-1_amd64.deb:No change detected |
… in ECS Fargate fakeintake" This reverts commit 5575fc5.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Reset matched at the start of each EventuallyWithT iteration so a stale pointer from an earlier poll can't mask a missing process in later polls. Move all ServiceDiscovery/GeneratedServiceName/InjectionState/ContainerId assertions inside the retry loop so the test keeps polling until the process is fully enriched, not just until it first appears. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: bdf4f94 Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | docker_containers_cpu | % cpu utilization | +2.36 | [-0.55, +5.26] | 1 | Logs |
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | docker_containers_cpu | % cpu utilization | +2.36 | [-0.55, +5.26] | 1 | Logs |
| ➖ | quality_gate_metrics_logs | memory utilization | +1.07 | [+0.82, +1.32] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_logs | % cpu utilization | +0.82 | [-0.18, +1.82] | 1 | Logs bounds checks dashboard |
| ➖ | ddot_metrics | memory utilization | +0.46 | [+0.26, +0.65] | 1 | Logs |
| ➖ | ddot_metrics_sum_cumulativetodelta_exporter | memory utilization | +0.45 | [+0.21, +0.69] | 1 | Logs |
| ➖ | docker_containers_memory | memory utilization | +0.38 | [+0.27, +0.48] | 1 | Logs |
| ➖ | quality_gate_idle | memory utilization | +0.19 | [+0.14, +0.24] | 1 | Logs bounds checks dashboard |
| ➖ | ddot_metrics_sum_cumulative | memory utilization | +0.18 | [+0.02, +0.34] | 1 | Logs |
| ➖ | uds_dogstatsd_20mb_12k_contexts_20_senders | memory utilization | +0.08 | [+0.03, +0.13] | 1 | Logs |
| ➖ | otlp_ingest_logs | memory utilization | +0.04 | [-0.07, +0.14] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api | ingress throughput | +0.03 | [-0.18, +0.24] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api_v3 | ingress throughput | +0.02 | [-0.18, +0.22] | 1 | Logs |
| ➖ | file_to_blackhole_500ms_latency | egress throughput | +0.00 | [-0.41, +0.42] | 1 | Logs |
| ➖ | tcp_dd_logs_filter_exclude | ingress throughput | -0.00 | [-0.10, +0.09] | 1 | Logs |
| ➖ | file_to_blackhole_100ms_latency | egress throughput | -0.01 | [-0.16, +0.13] | 1 | Logs |
| ➖ | ddot_metrics_sum_delta | memory utilization | -0.04 | [-0.22, +0.15] | 1 | Logs |
| ➖ | file_to_blackhole_1000ms_latency | egress throughput | -0.04 | [-0.48, +0.40] | 1 | Logs |
| ➖ | file_to_blackhole_0ms_latency | egress throughput | -0.04 | [-0.62, +0.53] | 1 | Logs |
| ➖ | ddot_logs | memory utilization | -0.05 | [-0.12, +0.02] | 1 | Logs |
| ➖ | otlp_ingest_metrics | memory utilization | -0.07 | [-0.23, +0.08] | 1 | Logs |
| ➖ | file_tree | memory utilization | -0.40 | [-0.44, -0.35] | 1 | Logs |
| ➖ | quality_gate_idle_all_features | memory utilization | -0.50 | [-0.54, -0.46] | 1 | Logs bounds checks dashboard |
| ➖ | tcp_syslog_to_blackhole | ingress throughput | -1.38 | [-1.59, -1.18] | 1 | Logs |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | observed_value | links |
|---|---|---|---|---|---|
| ✅ | docker_containers_cpu | simple_check_run | 10/10 | 697 ≥ 26 | |
| ✅ | docker_containers_memory | memory_usage | 10/10 | 245.37MiB ≤ 370MiB | |
| ✅ | docker_containers_memory | simple_check_run | 10/10 | 720 ≥ 26 | |
| ✅ | file_to_blackhole_0ms_latency | memory_usage | 10/10 | 0.16GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_0ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_1000ms_latency | memory_usage | 10/10 | 0.20GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_1000ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_100ms_latency | memory_usage | 10/10 | 0.17GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_100ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_500ms_latency | memory_usage | 10/10 | 0.20GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_500ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | quality_gate_idle | intake_connections | 10/10 | 3 ≤ 4 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | 141.91MiB ≤ 147MiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | 3 ≤ 4 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | 469.94MiB ≤ 495MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | 3 ≤ 6 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | 181.01MiB ≤ 195MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | 363.75 ≤ 2000 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | 4 ≤ 6 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | 381.08MiB ≤ 430MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
CI Pass/Fail Decision
✅ Passed. All Quality Gates passed.
- quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
### 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 attest/new-e2e/tests/discovery/k8s_test.go:provkindvm) with the agent installed via Helm and annginxworkload.TestNginxDiscoveredin two sub-tests covering both discovery modes:system-probe-lite— discovery enabled alone; the agent execs intosystem-probe-litepercmd/system-probe/subcommands/run/splite.go.system-probe— addsdatadog.systemProbe.enableOOMKill: trueso the agent'sshouldExecSPLitekeeps the full binary running.ServiceDiscovery.GeneratedServiceName == {nginx, SOURCE_COMMAND_LINE},ApmInstrumentation == false,InjectionState == NOT_INJECTED, non-emptyContainerId.3.213.0; the framework default (3.155.1) predates both the discovery template (chart 3.205.0, enable discovery by default on supported agent versions helm-charts#2598) and thelatest/7→7.78.xfallback fix (chart 3.213.0, [datadog] bumpget-agent-versionfallback forlatest/7to 7.78.3 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:Lint:
golangci-lint run ./test/new-e2e/tests/discovery/...clean (0 issues).Additional Notes
A few quirks worth flagging for reviewers:
datadog.systemProbe.enableOOMKillbetween sub-tests only mutates the chart-rendered configmap; the chart'sdaemonset.yamlhas nochecksum/system-probe-yamlannotation tying the pod template to that configmap, so the existing pod stays alive across the change. The suite writes aagents.podAnnotations.discovery-e2e-mode: "spl"/"sp"that intentionally differs per sub-test to bump the pod-template hash and force a rollout.languageandserviceDiscovery.tracerMetadataaren't populated. The two natural ways to extend this — switch to (or add) an OTel-instrumented Go server (apps-calendar-go— noK8sAppDefinitionyet) or add-trace-go-instrumented app (apps-tracegenpredates the memfd-tracer-metadata feature indd-trace-go.v1) — both require cross-repo work intest-infra-definitions.🤖 Generated with Claude Code