Repository navigation
Description
Found while writing #868's TLSRoute e2e leg. Filing separately per one-issue-per-finding — this is a control-plane reachability limit, not test debt.
This is a code-read conclusion, not an observation: the harness that would confirm it (#868's T2 leg) has not been run against a cluster yet. It is filed now because it determined a design decision in that harness, and because the Phase 4 coupling below is the kind of thing that is cheap to notice now and expensive to notice later.
What the code does
BuildCaptureTLSRouteFilterChains (agent/internal/xds/proxy/l4route.go:121-157) gives each SNI chain a match of prefix_ranges: <ClusterIP>/32 + server_names — and no destination_port.
Proposal 037 Phase 2 then gave every TCP-primary service destination_port-qualified floor chains (tcpPrimaryFloorChains, agent/internal/xds/proxy/capture.go:514):
cap_tcp_<svc>_18082— the well-known TCP mesh port;cap_tcp_<svc>_<primaryPort>— the service's own port;cap_tcp_anyport_<svc>— portless, the deprecation shim.
Envoy resolves destination_port first and falls back to the portless bucket only when no chain claims the exact port. The repo says so itself, in buildCaptureTCPPortFilterChain: "Envoy evaluates destination_port ahead of prefix_ranges".
So for a service with a TLSRoute attached:
| the client dials | chain selected |
|---|---|
VIP:18082 |
cap_tcp_<svc>_18082 — the floor. SNI chains never considered. |
VIP:<primaryPort> |
cap_tcp_<svc>_<primaryPort> — the floor. SNI chains never considered. |
VIP:<any other port> |
portless bucket → SNI chain wins on server_names, else the any-port shim |
Why it matters
- TLSRoute does not work on the mesh's own spellings.
:18082is the well-known TCP spelling proposal 037 introduced precisely so a raw-TCP client has an unambiguous address, and a service's primary port is the other obvious one. A TLSRoute is accepted, getsAccepted=True, produces correct filter chains — and is inert for both. Silent on both sides, like UDPRoute ignores backend weights and collapses multiple services onto one cluster #873. - TLSRoute's only working path today is a shim that is scheduled for removal.
cap_tcp_anyport_<svc>is 037's deprecation shim, and Phase 4 is gated ontcp.cap_tcp_anyport_<svc>.downstream_cx_totalreading zero across a release. Any TLSRoute traffic increments that counter, so TLSRoute usage both depends on the shim and corrupts the evidence for removing it. If Phase 4 lands as specified, TLSRoute stops working entirely.
Fix direction
Port-qualify the SNI chains the same way tcpPrimaryFloorChains qualifies the floor: emit cap_tls_<svc>_<port>_<i> for :18082 and the primary port alongside (or instead of) the portless spelling. qualifyChainByPort already exists and already clones rather than mutates, so the shape is there.
Worth settling at the same time: whether a TLSRoute should serve :18082 at all, or whether SNI routing is only meaningful on the service's own port.
Acceptance
- a TLSRoute attached to a service routes by SNI when the client dials
:18082and the service's primary port, not only an unclaimed port - TLSRoute traffic no longer depends on
cap_tcp_anyport_<svc>, so Phase 4's zero-counter gate stays meaningful - the assertion is seen red once before being trusted (No shell script in the root workspace is linted: the shellcheck aspect has no sh_* target to visit #853) — no end-to-end coverage for L4 routes (TCPRoute / TLSRoute / UDPRoute) #868's T2 leg can be pointed at the primary port to produce that red
Related: #868 (the e2e that surfaced it; its T2 leg deliberately dials an unclaimed port and says why in the script header), #897 / #900 (037 Phase 3 and the any-port shim), #873 (the UDP sibling: accepted, projected, silently inert).
Activity
bpalermo commentedon Sep 23, 2026
Confirmed by code read, and it is a regression introduced by proposal 037
I verified both halves on
main:BuildCaptureTLSRouteFilterChains(agent/internal/xds/proxy/l4route.go:122) builds aFilterChainMatchwithPrefixRanges(ClusterIP/32) +ServerNamesand nothing else. NoDestinationPort.qualifyChainByPort(agent/internal/xds/proxy/capture.go, 037 Phase 2) setsFilterChainMatch.DestinationPorton the floor chains it emits for:18082and the service's primary port.Envoy resolves
destination_portfirst, ahead ofprefix_ranges,server_names,transport_protocolandapplication_protocols. That ordering is stated in proposal 037 itself — it is the whole reason the per-port design works — and it is exactly what breaks TLSRoute here.Before 037 the floor chain was portless, so the SNI chain (
prefix_ranges+server_names) was strictly more specific and won. After 037 the port-qualified floor chains outrank it at both mesh spellings. So a TLSRoute is Accepted, generates correct-looking chains, and is inert on:18082and on the primary port.The comment above the chain assembly in
capture.gostill says the SNI chains are "inserted first so Envoy evaluates server_names+IP before the destination-IP-only TCP floor chain". That was true when written and is now misleading twice over: filter-chain selection is by specificity, not position, and the floor chain is no longer destination-IP-only.The Phase 4 coupling is the worse half
Your observation that TLSRoute's only surviving path is the any-port shim is correct, and it contaminates proposal 037's Phase 4 gate. Phase 4 deletes the portless floor chain once
cap_tcp_anyport_<svc>.downstream_cx_totalreads zero across a release. If TLSRoute traffic lands there, then:The rev234 measurement itself stands — talos-main has no TLSRoute objects, so nothing could have incremented the counter by this path, and the 8h reading of zero (against three sanctioned chains carrying ~23,700 connections each) is still a valid measurement of what it measured. But the gate's meaning has to be restated: it is only evidence about legacy spellings on a cluster with no TLSRoutes. That qualification was not in the Phase 4 criterion and needs to be.
Fix direction
Give the SNI chains the same
destination_portqualification the floor chains got — one chain per (SNI, sanctioned port) — so they outrank the floor at:18082and the primary port instead of losing to it. That restores TLSRoute on both mesh spellings and takes it out of the shim's bucket, which decouples Phase 4's gate again.Worth pinning with an
envoy_validatecase as well as the e2e, since the failure is a silent precedence change in generated config rather than an error.Filed against my own work: 037's Phase 2 shipped the port-qualified floor chains without checking what else matched on that VIP.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr