Skip to content

test(edge): Prove public listener failover with two instances - #1532

Open
privateip wants to merge 2 commits into
mainfrom
fix/issue-1511-failover
Open

privateip wants to merge 2 commits into
mainfrom
fix/issue-1511-failover

Conversation

@privateip

@privateip privateip commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Nothing proved how a public listener behaves when one of its backends goes away. This adds a lab test that serves the MASQUE service from two instances, one per dfw edge node, and checks each failover criterion of the issue from an off-fabric client. It also fixes the lab deploy, which kept a stale copy of the CRDs on a rerun. Fixes #1511.

Lab result

Case Result
Both instances serving 12 connections, 7 and 5 across the instances
One instance not ready left every gateway in 1.5 s, new connections went elsewhere
One instance draining took 4 of 6 connections before its deadline, left 2.8 s after
One instance loses its lease left 14.0 s after its last renewal, within 15.5 s
No instance left every gateway withdrew the addresses in 1.1 s
One gateway lost the client kept its instance through the other gateway

Test plan

  • The test compiles, vets and lints, and the documentation checks pass
  • Lab: unready, drain, lease loss, no instances and gateway loss all pass in the lab

@privateip privateip self-assigned this Nov 30, 2026
Base automatically changed from fix/issue-1512-lab to main November 30, 2026 16:11
@privateip
privateip marked this pull request as ready for review November 30, 2026 20:06
@privateip
privateip requested a review from a team as a code owner November 30, 2026 20:06

@scotwells scotwells left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fail the lab test if it can’t restore a fabric link or the route doesn’t return before the timeout. restoreLinks currently ignores link errors and clears the node before checking recovery, so the test can report success with a gateway still disconnected and cleanup won’t retry. Keep the node marked for cleanup until recovery is confirmed.

@privateip

Copy link
Copy Markdown
Contributor Author

Fixed in e63389b. restoreLinks now returns an error when a link fails to come up or tr1's route to the node does not return within two minutes, and it clears the node only once the route is back. The gateway-loss row fails on that error, and the test's cleanup reports it and retries the recovery the row could not confirm.

The lab has not run the gateway-loss row at this head yet: the runs stopped earlier on a separate intermittent problem, the listener's backends flipping between serving and not serving with no fault injected. I'm investigating that separately.

@privateip
privateip force-pushed the fix/issue-1511-failover branch from e63389b to a01e0dc Compare December 1, 2026 13:43
copy_config ran docker cp onto an existing /galactic/config, which nests
the new copy inside the old one, so deploy:system kept applying the CRDs
the lab was first deployed with. A NetworkGateway status field added
since then was pruned from every gateway's status. Remove the copy
first, as copy_fabric_config does.
Nothing proved how an Edge public listener behaves when one of its
backends goes away. TestListenerFailover (task verify:listener-failover)
serves the MASQUE service through dfw's listener from two instances, one
on each dfw edge node, with session affinity None. Each client
connection uses its own connector and is attributed to the instance
whose CONNECT-IP request counter moved, whatever it answered. A 503
counts as delivered, because it means the connector's route has not
yet moved to the instance, not that the listener failed; only no answer
at all is a failure. A connector is retried on 503 for up to 40 s.

Each row restores both instances before it starts, skips an instance
whose metrics cannot be read, and fails on its own terms:

- unready: an instance whose pod is deleted, so its provider clears
  Ready, leaves every gateway's backend set and new connections reach
  the other. A replacement the provider starts counts as delivered.
- drain: an instance core marks Draining keeps taking new connections
  until its deadline and none after it. The provider clears Ready as
  soon as it shuts down, so no pod event drains it while Ready: the row
  writes core's Draining condition and deadline as the cluster admin.
  After the deadline the drained attachment is deleted and every
  connection is answered.
- lease: an instance cut off from the API leaves every gateway within
  15.5 s of its lease's last renewal.
- no-instances: with no instance left, every gateway withdraws the
  listener's advertisements and the client gets no answer.
- gateway-loss: with client affinity, the client keeps its instance
  through the other gateway when the one it entered through loses its
  links. A connection that reuses a connector routed to the lost node's
  instance may be answered by the client's instance before the return
  route converges; the row counts it and records how many. Restoring the
  links returns an error if a link stays down or tr1's route does not
  return within two minutes, and the row and the test's cleanup fail on
  it.

When the gateways lack the backends in time, waitBackends records the
listener's conditions and backends, the services' conditions, the
listener attachments, each gateway's rule_backends samples and each
backend's binding health. Unanswered connections record the gateway and
uSID datapath counters that rose on each dfw node.
TestMASQUEPublicListener's setup takes extra overlay patches and nodes
so both tests share it.
@privateip
privateip force-pushed the fix/issue-1511-failover branch from a01e0dc to 616f466 Compare December 1, 2026 21:56
@privateip
privateip enabled auto-merge December 1, 2026 22:15
@privateip

Copy link
Copy Markdown
Contributor Author

First pass: pr-adversary returned "VERDICT: merge" with no code defects found, go vet clean and CI green; the lab timings were not re-run, and the author accepts their own lab run. pr-conventions-reviewer returned "VERDICT: hold" over commit format. Its concerns about collisions with #1465 and #1549 were checked and no hunks overlap.

Fixes applied: the history was rebased linear, then squashed to two commits, fix(lab) and test(edge). The copy_config comment was trimmed to one line, and the TestListenerFailover docstring no longer links out. No other content changed.

Second pass: pr-rereviewer confirmed the subjects, the linear history, the unchanged content and go vet. pr-conventions-reviewer's squash and comment nits were applied afterwards. The author kept the PR ready and kept the Lab result section.

The PR merges cleanly with main after #1465 (2d5d35b), and vet and lint on ./tests/edgeconformance/... pass on the merged tree. task verify:listener-failover is lab-only and not in CI.

CI on 616f466: 26 checks passed, 2 skipped, none failed. Auto-merge is enabled with the merge method, the only one the main ruleset allows. The ruleset requires one approving review from a code owner, and the last push needs approval, so the PR waits for a human approval.

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.

Serve gateway VIPs from listener attachments

2 participants