Skip to content

test(ssi): e2e tests for SSI Instrumentation Rules via Remote Config - #55057

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 7 commits into
mainfrom
luc/ssi-e2e-rc-no-false-positive
Aug 28, 2026
Merged

test(ssi): e2e tests for SSI Instrumentation Rules via Remote Config#55057
gh-worker-dd-mergequeue-cf854d[bot] merged 7 commits into
mainfrom
luc/ssi-e2e-rc-no-false-positive

Conversation

@iamluc

@iamluc iamluc commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Expands TestSSISuite/TestRemoteConfig so APM_POLICIES is exercised end-to-end against three workloads (helm target, annotated lib-injection, unannotated) and three RC documents:

  • Host-only policy does not match Kubernetes admission facts: annotated pod stays k8s_lib_injection, unannotated stays uninjected, helm target still gets SSI (applied-target=python-apps).
  • Namespace policy (NAMESPACE_NAME=other) enables SSI outside the helm target, including true on-demand on the unannotated pod (applied-policy set). Helm fallback is unchanged.
  • Deny policy matching targeted-namespace overrides the local helm target (no injection, no applied-target). Namespace other is unchanged.

Cluster-agent RC on the published chart is enabled via remoteInstrumentation.enabled (temporary until helm-charts#2868). Extra cluster-agent env uses envDict so fakeintake RC settings are not replaced.

Stacked on #55019.

Motivation

Catch the SSI false-positive (host-only RC flipping annotated pods), prove on-demand SSI from RC, and prove remote-before-local override — none of which unit tests cover through fakeintake + admission.

Describe how you validated your changes

  • Local kind-local: dda inv new-e2e-tests.run --targets=./tests/ssi --run='TestSSISuite/TestRemoteConfig'
  • CI new-e2e-ssi job

Additional Notes

remoteInstrumentation.enabled is only the published-chart RC gate, not the feature under test. Drop it once helm-charts#2868 is released.

@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 0.00%
Overall Coverage: 16.97% (-35.75%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: f0dc302 | Docs | View more details | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Files inventory check summary

File checks results against ancestor 61c8df89:

Results for datadog-agent_7.84.0~devel.git.570.f0dc302.pipeline.133860985-1_amd64.deb:

No change detected

Results for datadog-iot-agent_7.84.0~devel.git.570.f0dc302.pipeline.133860985-1_amd64.deb:

No change detected

@dd-octo-sts

dd-octo-sts Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor 61c8df8
📊 Static Quality Gates Dashboard
🔗 SQG Job
SOME SIZE DELTAS ARE N/A (ANCESTOR METRICS NOT YET AVAILABLE). RETRY JOB

Successful checks

Info

Quality gate Change Size (prev → curr → max)
agent_deb_amd64 N/A N/A → 761.387 → 764.840
agent_deb_amd64_fips N/A N/A → 713.911 → 716.080
agent_heroku_amd64 N/A N/A → 312.957 → 319.080
agent_msi N/A N/A → 648.055 → 661.050
agent_rpm_amd64 N/A N/A → 761.371 → 764.810
agent_rpm_amd64_fips N/A N/A → 713.895 → 716.080
agent_rpm_arm64 N/A N/A → 737.292 → 738.310
agent_rpm_arm64_fips N/A N/A → 693.133 → 694.350
agent_suse_amd64 N/A N/A → 761.371 → 764.810
agent_suse_amd64_fips N/A N/A → 713.895 → 716.080
agent_suse_arm64 N/A N/A → 737.292 → 738.310
agent_suse_arm64_fips N/A N/A → 693.133 → 694.350
docker_agent_amd64 N/A N/A → 820.402 → 821.000
docker_agent_arm64 N/A N/A → 821.359 → 821.980
docker_agent_jmx_amd64 N/A N/A → 1011.315 → 1011.910
docker_agent_jmx_arm64 N/A N/A → 1001.051 → 1001.680
docker_cluster_agent_amd64 N/A N/A → 211.252 → 212.130
docker_cluster_agent_arm64 N/A N/A → 224.397 → 225.220
docker_cws_instrumentation_amd64 N/A N/A → 7.439 → 8.400
docker_cws_instrumentation_arm64 N/A N/A → 6.877 → 7.110
docker_dogstatsd_amd64 N/A N/A → 39.545 → 40.440
docker_dogstatsd_arm64 N/A N/A → 37.623 → 38.580
docker_host_profiler_amd64 N/A N/A → 306.859 → 317.700
docker_host_profiler_arm64 N/A N/A → 318.164 → 328.970
dogstatsd_deb_amd64 N/A N/A → 30.290 → 31.210
dogstatsd_deb_arm64 N/A N/A → 28.302 → 29.590
dogstatsd_rpm_amd64 N/A N/A → 30.290 → 31.210
dogstatsd_suse_amd64 N/A N/A → 30.290 → 31.210
iot_agent_deb_amd64 N/A N/A → 46.560 → 47.550
iot_agent_deb_arm64 N/A N/A → 43.196 → 44.220
iot_agent_deb_armhf N/A N/A → 44.007 → 45.020
iot_agent_rpm_amd64 N/A N/A → 46.560 → 47.550
iot_agent_suse_amd64 N/A N/A → 46.559 → 47.550

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 18, 2026

Copy link
Copy Markdown

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Job ID: 60d0eac5-c2c3-42e0-97c0-ed26b2f7f194

Baseline: ee726f0
Comparison: 1aba30e
Diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
quality_gate_metrics_logs memory utilization +1.56 [+1.33, +1.79] 1 Logs bounds checks dashboard
quality_gate_logs % cpu utilization +0.62 [-0.25, +1.49] 1 Logs bounds checks dashboard
dsd_uds_10mb_3k_timestamped_contexts_cpu % cpu utilization +0.59 [+0.32, +0.85] 1 Logs
quality_gate_private_action_runner memory utilization +0.27 [+0.14, +0.39] 1 Logs bounds checks dashboard
quality_gate_idle_all_features memory utilization +0.18 [+0.15, +0.22] 1 Logs bounds checks dashboard
quality_gate_idle memory utilization -0.00 [-0.04, +0.04] 1 Logs bounds checks dashboard
dsd_uds_10mb_3k_timestamped_contexts_memory memory utilization -0.03 [-0.25, +0.18] 1 Logs
quality_gate_security_no_fs_load memory utilization -0.08 [-0.16, +0.01] 1 Logs bounds checks dashboard
quality_gate_security_idle memory utilization -0.16 [-0.21, -0.11] 1 Logs bounds checks dashboard
quality_gate_security_mean_fs_load memory utilization -0.23 [-0.26, -0.20] 1 Logs bounds checks dashboard

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed observed_value links
quality_gate_idle intake_connections 10/10 4 = 4 bounds checks dashboard
quality_gate_idle memory_usage 10/10 174.37MiB ≤ 179MiB bounds checks dashboard
quality_gate_idle total_bytes_received 10/10 744.19KiB ≤ 819.20KiB bounds checks dashboard
quality_gate_idle_all_features intake_connections 10/10 4 = 4 bounds checks dashboard
quality_gate_idle_all_features memory_usage 10/10 516.20MiB ≤ 537MiB bounds checks dashboard
quality_gate_idle_all_features total_bytes_received 10/10 1.14MiB ≤ 1.25MiB bounds checks dashboard
quality_gate_logs intake_connections 10/10 19 ≤ 40 bounds checks dashboard
quality_gate_logs memory_usage 10/10 215.97MiB ≤ 220MiB bounds checks dashboard
quality_gate_logs missed_bytes 10/10 0B = 0B bounds checks dashboard
quality_gate_logs total_bytes_received 10/10 263.09MiB ≤ 292MiB bounds checks dashboard
quality_gate_metrics_logs cpu_usage 10/10 367.72 ≤ 2000 bounds checks dashboard
quality_gate_metrics_logs intake_connections 10/10 18 ≤ 40 bounds checks dashboard
quality_gate_metrics_logs memory_usage 10/10 429.81MiB ≤ 455MiB bounds checks dashboard
quality_gate_metrics_logs missed_bytes 10/10 0B = 0B bounds checks dashboard
quality_gate_metrics_logs total_bytes_received 10/10 0.94GiB ≤ 1.04GiB bounds checks dashboard
quality_gate_private_action_runner memory_usage 10/10 72.79MiB ≤ 75MiB bounds checks dashboard
quality_gate_security_idle cpu_usage 10/10 28.69 ≤ 100 bounds checks dashboard
quality_gate_security_idle memory_usage 10/10 328.32MiB ≤ 355MiB bounds checks dashboard
quality_gate_security_mean_fs_load cpu_usage 10/10 61.54 ≤ 200 bounds checks dashboard
quality_gate_security_mean_fs_load memory_usage 10/10 304.41MiB ≤ 335MiB bounds checks dashboard
quality_gate_security_no_fs_load cpu_usage 10/10 22.40 ≤ 100 bounds checks dashboard
quality_gate_security_no_fs_load memory_usage 10/10 314.14MiB ≤ 345MiB 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:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. 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.

  3. Its configuration does not mark it "erratic".

CI Pass/Fail Decision

Passed. All Quality Gates passed.

  • quality_gate_security_mean_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_mean_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, 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_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 total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_private_action_runner, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check total_bytes_received: 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_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, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_security_idle, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_no_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_no_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.

@iamluc iamluc changed the title test(ssi): e2e RC policy must not flip annotated pods to SSI test(ssi): e2e APM_POLICIES match, fallback, override Aug 19, 2026
@iamluc iamluc changed the title test(ssi): e2e APM_POLICIES match, fallback, override test(ssi): e2e tests for SSI Instrumentation Rules via Remote Config Aug 19, 2026
@iamluc iamluc added changelog/no-changelog No changelog entry needed qa/no-code-change No code change in Agent code requiring validation labels Aug 19, 2026
@iamluc
iamluc marked this pull request as ready for review August 20, 2026 06:31
@iamluc
iamluc requested review from a team as code owners August 20, 2026 06:31

@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: 02f4ac64d6

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

Comment thread test/new-e2e/tests/ssi/ssi_test.go Outdated
Comment thread test/new-e2e/tests/ssi/ssi_test.go Outdated
@github-actions github-actions Bot added the long review PR is complex, plan time to review it label Aug 20, 2026
@iamluc

iamluc commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 7368ccee60

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

@aiuto
aiuto removed the request for review from a team August 20, 2026 20:22
Base automatically changed from luc/ssi-mode-from-exact-match to main August 28, 2026 08:41
iamluc added 7 commits August 28, 2026 10:43
Cover the case where an APM_POLICIES RC payload matches only host/Linux
constraints while a pod is opted in via annotations in another namespace:
assert lib injection stays on and SSI env vars are not applied.
Apply gofmt to the RC test constants and replace fmt.Sprintf with
string concatenation to satisfy perfsprint.
Cover host-only non-match, namespace on-demand SSI,
helm fallback, and a deny policy that overrides the
local helm target.
ssi_test.go imports fakeintake; gazelle mode=diff failed without
the dep on the ssi_test target.
Fakeintake poll counters also move for node agents, so they are not
a signal that the cluster-agent applied APM_POLICIES. Re-admit until
the expected mutation appears instead.
INJECT_DENY makes MutatePod a no-op, so waiting for APM annotations
never succeeds. Wait for the absence of LD_PRELOAD instead.
Host-only outcome equals the helm baseline, so a one-shot restart
does not prove RC was consumed. Publish a matching policy first,
then replace the same document and wait for lib-injection.

Also fail the test if RC cleanup cannot delete the document.
@iamluc
iamluc force-pushed the luc/ssi-e2e-rc-no-false-positive branch from 7368cce to f0dc302 Compare August 28, 2026 08:43
@dd-octo-sts dd-octo-sts Bot added the internal Identify a non-fork PR label Aug 28, 2026
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 1aba30e into main Aug 28, 2026
300 of 308 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the luc/ssi-e2e-rc-no-false-positive branch August 28, 2026 13:11
@github-actions github-actions Bot added this to the 7.84.0 milestone Aug 28, 2026
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Aug 31, 2026
### What does this PR do?

Unify SSI matching on a single last-TRUE-wins matcher:

- **Static targets** (Helm / Operator / `datadog.yaml`) are reversed at construction so config first-wins is preserved.
- **RC policies** keep wire order (catch-all first, exceptions after) and are last-TRUE-wins as-is.
- Evaluation is static first, then RC, then SSI inject-all only when both are absent. A matched deny does not fall through.

```
SSI | static targets | RC          | Decision
off | —              | none        | nothing
off | —              | policies    | last matching policy, else nothing
on  | none           | none        | everything
on  | none           | policies    | last matching policy, else nothing
on  | present        | none        | first (as in the yaml) matching target, else nothing
on  | present        | policies    | first (as in the yaml) matching target, else last matching policy, else nothing
```

Rebased onto `main` after #55057 merged.

### Motivation

RC is already last-wins on the wire. Using the same matcher for static targets (by reversing them) avoids two matching modes. Static targeting is evaluated before RC so a remote deny cannot override an explicit local target.

### Describe how you validated your changes

- [x] Unit tests: `./pkg/clusteragent/admission/mutate/autoinstrumentation`
- [ ] E2E `TestSSISuite/TestRemoteConfig` (HelmTargetWinsOverRemoteDeny, LastMatchingRemotePolicyWins)

### Additional Notes

`HelmTargetWinsOverRemoteDeny` now expects the helm python workload to **keep** SSI when an RC deny matches `targeted-namespace`. That inverts #55057, where remote-before-local made the deny win.

Co-authored-by: luc.vieillescazes <luc.vieillescazes@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog No changelog entry needed internal Identify a non-fork PR long review PR is complex, plan time to review it qa/no-code-change No code change in Agent code requiring validation team/injection-platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants