Skip to content

test(e2e): gate the agent surge roll on kind, under load (proposal 041) - #1158

Merged
bpalermo merged 2 commits into
mainfrom
feat/041-agent-surge-gate
Oct 3, 2026
Merged

bpalermo merged 2 commits into
mainfrom
feat/041-agent-surge-gate

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Fixes #1123. Part 4 of 4 of proposal 041. Stack: #1155 ← #1156 ← #1157 ← this PR. Base: feat/041-agent-surge-chart.

This PR adds the gate for the surge roll and marks proposal 041 Implemented.

Measured: proxy-side gap across an agent roll

Setup:

  • e2e/agent-restart-gap.sh on kind: control plane + worker, SPIRE on, etcd registry backend.
  • The images are built from this stack.
  • A poller in each node reads the proxy's control_plane.connected_state (one sample every ~80 ms, with the curl cost).
  • Load runs throughout: each source pod on the control plane requests a destination on the worker every 50 ms, so both proxies are on the path.
  • 20 rolls per arm; each node of each roll is one sample.
  • The two arms differ only in strategy off / strategy on.
seconds delete-then-create (n=40) surge (n=40)
gap: proxy without an ADS stream min 4.365 · median 6.298 · p99 10.216 min 0.065 · median 0.080 · p99 0.242
replace (gap start → agent start) 2.69 · 2.90 · 3.89 −7.9 · −3.9 · −1.9 (the standby was already running)
own SVID wait 1.00 · 2.66 · 6.25 0.99 · 2.67 · 7.28 (inside the standby; off the gap)
surge: old exit → lock acquired — −0.076 · −0.024 · 0.058 (within one poll)
surge: lock → owned (takeover diff) — 0.001 · 0.001 · 0.003
surge: owned → proxy stream — 0.035 · 0.103 · 0.279 (the proxy's jittered reconnect backoff)
load: non-200 3 of 13,391 (000) 0 of 17,693

Notes on the surge arm:

  • 29 of the 40 gaps showed a 0 sample.
  • The other 11 were shorter than one poll, so the harness reports the samples bracketing the takeover as an upper bound. Before that change, the harness called these "unreadable".
  • The gap is now the reconnect backoff plus about 1 ms of takeover. It is no longer pod replacement plus startup. The proposal's estimate was ~0.1–0.4 s; the measured p99 is 0.24 s.

The gate can fail. ARG_BOUND=1.0 ARG_EXPECT=green measure on the delete-then-create arm:
✗ a node's proxy had no ADS stream for more than 1.0s across an agent roll (every one of its 40 gaps is over 4 s).
On the surge arm the same command is green: ✓ every gap <= 1.0s.

Agent WARN/ERROR kinds across the 20 rolls, before vs after.

Overlap correctness (e2e/agent-restart-gap.sh overlap): green

Setup:

  • minReadySeconds=30 holds the old agent alive beside a Ready standby, which gives a deterministic overlap window.
  • Inside that window, on the worker, the harness creates pod overlap-add and deletes pod overlap-del.
✓ standby aether-agent-n8bnc beside aether-agent-dc49v
✓ inside the overlap: the old agent served the ADD (overlap-add) and the DEL (overlap-del); the standby had not taken over
  takeover: applied the previous agent's CNI ADD/DEL from the overlap  added=1 updated=0 removed=1
✓ after the takeover: overlap-add's listeners are served, overlap-del's are gone
✓ overlap-add answers 200 through the mesh after the takeover

The 30 s of minReadySeconds also exercises open question 3 on a real cluster: the standby stayed a Ready standby, bound nothing, and took over only when the old pod was finally deleted.

kubectl delete pod (open question 4, delete-pod): green

✓ aether-agent-cckqz owned the node at once (no standby, no lock wait); proxy gap 5.532s (delete-then-create, as before 041)

Harness changes

  • strategy on|off
  • ARG_SURGE=1 on up
  • load (ARG_LOAD, ARG_LOAD_INTERVAL) with a non-200 report
  • surge columns
  • sub-poll gap bound
  • overlap, delete-pod, report
  • summarize survives a column with no readings: it used to die under pipefail and turned the first run's summary into EXIT 1

Shellcheck via //e2e:e2e_shell is clean.

EWQ_CLUSTER=aether-041 e2e/agent-restart-gap.sh up            # ARG_SURGE=1 to install with surge
e2e/agent-restart-gap.sh strategy off; ARG_ROLLS=20 ARG_BOUND=1.0 e2e/agent-restart-gap.sh measure   # red
e2e/agent-restart-gap.sh strategy on;  ARG_ROLLS=20 ARG_BOUND=1.0 e2e/agent-restart-gap.sh measure   # green
e2e/agent-restart-gap.sh overlap; e2e/agent-restart-gap.sh delete-pod; e2e/agent-restart-gap.sh down

Hazard rows

Each row of the proposal's table is closed in #1155–#1157, with a test per row (see #1155's table). These are the ones this gate exercises end to end:

  • hostNetwork ports: the surge pod was scheduled beside the old one on every node in every roll (no Pending), with exec probes over the socket.
  • Socket ownership: 40 handoffs. Each one reconnected to the new socket; none stranded the proxy.
  • CNI ADD/DEL during the overlap: overlap.
  • Persisted state: 0 non-200 under load.
  • Readiness meaning: the DaemonSet controller deleted every old pod only after its standby was Ready.

Still to do, per the proposal's rollout: a talos soak with agent.updateStrategy.surge=true and the agent rolled under the standard churn. The surge strategy stays default-off until then.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

@bpalermo
bpalermo force-pushed the feat/041-agent-surge-gate branch from 0e6d102 to 4f105e8 Compare October 3, 2026 17:57
@bpalermo
bpalermo force-pushed the feat/041-agent-surge-chart branch from b0ba2e5 to 89e4f0c Compare October 3, 2026 18:18
@bpalermo
bpalermo force-pushed the feat/041-agent-surge-gate branch from 4f105e8 to 1234f6d Compare October 3, 2026 18:18
@bpalermo

bpalermo commented Oct 3, 2026

Copy link
Copy Markdown
Owner Author

Review fix pushed (1234f6d): with ARG_BOUND unset, the gate now follows the strategy. It is 1.0 s for a surge DaemonSet (or, on report, for a run whose rows carry takeover readings) and 5.0 s for delete-then-create. Re-run with the fixed #1155 and the default bound: 20 surge rolls, median 0.080 s / p99 0.169 s, ✓ every gap <= 1.0s, 0 non-200 of 18,107. The before arm re-reported with its default 5.0 s bound is red, as before.

🤖 Generated with Claude Code

@bpalermo
bpalermo force-pushed the feat/041-agent-surge-chart branch from 89e4f0c to 267eacd Compare October 3, 2026 20:27
@bpalermo
bpalermo changed the base branch from feat/041-agent-surge-chart to main October 3, 2026 20:27
bpalermo and others added 2 commits October 3, 2026 18:22
e2e/agent-restart-gap.sh, the #1123 harness, gains what proposal 041 needs:

- `strategy on|off` switches the agent DaemonSet between surge and
  delete-then-create without a roll (ARG_SURGE=1 surges from the install).
- Load while measuring: every source pod requests a destination on the other
  node every ARG_LOAD_INTERVAL s, so both node proxies are on the path; the
  non-200 count is reported.
- Surge terms per roll: old exit -> lock, lock -> owned (the takeover diff),
  owned -> stream. A takeover shorter than one poll (~80 ms) is reported as
  its bracketing interval, an upper bound, instead of "unreadable".
- `overlap`: minReadySeconds holds the old agent for ARG_OVERLAP_HOLD s beside a
  Ready standby; a pod is created and another deleted on the worker inside that
  window. Asserts the OLD agent served both, the standby had not taken over,
  the takeover reconciled added>=1 removed>=1, the node proxy has the added
  pod's listeners and not the deleted one's, and the added pod answers 200
  through the mesh.
- `delete-pod`: kubectl delete pod of an agent: the replacement owns the node at
  once (no standby, no lock wait) and the proxy reconnects.
- `report` re-summarizes a finished run; summarize no longer dies (pipefail)
  on a column with no readings.

Kind, 2 nodes, etcd backend, load on, 20 rolls each:
  delete-then-create  gap median 6.298 s, p99 10.216 s; 3 non-200 of 13391
  surge               gap median 0.080 s, p99 0.242 s; 0 non-200 of 17693
The 1 s gate is red on the first arm and green on the second.

Proposal 041 is marked Implemented.

Fixes #1123

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…(proposal 041 review)

ARG_BOUND unset now means 1.0 s when the agent DaemonSet surges (or, for
`report` of a finished run, when its rows carry takeover readings) and 5.0 s,
the #1123 target, for delete-then-create. An explicit ARG_BOUND still wins.
Also shfmt on `replaced`.

Refs #1123

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo force-pushed the feat/041-agent-surge-gate branch from 1234f6d to 3079a8e Compare October 3, 2026 21:22
@bpalermo
bpalermo marked this pull request as ready for review October 3, 2026 21:22
@bpalermo
bpalermo merged commit feea336 into main Oct 3, 2026
24 checks passed
@bpalermo
bpalermo deleted the feat/041-agent-surge-gate branch October 3, 2026 21:28
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.

agent: a restart leaves the node's proxy on stale xDS for ~15 s (pod replacement ~9 s + start-to-first-serve ~7 s)

1 participant