Skip to content

fix(l4route): honor weight:0 as drain, don't normalize to 1 - #492

Merged
bpalermo merged 1 commit into
mainfrom
fix/l4route-zero-weight-drain
Jul 10, 2026
Merged

bpalermo merged 1 commit into
mainfrom
fix/l4route-zero-weight-drain

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

The Phase-3b L4-routing e2e found an explicit backendRef weight: 0 didn't drain — a 100/0 shift still split ~50/50. l4route.go normalized if w==0 { w=1 }, so an explicit zero became weight 1. The reconciler already defaults unset→1 (passing explicit 0 through), so a 0 at the proxy is a deliberate drain. Fix: omit zero-weight backends; all-drained falls back to the passthrough floor. Tests updated (the prior test encoded the bug).

The Phase-3b L4-routing e2e found that an explicit backendRef weight:0 on a
TCPRoute/TLSRoute/UDPRoute did NOT drain the backend — a 100%/0% shift still
split ~50/50. Root cause: l4RulesToWeightedClusters / l4BackendsToWeightedClusters
in agent/internal/xds/proxy/l4route.go normalized `if w == 0 { w = 1 }`, so an
explicit zero (drain) became weight 1 (equal share). Gateway API requires weight 0
= no traffic.

The reconciler already defaults an UNSET backendRef weight to 1 (nil → 1) while
passing an explicit 0 through, so a 0 reaching the proxy layer is always a
deliberate drain. Fix: OMIT zero-weight backends from the weighted set instead of
normalizing. All-drained collapses to an empty set → buildWeightedTCPProxy returns
nil → the chain falls back to the passthrough floor (unchanged behavior).

Tests: zero-weight backend omitted (single remaining collapses to TcpProxy_Cluster);
all-drained falls back to the floor; updated the prior test that asserted the buggy
0→1 normalization to assert drain semantics.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S
@bpalermo
bpalermo merged commit 0236cfe into main Jul 10, 2026
@bpalermo
bpalermo deleted the fix/l4route-zero-weight-drain branch July 10, 2026 01:17
bpalermo added a commit that referenced this pull request Jul 10, 2026
Phase 3b L4 routing is e2e-validated on talos — TCPRoute weighted routing and
TLSRoute SNI passthrough both work with live traffic, and the weight:0 drain bug
is fixed (#492). Flip the chart default agent.l4Routes false→true so TCPRoute and
TLSRoute work out of the box (like transparentCapture/meshDns).

Inert when no L4 routes exist: services keep the single-cluster passthrough floor
chain, so this only adds the TCPRoute/TLSRoute/UDPRoute watches + the RBAC. Requires
transparentCapture (already default-on). UDPRoute stays CONTROL-PLANE ONLY (plaintext
floor, no DTLS) — accepted + listeners generated, data path unvalidated.


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

Co-authored-by: Claude Opus 4.8 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 16, 2026
…l4project (#772) (#783)

* refactor(l4route,edge): one shared L4 backendRef projector in common/l4project (#772 A8)

`buildL4Backends` existed twice, with the same signature and — line by line —
the same semantics: `agent/internal/l4route/reconciler.go:466` (node agent,
capture-path TCP/TLS/UDP routes, proposal 018 Phase 3b) and
`agent/internal/edge/gatewayapi/reconciler.go:946` (edge gateway, proposals
003/018/021). The duplicated `TestBuildL4Backends_*` tests were the symptom the
test review flagged ("do not consolidate the tests until the two methods are
merged").

Behavioural diff, decided per row (no proposal documents a mesh-vs-edge
difference, and #492 — weight:0 = drain — lives in the proxy layer, not here,
so both copies already passed an explicit 0 through):

  backendRef group filter   identical (non-empty group skipped)      → kept
  backendRef kind filter    identical (kind != Service skipped)      → kept
  empty name                identical (skipped)                      → kept
  ReferenceGrant check      identical logic, different helper
                            (l4route local vs attachment.*)          → one impl
  weight defaulting         identical (nil → 1)                      → kept
  weight: 0                 identical (passed through as drain)      → kept
  namespace defaulting      identical (backendRef ns, else route ns) → kept
  service key               identical (serviceref "<ns>/<svc>")      → kept
  cluster naming            ONLY real difference: edge is TCP-only,
                            the agent also needs "udp:" clusters     → ClusterNameFunc
  port                      neither qualifies L4 backends by port    → documented
  missing Service           neither resolves existence here (the
                            reconcilers report it via ResolvedRefs)  → documented

New package `common/l4project` (not `common/gammaproject`: that package's doc
scopes it to the HTTPRoute/GRPCRoute → `registryv1.GammaRoute` *proto*
projection; L4 backends are a plain Go model and are not exported
cross-cluster). It mirrors gammaproject's shape, including the private
`backendPermitted`/`backendServiceKey`/`derefBackendNamespace` helpers, and
stays free of agent internals — the caller passes a `ClusterNameFunc`, because
the "tcp:"/"udp:" cluster naming lives in the agent's Envoy builders.

`proxy.L4Backend` becomes a type alias for `l4project.Backend`, so the cache and
the Envoy builders are untouched and both reconcilers return the shared type
directly instead of converting.

Tests: the two `TestBuildL4Backends_*` sets collapse into one table-driven
`TestBackends` in `//common/l4project`, a strict superset of both — foreign
group, non-Service kind, explicit core group/Service kind, empty name, nil
weight → 1, explicit weight 0 as drain (#492), weighted splits, ungranted
cross-namespace dropped, granted cross-namespace keeping its own namespace key,
a grant naming the wrong route kind, UDP cluster naming, and the empty-input
case — plus unit tests for the three helpers. Each reconciler keeps one thin
`TestBuildL4Backends_Wiring` case proving it wires the projector with the right
cluster namer; l4route's existing rule-level tests (TCP/TLS/UDP) are unchanged.

Production code: 117 lines deleted, 24 added across the three touched files;
127 lines added in the shared package (net ~ -30 including its doc comment).
Tests: 81 deleted, 19 added in the reconcilers; 280 added in the shared table.

Verification: `bazel build //... //test/e2e:e2e_test` OK; `bazel test //...`
101/101 PASSED (incl. `//test/envoy_validate:envoy_validate_test`);
`bazel run //:format.check` clean; `bazel build --config=lint
--@aspect_rules_lint//lint:fail_on_violation //...` clean; `bazel run //:gazelle`
no churn; `bazel mod tidy` idempotent; `scripts/go-deps-audit.sh` exit 0.

Cluster validation (data path) is pending and happens separately. Note for the
orchestrator: `e2e.yaml` has NO tcp/tls/udp job — its jobs are build,
gateway-http, mesh-http, waypoint, replicator, uds, and both conformance
profiles are HTTP-only. The L4 path's automated coverage is the unit tests plus
`//test/envoy_validate`; end-to-end TCP-floor/TLS-SNI/UDP exercise is a
hands-on talos run.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

* docs: list common/l4project in the Core Packages map (#772 A8)

The new shared L4 projector introduced by the previous commit gets an entry
next to its L7 sibling common/gammaproject.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 20, 2026
GenerateUDPCaptureListener sets a bare Cluster route specifier taken from
backends[0] of the first sorted service key, so three UDPRoute inputs are
silently dropped:

  1. backend weights beyond the first -- udp_proxy carries one cluster, so a
     90/10 UDPRoute sends 100% to one backend;
  2. a second UDPRoute-backed service on the same pod -- there is one UDP
     listener per pod and it is already bound to the first;
  3. weight 0 on the chosen backend -- that means DRAIN for TCP and TLS
     (#492) and UDP forwards to it anyway.

The failure is silent from both ends: the route is accepted by the API,
common/l4project resolves and weights the backends correctly, and the data
plane quietly ignores them. No NACK, no warning, no stat -- so the first
symptom is datagrams arriving somewhere unintended, and the only way to
discover the limit today is to read the generator.

This does not change what is generated. It makes the gap visible:

  - proxy.UnsupportedUDPRouteShapes() reports the discards as reasons. Pure
    and exported -- the proxy package builds config and does not log, so the
    caller decides what to do with them.
  - aether.agent.l4route.udp_unsupported counts them per snapshot generation.
  - the cache logs one WARN per reason, naming the pod and the issue.

Full support is the other half of #873 and needs a matcher-based
RouteSpecifier; this is the half that stops the silent case.

The detector duplicates the generator's selection, so it can drift from it --
which would be worse than no warning, since it would name the wrong cluster.
TestUnsupportedUDPRouteShapesTracksTheGenerator pins them together by
generating a real listener and asserting it bound to the service the detector
named. Seen red: reversing ONLY the detector's key order (leaving the
generator's alone) fails with

  reason should say ns/z was dropped because the listener is bound to
  udp:a.mesh, got: service "ns/a" is dropped entirely: ... bound to
  "udp:z.mesh" (service "ns/z")

No charts/ change, so no Chart.yaml bump.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo added a commit that referenced this pull request Sep 20, 2026
#874)

GenerateUDPCaptureListener sets a bare Cluster route specifier taken from
backends[0] of the first sorted service key, so three UDPRoute inputs are
silently dropped:

  1. backend weights beyond the first -- udp_proxy carries one cluster, so a
     90/10 UDPRoute sends 100% to one backend;
  2. a second UDPRoute-backed service on the same pod -- there is one UDP
     listener per pod and it is already bound to the first;
  3. weight 0 on the chosen backend -- that means DRAIN for TCP and TLS
     (#492) and UDP forwards to it anyway.

The failure is silent from both ends: the route is accepted by the API,
common/l4project resolves and weights the backends correctly, and the data
plane quietly ignores them. No NACK, no warning, no stat -- so the first
symptom is datagrams arriving somewhere unintended, and the only way to
discover the limit today is to read the generator.

This does not change what is generated. It makes the gap visible:

  - proxy.UnsupportedUDPRouteShapes() reports the discards as reasons. Pure
    and exported -- the proxy package builds config and does not log, so the
    caller decides what to do with them.
  - aether.agent.l4route.udp_unsupported counts them per snapshot generation.
  - the cache logs one WARN per reason, naming the pod and the issue.

Full support is the other half of #873 and needs a matcher-based
RouteSpecifier; this is the half that stops the silent case.

The detector duplicates the generator's selection, so it can drift from it --
which would be worse than no warning, since it would name the wrong cluster.
TestUnsupportedUDPRouteShapesTracksTheGenerator pins them together by
generating a real listener and asserting it bound to the service the detector
named. Seen red: reversing ONLY the detector's key order (leaving the
generator's alone) fails with

  reason should say ns/z was dropped because the listener is bound to
  udp:a.mesh, got: service "ns/a" is dropped entirely: ... bound to
  "udp:z.mesh" (service "ns/z")

No charts/ change, so no Chart.yaml bump.


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

Co-authored-by: Claude Opus 5 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 20, 2026
…868) (#876)

L4 routing (proposal 018 Phase 3b) is shipped, default-on and unconditional,
and the only thing standing behind it is unit tests of the projector. This is
PR1 of #868: the cheap half, so the config shapes are gated on every PR rather
than once a night (scripts/ci-impacted-targets.sh classifies
//test/envoy_validate as a unit target).

Three bootstraps now go through the pinned production Envoy in --mode validate:

  - capture_tcproute_bootstrap.json  weighted_clusters tcp_proxy on the floor
                                     chain, two backends 75/25
  - capture_tlsroute_bootstrap.json  two per-SNI chains matching <VIP>/32 +
                                     server_names, ALONGSIDE the floor chain
                                     matching the same /32 with no server_names
  - capture_udp_bootstrap.json       connection-less udp_proxy listener plus
                                     the plaintext STATIC "udp:" cluster

Envoy's opinion is the point for two of these. Dropping the SNI match makes it
reject the TLS listener outright ("filter chain ... has the same matching rules
defined as ..."), and moving the udp_proxy config into a filter chain makes it
reject the UDP one ("1 filter chain(s) specified for connection-less UDP
listener") -- a rule l4route.go records in a comment and nothing enforced until
now. So it is Envoy, not a Go assertion, that certifies the SNI chains and the
floor chain can share a listener. That coexistence IS the fall-through #868
asks about: a non-matching SNI reaching the floor is designed behaviour, since
Envoy selects chains by specificity, so it is asserted positively rather than
assumed away. The issue's original wording had this backwards.

Validation is fail-open about everything it has no opinion on, though, and it
is entirely satisfied by a fixture that stopped emitting the thing under test.
So each leg also gets a structural assertion over the serialised bytes: the
weights survive, a drained backend (weight 0) collapses the proxy to the
single-cluster form rather than being normalised to an equal share (#492),
every weighted cluster is actually defined (tcp_proxy has no on-demand CDS),
the UDP listener carries zero filter_chains and binds UDP in the pod netns, and
the "udp:" cluster has no transport socket and dials the backend's APPLICATION
port.

Every assertion was seen red once, by reverting the production hunk it guards
where one exists -- including the pre-#492 `weight 0 -> 1` normalisation, which
this reproduces as "bravo still present at weight 1". Two of the first drafts
could NOT fail: they compared the generated weights and the capture port
against the same constants the fixture was built from. Both now assert
independent literals, with the measurement in a comment, because that is the
aether#853 shape appearing inside the test written to avoid it.

UDP scope is delivery only. GenerateUDPCaptureListener takes a bare Cluster
from the first backend of the first sorted service, so backend selection is not
expressible (#873); no assertion pretends otherwise.

Test-only: no charts/ change, so no Chart.yaml bump.


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

Co-authored-by: Claude Opus 5 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 20, 2026
… (#879)

Adds e2e/l4routes.sh, the e2e/l4echo test backend, and a hard-gated `l4-routes`
job in the nightly e2e workflow. Proposal 018 Phase 3b has had no end-to-end
coverage at all: #492 (an explicit backendRef weight:0 normalised to 1, so
"drain" meant "equal share") shipped and was found by hand, and no upstream
conformance profile can express a Service-parented mesh L4 route.

The TCPRoute leg only; TLSRoute and UDPRoute follow as separate PRs.

Assertions, all against a real data path (kind + the real chart + the real
aether-proxy + the CNI's transparent capture):

  T1.0  control      no TCPRoute             -> 20/20 probes reach the FLOOR
  T1.1  split        75/25 over 200 probes   -> a justified band, never `floor`
  T1.2  drain        weight 0 is DRAIN, asserted EXACTLY and in BOTH directions
  T1.3  all drained  every weight 0          -> back to the FLOOR
  T1.4  delete       no TCPRoute again       -> back to the FLOOR

T1.0/T1.3/T1.4 are permanent built-in negative controls, not setup: the same
probe must produce a different NAMED answer in each state, so the suite
re-demonstrates its own discriminating power on every run rather than once at
review time (the #853 trap). The T1.1 band is derived, not guessed — the
sampling maths is in the script next to the numbers.

Seen RED by reverting the #492 hunk and rebuilding the agent image: T1.2a went
red with "bravo took 1/200 connections at weight 0", and T1.3's state measured
alpha=19 bravo=31 of 50 instead of 50 floor — the ~50/50 the original bug report
describes. Reverting the revert returns the suite to green.

Two preconditions the harness had to discover the hard way, both filed as their
own issues and both documented in the script header:

  * SPIRE must be ON (#877). With --spire-enabled=false captureTCPClusters()
    publishes no "tcp:" clusters (no node SVID) and the cleartext inbound
    listener has no TCP floor chain, so an L4 suite copied from uds.sh tests
    nothing. Paying for SPIRE also buys coverage of the "tcp:" cluster's server
    SAN pin — the shape of #464.
  * The registry backend must be etcd (#878). The chart-default kubernetes
    backend returns nothing for PROTOCOL_TCP by design, so a pod annotated
    endpoint.aether.io/protocol: tcp is silently classified http and no TCP
    floor chain exists for a route to replace.

No chart change, so no Chart.yaml bump: agent RBAC already covers tcproutes and
L4 routing has had no values gate since proposal 031.


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

Co-authored-by: Claude Opus 5 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 23, 2026
The kind L4 harness has covered TCPRoute since #879. This adds the two
remaining legs, which is the rest of #868's acceptance.

TLSRoute (T2.0-T2.4). The parent and both backends now speak TLS, so
#868's corrected fall-through criterion can be asserted POSITIVELY: a
third, unmatched SNI must reach the FLOOR backend by name, not merely
fail to reach A or B (an absence is also satisfied by a dropped
connection). SNI selection is asserted in both directions, because a
one-way assertion stays green if the SNI chains are ignored entirely and
chain 0 always wins.

The probes dial a port NO filter chain claims, and that is load-bearing.
BuildCaptureTLSRouteFilterChains matches ClusterIP/32 + server_names with
no destination_port; proposal 037 then gave every TCP-primary service
destination_port-qualified floor chains for :18082 and its own primary
port. Envoy resolves destination_port first and consults the portless
bucket only when no chain claims the exact port, so a TLS dial to either
of those ports lands on the floor and the SNI chains are never
considered. Dialing an unclaimed port leaves exactly the portless
candidates -- the SNI chains and 037's any-port shim -- which is what
makes T2.1/T2.2 and T2.3 a real comparison. Two consequences are stated
in the header rather than left to be rediscovered: TLSRoute is reachable
today only through a shim 037 Phase 4 proposes to remove, and
port-qualifying the SNI chains would move this dial port.

UDPRoute (T3.0-T3.2). Delivery only, per #868's scope note: the per-pod
udp_proxy carries a bare single-cluster RouteSpecifier, so asserting
backend selection would fail by design rather than find a bug (#873).
The 100/0 shape T3.1 uses is the one shape both implementations must
agree on -- today's path takes backends[0] and a weight-honouring one
must DRAIN the weight-0 backend (#492) -- so the assertion survives
#873's fix unchanged. The mirror is deliberately absent: it IS the #873
case. UDP rides the mesh in plaintext and the header says so; a passing
T3 is not evidence of an authenticated UDP path.

Every leg keeps the suite's negative controls, so each probe re-proves
its own discriminating power on every run rather than once at review
time (#853): three `floor` states for TCP, three for TLS, and two
`unanswered` states for UDP.

A missing CRD is a hard failure here rather than a clean skip. `up`
installs all three and now gates on all three being served at v1; a leg
that skips itself green cannot fail, which is the defect this suite
exists to avoid.

NOT EXECUTED AGAINST A CLUSTER. bash -n and the shellcheck gate are
green, the rendered manifests were validated against the gateway-api
v1.6.2 CRD schemas offline, and the chain-selection reasoning above is
read from the generators -- but no run has happened. The UDP data path
in particular has never been exercised anywhere (parked 2026-07-02), so
T3 is the leg most likely to be red first.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo added a commit that referenced this pull request Sep 23, 2026
The kind L4 harness has covered TCPRoute since #879. This adds the two
remaining legs, which is the rest of #868's acceptance.

TLSRoute (T2.0-T2.4). The parent and both backends now speak TLS, so
#868's corrected fall-through criterion can be asserted POSITIVELY: a
third, unmatched SNI must reach the FLOOR backend by name, not merely
fail to reach A or B (an absence is also satisfied by a dropped
connection). SNI selection is asserted in both directions, because a
one-way assertion stays green if the SNI chains are ignored entirely and
chain 0 always wins.

The probes dial a port NO filter chain claims, and that is load-bearing.
BuildCaptureTLSRouteFilterChains matches ClusterIP/32 + server_names with
no destination_port; proposal 037 then gave every TCP-primary service
destination_port-qualified floor chains for :18082 and its own primary
port. Envoy resolves destination_port first and consults the portless
bucket only when no chain claims the exact port, so a TLS dial to either
of those ports lands on the floor and the SNI chains are never
considered. Dialing an unclaimed port leaves exactly the portless
candidates -- the SNI chains and 037's any-port shim -- which is what
makes T2.1/T2.2 and T2.3 a real comparison. Two consequences are stated
in the header rather than left to be rediscovered: TLSRoute is reachable
today only through a shim 037 Phase 4 proposes to remove, and
port-qualifying the SNI chains would move this dial port.

UDPRoute (T3.0-T3.2). Delivery only, per #868's scope note: the per-pod
udp_proxy carries a bare single-cluster RouteSpecifier, so asserting
backend selection would fail by design rather than find a bug (#873).
The 100/0 shape T3.1 uses is the one shape both implementations must
agree on -- today's path takes backends[0] and a weight-honouring one
must DRAIN the weight-0 backend (#492) -- so the assertion survives
#873's fix unchanged. The mirror is deliberately absent: it IS the #873
case. UDP rides the mesh in plaintext and the header says so; a passing
T3 is not evidence of an authenticated UDP path.

Every leg keeps the suite's negative controls, so each probe re-proves
its own discriminating power on every run rather than once at review
time (#853): three `floor` states for TCP, three for TLS, and two
`unanswered` states for UDP.

A missing CRD is a hard failure here rather than a clean skip. `up`
installs all three and now gates on all three being served at v1; a leg
that skips itself green cannot fail, which is the defect this suite
exists to avoid.

NOT EXECUTED AGAINST A CLUSTER. bash -n and the shellcheck gate are
green, the rendered manifests were validated against the gateway-api
v1.6.2 CRD schemas offline, and the chain-selection reasoning above is
read from the generators -- but no run has happened. The UDP data path
in particular has never been exercised anywhere (parked 2026-07-02), so
T3 is the leg most likely to be red first.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo added a commit that referenced this pull request Sep 23, 2026
…#912)

The kind L4 harness has covered TCPRoute since #879. This adds the two
remaining legs, which is the rest of #868's acceptance.

TLSRoute (T2.0-T2.4). The parent and both backends now speak TLS, so
#868's corrected fall-through criterion can be asserted POSITIVELY: a
third, unmatched SNI must reach the FLOOR backend by name, not merely
fail to reach A or B (an absence is also satisfied by a dropped
connection). SNI selection is asserted in both directions, because a
one-way assertion stays green if the SNI chains are ignored entirely and
chain 0 always wins.

The probes dial a port NO filter chain claims, and that is load-bearing.
BuildCaptureTLSRouteFilterChains matches ClusterIP/32 + server_names with
no destination_port; proposal 037 then gave every TCP-primary service
destination_port-qualified floor chains for :18082 and its own primary
port. Envoy resolves destination_port first and consults the portless
bucket only when no chain claims the exact port, so a TLS dial to either
of those ports lands on the floor and the SNI chains are never
considered. Dialing an unclaimed port leaves exactly the portless
candidates -- the SNI chains and 037's any-port shim -- which is what
makes T2.1/T2.2 and T2.3 a real comparison. Two consequences are stated
in the header rather than left to be rediscovered: TLSRoute is reachable
today only through a shim 037 Phase 4 proposes to remove, and
port-qualifying the SNI chains would move this dial port.

UDPRoute (T3.0-T3.2). Delivery only, per #868's scope note: the per-pod
udp_proxy carries a bare single-cluster RouteSpecifier, so asserting
backend selection would fail by design rather than find a bug (#873).
The 100/0 shape T3.1 uses is the one shape both implementations must
agree on -- today's path takes backends[0] and a weight-honouring one
must DRAIN the weight-0 backend (#492) -- so the assertion survives
#873's fix unchanged. The mirror is deliberately absent: it IS the #873
case. UDP rides the mesh in plaintext and the header says so; a passing
T3 is not evidence of an authenticated UDP path.

Every leg keeps the suite's negative controls, so each probe re-proves
its own discriminating power on every run rather than once at review
time (#853): three `floor` states for TCP, three for TLS, and two
`unanswered` states for UDP.

A missing CRD is a hard failure here rather than a clean skip. `up`
installs all three and now gates on all three being served at v1; a leg
that skips itself green cannot fail, which is the defect this suite
exists to avoid.

NOT EXECUTED AGAINST A CLUSTER. bash -n and the shellcheck gate are
green, the rendered manifests were validated against the gateway-api
v1.6.2 CRD schemas offline, and the chain-selection reasoning above is
read from the generators -- but no run has happened. The UDP data path
in particular has never been exercised anywhere (parked 2026-07-02), so
T3 is the leg most likely to be red first.


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

Co-authored-by: Claude Opus 5 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 23, 2026
… (#914)

udp_proxy carries ONE cluster, and the per-pod UDP capture listener was
choosing it with `backends[0]` of the lexicographically first service. Two
of the three things that discarded were bugs, not limits:

  - an explicit weight 0 is a Gateway API DRAIN (#492, shipped for TCP and
    TLS) and the UDP path forwarded to the drained backend anyway;
  - which backend won depended on backendRef ORDER, so a 10/90 split written
    canary-first sent 100% to the canary.

Both are fixed: drained backends are never bound, a service whose every
backend is drained contributes nothing rather than capturing the listener,
and among what is left the heaviest backend wins with ties broken by cluster
name (#135 — a selection that varies between rebuilds of identical input
re-hashes the listener on every push).

A genuine traffic SPLIT stays unrepresentable, and this states why instead of
faking it. Verified against Envoy v1.39.0: udp_proxy's route action registry
is keyed on its own private RouteActionContext and holds exactly one action,
`Route`, whose only field is `cluster`. tcp_proxy's weighted_clusters has no
counterpart.

So does per-service selection, for a reason #873 does not mention and which
rules out its suggested fix direction. The capture path REDIRECTs UDP, which
rewrites the destination before delivery; a datagram listener's only
addressing cmsg is IP_PKTINFO, so a matcher's DestinationIPInput reads the
post-DNAT header and the ClusterIP is gone. Envoy never reads IP_ORIGDSTADDR
anywhere and original_dst is structurally TCP-only. DestinationPortInput is
not packet-derived at all — the port is stamped from the listening socket's
own port. A udp_proxy matcher therefore has nothing to discriminate on; that
needs TPROXY capture or a listener per service, which is a CNI change.

Also closes a dangling-cluster hole found on the way, of the same class as
proposal 037 Risk 1 and #877: captureUDPClusters skips a backend service the
cluster cache does not hold, but the generator would still name its cluster,
and udp_proxy has no on-demand cluster path — the datagrams are accepted and
dropped in silence. Both sides now consult one predicate
(udpClusterForLocked), so the listener and CDS cannot disagree, and
reconcileUDPCaptureListeners rebuilds on snapshot push when the bindable
cluster changes, so a UDPRoute landing before its backend registers does not
stay dark until the next UDPRoute event.

The detector #874 added is no longer a duplicate of the selection it reports
on: both call selectUDPRoute, so the drift that test was pinning is now
unrepresentable. The test stays as the end-to-end pin.


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

Co-authored-by: Claude Opus 5 <[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.

1 participant