Skip to content

e2e/soak: restart watchdog (#1242) + event-synced uds-csi window (#1243) - #1265

Merged
bpalermo merged 3 commits into
mainfrom
soak-restart-watch-udscsi-window
Oct 5, 2026
Merged

bpalermo merged 3 commits into
mainfrom
soak-restart-watch-udscsi-window

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Closes #1243
Refs #1242. This PR covers only the harness half of #1242. The kube-state-metrics / cAdvisor question (restarts gradable from metrics) is a separate GitOps decision, so #1242 stays open.

#1242: e2e/soak/restart-watch.sh

This replaces the one-liner in the workstation wrapper (nightly-soak-1005.sh). That one-liner printed the same blank line for "no restarts" and for "kubectl failed", and it covered only aether-system.

  • Namespaces: aether-system, aether-ingress and aether-test. The prober DaemonSet, the k6 runners and the soak workloads all live in aether-test; I checked that read-only on talos-main.
  • Baseline: taken at start, keyed by pod UID, and init containers are included. Restarts that predate the run are logged as BASELINE ... and never counted as new. If the baseline cannot be taken (5 tries), the script exits 2 with SUMMARY ... verdict=UNPROVEN reason=no-baseline.
  • Per-sample lines (every 120 s for 8 h by default):
    • ok count=0 is written only when every namespace was listed. It is the only line that means "none".
    • RESTARTS count=N is followed by RESTART ns/pod/ctr restarts=N new=M lastReason=<OOMKilled|Error|…> exitCode=… finishedAt=… state=… seen=live|gone. The list is cumulative: a restarted pod that a later roll deletes stays listed as seen=gone.
    • ERROR kubectl failed: ns=… … appears when the API call fails or its output is not a List of pods. No ok line is written for that sample.
  • End of run: SUMMARY restart-watch verdict=PASS|FAIL|UNPROVEN new_restarts=… containers=… samples=… error_samples=… ended=complete|TERM|INT …, plus one SUMMARY RESTART … per container. TERM/INT are handled at once (sleep & wait).
  • README:

Kickoff (the exact command):

bash "$PWD/e2e/soak/restart-watch.sh" --context talos-main --preflight &&
  nohup setsid bash "$PWD/e2e/soak/restart-watch.sh" --context talos-main >/dev/null 2>&1 &
# log: /tmp/soak-restart-watch.log (SOAK_RESTART_LOG to move it; a previous log is archived as .prev)

#1243: the uds-csi window

The likely cause of window=missed was in the old loop. It polled only the old plugin pod, once a second, and it treated NotFound as missed. With maxSurge: 0 the node's plugin stays down until the replacement is Ready, so a plugin that exits quickly on SIGTERM was logged as missed while it was still down.

The step now works like this:

  1. It starts a kubectl get pods -w on the victim node's plugin pods before the rollout restart.
  2. It deletes the victim when udscsi-window.awk says the node's plugin is down: the old pod is terminating or gone, and no Ready replacement exists yet.
  3. The wait is bounded (SOAK_UDSCSI_WINDOW_TIMEOUT, default 300 s). If the watch ends, the step falls back to a 0.2 s poll and logs that it did.
  4. A read taken after the delete was accepted confirms the window:
    • window=down: the leg ran.
    • window=late: the plugin was already Ready again.
    • window=missed: the plugin was never seen down.

late and missed also log UDSCSI window=<w> … NOT exercised and the plugin-watch lines. The README tells the grader to treat both as "leg not exercised". There is no retry, so the step still writes exactly one ROLLED/FAILED line per roll. Pre-flight now also checks watch pods and the awk file.

I found one kubectl quirk while testing on kind. With kubectl 1.35, get -w -o jsonpath with a {range}…{end} template prints the initial list and then exits 0 at the first change. The template therefore uses a filter without {range}; a comment in churn.sh records why.

Proof

  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //... passes (shellcheck covers restart-watch.sh and harness_test.sh via the //e2e/soak:soak_shell glob).
  • make format-check is clean after make format (shfmt).
  • Dry tests: bash e2e/soak/harness_test.sh reports 34/34 PASS with no cluster. It is not an sh_test because it needs host jq and the directory has no sh_test pattern.
    • restart-watch runs against canned kubectl get pods -o json fixtures (e2e/soak/testdata/restart-watch/) through a fake kubectl. It covers:
      • a clean run with a baseline OOM (PASS);
      • a new OOM, a crash loop, a new pod's init-container failure, and a restarted pod rolled away (seen=gone) (FAIL, new_restarts=6);
      • a refused call and a non-List Status answer, which produce ERROR lines, no ok line for those samples, and verdict=UNPROVEN;
      • no baseline, which exits 2;
      • TERM mid-interval, which exits 143 at once with ended=TERM;
      • archiving of the previous log.
    • udscsi-window.awk runs against canned watch lines in 8 cases (unseen/up/down/back, poll-after-watch, terminating replacement).
  • Kind (a throwaway kind create cluster, deleted afterwards; context restored to talos-main):
    • restart-watch:
      • A baseline with a pre-existing restart was logged as BASELINE.
      • A crash-looping pod (lastReason=Error exitCode=3) and an OOMKilled pod (lastReason=OOMKilled exitCode=137) were listed.
      • Pausing the kind node with docker pause across one sample gave ERROR kubectl failed: ns=aether-system sample=3 exit=1 Unable to connect to the server: net/http: TLS handshake timeout.
      • The crash-looping pod was deleted mid-run and stayed listed as seen=gone.
      • The run ended with SUMMARY restart-watch verdict=FAIL new_restarts=9 containers=3 samples=8 error_samples=1.
    • uds-csi step (churn.sh --uds-csi-once): the stand-in was a busybox DaemonSet with the same name, selector and maxSurge: 0 that exits at once on SIGTERM, plus busybox uds-echo/uds-cr-echo Deployments.
      • Two runs logged window=down … deleted 0-1s after the restart while the plugin was down (watch).
      • A run before the jsonpath fix showed the poll fallback working: window=down … (poll).
      • A forced SOAK_UDSCSI_WINDOW_TIMEOUT=0 run logged window=missed … NOT exercised with its plugin-watch lines.
      • Every kind step logged FAILED … bad=csinode because there is no real CSI driver on that cluster. That is expected and unrelated to the window.

Not exercised:

  • Nothing ran against a real aether-uds-csi roll: no csi.aether.io plugin, no real NodeUnpublishVolume, and not the 5-node talos-main roll order.
  • The kind cluster had one node.
  • window=late was never produced live; it is covered only by the logic and the awk tests.
  • Nothing ran against talos-main apart from read-only kubectl get to check namespaces and pod-status shape.
  • The watchdog has not run a full 8 h.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 3 commits October 5, 2026 11:19
restart-watch.sh (#1242): moves the soak's restart watchdog out of the
workstation wrapper into the harness. It baselines every container's
restartCount in aether-system, aether-ingress and aether-test (prober,
k6 runners, soak workloads) at start, keyed by pod UID, then samples
every 120s for 8h and writes one unambiguous line per sample:
`ok count=0`, or a cumulative RESTART list with restarts/new/lastReason/
exitCode/finishedAt/state/seen=live|gone, or `ERROR kubectl failed: ...`
when a call or its parse fails -- a failed call never reads as "none".
It ends with `SUMMARY restart-watch verdict=PASS|FAIL|UNPROVEN ...`.

churn.sh (#1243): the uds-csi step now watches the victim node's plugin
pods from before the restart and deletes the victim when the node's
plugin is DOWN (old pod terminating or gone, no Ready replacement), not
when a 1s poll of the old pod happens to catch it terminating. The old
poll called the window missed as soon as the old pod was gone, though
the plugin stays down until the replacement is Ready (maxSurge 0). The
wait is bounded (SOAK_UDSCSI_WINDOW_TIMEOUT, 300s), a read after the
delete confirms window=down, and late/missed log a distinct "leg NOT
exercised" line with what the watch saw. No retry: the roll count and
the ROLLED line count are unchanged.

harness_test.sh runs both against canned fixtures without a cluster.

Closes #1243
Refs #1242

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit d21fbc6 into main Oct 5, 2026
24 checks passed
@bpalermo
bpalermo deleted the soak-restart-watch-udscsi-window branch October 5, 2026 14:50
bpalermo added a commit that referenced this pull request Oct 5, 2026
…gets; pin cloud-provider-kind

- e2e/soak/harness_test.sh (#1265, 34 offline cases) ran nowhere: it needed
  jq from the host. It is now //e2e/soak:harness_test, an sh_test with the
  Bazel-pinned jq (jq.bzl) put on PATH, so it runs in bazel test //... and in
  ci.yaml's test leg whenever the soak harness changes.
- The shell jobs in ci.yaml and proxy.yml warmed @buildifier_prebuilt
  //:buildifier, which nothing in either job runs since scripts/lint-proxy.sh
  stopped running buildifier (#1256); --config=lint's aspects are buf,
  shellcheck and gocognit, and proxy.yml's //:format.check warm-up already
  covers the formatter's buildifier.
- e2e.yaml installed sigs.k8s.io/cloud-provider-kind@latest (then run under
  sudo): pinned to v0.12.0, what @latest resolves to today.
- Stale comments: ci.yaml's shell job ("17 source files" -> 70) and
  main.yaml's test job ("the proxy-ready linkage guard" -> five guards).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo added a commit that referenced this pull request Oct 5, 2026
…gets; pin cloud-provider-kind (#1279)

- e2e/soak/harness_test.sh (#1265, 34 offline cases) ran nowhere: it needed
  jq from the host. It is now //e2e/soak:harness_test, an sh_test with the
  Bazel-pinned jq (jq.bzl) put on PATH, so it runs in bazel test //... and in
  ci.yaml's test leg whenever the soak harness changes.
- The shell jobs in ci.yaml and proxy.yml warmed @buildifier_prebuilt
  //:buildifier, which nothing in either job runs since scripts/lint-proxy.sh
  stopped running buildifier (#1256); --config=lint's aspects are buf,
  shellcheck and gocognit, and proxy.yml's //:format.check warm-up already
  covers the formatter's buildifier.
- e2e.yaml installed sigs.k8s.io/cloud-provider-kind@latest (then run under
  sudo): pinned to v0.12.0, what @latest resolves to today.
- Stale comments: ci.yaml's shell job ("17 source files" -> 70) and
  main.yaml's test job ("the proxy-ready linkage guard" -> five guards).


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Fable 5.1 <[email protected]>
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.

soak harness: uds-csi churn step can miss its mid-roll window (window=missed)

1 participant