Skip to content

test(pressure): collector-shedding harness to exercise #662's startup decoupling on demand - #690

Merged
bpalermo merged 2 commits into
mainfrom
test/662-collector-pressure-harness
Sep 5, 2026
Merged

bpalermo merged 2 commits into
mainfrom
test/662-collector-pressure-harness

Conversation

@bpalermo

@bpalermo bpalermo commented Sep 5, 2026

Copy link
Copy Markdown
Owner

A test-only harness that reproduces #662's trigger — an otel-collector shedding
under memory_limiter pressure — on demand, so the decoupling #668 shipped can
actually be exercised instead of merely not-disproven.

No production code, chart, proto or dependency changes. Nothing in it runs in CI.

Why soaks cannot test this

#662 was a data-plane outage caused by an o11y component: with the collector
returning data refused due to high memory usage, the agent's startup context was
cancelled, SPIRE source creation failed, and 3 of 5 agents crash-looped (worker-02
at 5 restarts, still CrashLoopBackOff — a node with no xDS control plane). #668
made telemetry best-effort and bounded the first-SVID wait.

Since then the shedding branch has never run. Measured now, over the 09-03 and
09-04 soaks:

max_over_time(otelcol_process_memory_rss_bytes{instance=~"otel-collector-.*"}[2d])
  -> 245 MiB  = 21.7% of the 1126 MiB memory_limiter soft limit
increase(otelcol_receiver_refused_metric_points_total{instance=~"otel-collector-.*"}[2d])
  -> 0

That is not a gap in soak discipline; it is what a soak is. A soak drives mesh
traffic and rollout churn, not telemetry volume, and the o11y plane was resized to
2Gi (GitOps #35/#36) precisely so it would stop saturating. Waiting for the next
organic saturation is not a test strategy — the last one cost a soak and an
unplanned outage.

Options considered

A — flood the shared collector (implemented). A telemetrygen Job pushes
synthetic OTLP at otel-collector.o11y.svc.cluster.local:4317 until the process
crosses the soft limit and starts refusing; then one node's agent pod is deleted
under that pressure. It hits the real agent's real export path, with no code, image
or chart change anywhere in the mesh. The cost is real and documented: the prober
SLI goes blind for the 1–4 minutes shedding is engaged, because the prober exports
through the same collector — hence the hard pre-flight against running during a
soak.

B — a second, undersized collector plus a one-node agent override (rejected).
There is no node-scoped mechanism to point one agent at a different endpoint:
--otlp-endpoint is a DaemonSet-wide flag (a helm upgrade that rolls all five
agents and leaves the whole fleet exporting to a deliberately undersized
collector); kubectl set env/patch on the DaemonSet is equally fleet-wide; a pod
cannot have its args mutated in place; and a per-node override would be a product
change shipped to serve a test. B also proves less — that an agent survives a
shedding collector, not the one every component is queued behind. If the chart
ever grows a legitimate per-node telemetry override, B becomes strictly safer and
this harness should switch.

Which pipeline to flood. Logs, not metrics. memory_limiter is one
process-wide component shared by every pipeline, so pressure applied anywhere makes
every pipeline refuse — including the metrics pipeline the agents export to. The
flood therefore stays out of Prometheus, which is the plane run.sh measures from;
contaminating the measurement plane with the pressure signal would be
self-defeating. The garbage lands in VictoriaLogs under
service.name=aether-collector-pressure (NUL-filled payloads, compresses to
nearly nothing).

Procedure (run.sh --node <name>)

  1. Pre-flight, all fatal: context is talos-main; no soak running (no
    k6-soak-loader, no local churn.sh); collector 2/2 Ready; the target node's
    agent Ready with restartCount: 0; the external prober reporting successes;
    the agent's own series present; baseline collector RSS under 35% of the soft
    limit.
  2. Port-forwards prometheus-server (the LB address is not workstation-reachable)
    and records baseline RSS + otelcol_receiver_refused_{metric_points,log_records}_total.
  3. Applies the Job; polls every 15s until refused_metric_points_total
    increases
    — the agents' own exports being shed, not merely the flood. Gives up
    at 5 minutes and reports the max RSS reached.
  4. Deletes the agent pod on that node only. kubectl rollout restart is
    DaemonSet-wide and would restart the fleet under a shedding collector.
  5. Asserts the replacement pod appears (≤90s, after the 30s grace), is Ready
    (≤120s), restartCount: 0, never CrashLoopBackOff, logs resolved workload trust domain from SPIRE, and logs neither failed to create SPIRE Workload API source nor any ERROR-level context canceled.
  6. Re-reads the refused counters and requires movement during the restart
    window
    — if the flood lapsed while the agent started, the run is
    INCONCLUSIVE, not a PASS.
  7. Deletes the Job, waits for refusals to go flat, then waits for
    aether_agent_storage_pods{node="<node>"} to be fresher than 120s.

Sizing and the OOM guard

From the deployed config (2Gi limit, check_interval: 5s, 80/25): hard limit 1638
MiB, soft limit 1126 MiB, and a 512 MiB spike budget per 5s check ⇒ ~102 MiB/s per
replica is the frontier where the limiter could be overrun between checks. The
harness runs at ~64 MiB/s aggregate (~32 MiB/s per replica), a third of that, so
the collector sheds rather than OOM-kills — and run.sh deletes the Job and
aborts if any replica's RSS crosses 1500 MiB, before an agent is ever touched.

Three generator flags are load-bearing: --allow-export-failures (without it the
generator Fatal()s on the first refusal, killing the pressure at the exact moment
it engages), --timeout=5s (the OTLP client retries Unavailable for a minute by
default, collapsing the flood while it has to hold), and --batch=false (batched
1 MiB records would build ~100 MiB requests that die at the gRPC layer against
max_recv_msg_size_mib: 64, before memory_limiter sees them).

Abort and cleanup guarantees

Three independent layers:

  1. run.sh traps EXIT/INT/TERM and deletes the Job on every exit path,
    including failures, aborts and Ctrl-C.
  2. activeDeadlineSeconds: 600 on the Job — it self-terminates even if the
    workstation dies or the script is SIGKILLed. backoffLimit: 0 so a failed
    generator pod ends the Job instead of retrying at an unknown pressure.
  3. kubectl -n aether-test delete job aether-collector-pressure, safe at any
    instant.

The Job is priority 0 (first evicted under node pressure, never the collector or an
agent), has no tolerations, is capped at 500m/512Mi per pod, carries an explicit
aether.io/managed: "false" mesh opt-out, and prefers not to co-schedule with a
collector replica. Nothing else is mutated: no helm release, no chart value, no
DaemonSet, no collector config.

Expected PASS signature

==== PASS
  node under test          main-worker-03
  agent pod                aether-agent-xxxxx -> aether-agent-yyyyy (restartCount 0, Ready)
  collector RSS            baseline 251MiB -> peak 11xxMiB (10x% of the 1126MiB soft limit)
  refused (whole run)      log_records +N, metric_points +M
  refused (restart window) log_records +N', metric_points +M'
  agent evidence           'resolved workload trust domain from SPIRE' present;
                           no 'context canceled' ERROR; no CrashLoopBackOff
  telemetry recovery       aether_agent_storage_pods{node="main-worker-03"} fresh again

Exit 0 PASS · 1 FAIL (#662 is back — capture the pod log before re-running, the next
run replaces the pod) · 2 INCONCLUSIVE (pressure not reached, lapsed mid-test, or the
1500 MiB ceiling aborted the run with no agent touched).

Validation done here

  • kubectl apply --dry-run=client and --dry-run=server on the Job manifest: accepted.
  • bash -n clean; shellcheck (the repo's aspect_rules_lint binary, --shell=bash --external-sources) clean; make format-check clean (shfmt included).
  • Every metric name, label and log line the script asserts on was verified against the
    live cluster: otelcol_process_memory_rss_bytes,
    otelcol_receiver_refused_{metric_points,log_records}_total
    (instance=~"otel-collector-.*"), aether_agent_storage_pods{node=...},
    aether_probe_requests_total, and resolved workload trust domain from SPIRE
    (agent/internal/cmd/root.go:342).
  • Not run against talos-main — that is the reviewer's call, outside any soak window.

Refs #662

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 2 commits September 5, 2026 10:02
… decoupling on demand

#668 made agent startup independent of OTel export, but the branch it fixed has
never run since: over the 09-03 and 09-04 soaks the collector peaked at 245 MiB,
21.7% of its 1126 MiB memory_limiter soft limit, and refused zero metric points.
A soak drives mesh traffic, not telemetry volume, so it cannot reach that state.

e2e/pressure/ reaches it deliberately and reversibly: a telemetrygen Job floods
the shared collector's logs pipeline (memory_limiter is one process-wide
component, so every pipeline — including the metrics pipeline the agents export
to — starts refusing), then one node's agent pod is deleted under that pressure
and asserted to start, attest to SPIRE and resume exporting.

Refs #662

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant