Repository navigation
docs(proposal): multi-protocol ports on one mesh service (037) - #881
Merged
Merged
Conversation
A mesh workload is classified HTTP or TCP for the whole pod, and by extension the whole service: "A service is HTTP or TCP, never both, so the two sets never share a name" (cache/cluster.go:202). A pod serving an HTTP API on :8080 and a raw-TCP protocol on :9000 cannot say so, and the mesh Service is generated per ServiceAccount, so splitting is not an option the user has. Draft only -- no code changes, nothing accepted. The constraint is not the map key. The TCP floor's mesh hop carries no SNI and no ALPN (deliberately -- #304, #306), so the destination has exactly one default floor chain and it forwards to the pod's primary port. Fixing the c.clusters collision alone yields "HTTP ports plus one TCP port", not multi-TCP-port. Proposes the per-port model -- a port has a protocol, a service has ports -- by extending the existing endpoint.aether.io/ports suffix grammar with "=tcp", keeping endpoint.aether.io/protocol as the per-port default so every current manifest keeps its meaning. Capture chains gain destination_port, which Envoy evaluates ahead of prefix_ranges and which resolves the "/32 outranks the HCM catch-all" conflict that forces the invariant today. Phased so the fix that does not need any of it ships first: Phase 0 is #878 alone (podToEndpoint honours protocol, and populates Ports -- the kubernetes backend has never carried 005's per-port EDS membership either), on the existing invariant. Each risk states what would make its gate fail, with negative controls, and the two process gates are labelled as such rather than dressed as data-plane ones (#853). Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Revision from the PR #881 review. The first draft resolved the bare name to "the primary port, in the primary's protocol", which re-introduced the asymmetry the proposal exists to remove. - Add ProxyTCPOutboundPort = 18082 beside 18081 (free tree-wide; the only hits are an arbitrary test argument in l4route_test.go). 18081 is HTTP, 18082 is TCP, for every service. - A portless URL resolves by its scheme's default port: http:// is 80 and HTTP by definition, https:// is 443 and TCP iff the app registered it. Raw TCP names its port because it has no scheme. HTTP demuxes on the authority header; TCP demuxes on the 5-tuple - that distinction is now the justification for the scheme, not a wart. - http://svc/ needs NO new config: the HCM chain has no destination-port criterion and RDS matches the portless authority today. Documented intent only. A destination_port:80 chain is listed as rejected. - http:// to a service with no HTTP port: 421 direct_response vhost with x-aether-error, replacing today's unnamed cluster_not_found 503. - https:// to a mesh service: option (a) refuse deterministically via a name-only 443 Service port (kube-proxy REJECT); (b) terminating app TLS at the capture listener is scoped out as its own proposal. - The portless /32 floor chain and its special cases collapse into one uniform destination_port chain; :18082 works under scoped capture (CNI rule extended), per-app-port TCP still needs redirect-all (two tiers). - Generated mesh Services expose 18081, 18082 and name-only 80/443, and the generator must converge Spec.Ports (it converges annotations only today; the MCS clusterset VIP create is create-only). - New Risk 9: registrar advertises :18082 before a node's agent can serve it -> ECONNREFUSED within one RTT, gated by a negative-control e2e. - "Require a port from every caller" recorded under Alternatives. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Phase 0 landed as #888: the kubernetes backend honours endpoint.aether.io/protocol and populates Ports. Two deviations from the proposal text, both found in the writing, are recorded in place: - the shared parser landed as a leaf package //registry/endpointmeta rather than a registry.PortProtocols helper, because //registry/internal/k8s importing its parent interface package is the wrong direction; - the health-check-mode parser was deliberately NOT shared -- the two backends disagree on the UNSET case (EDS vs UNSPECIFIED) and unifying them would have silently flipped the CNI registration path. Also records that only e2e/uds.sh runs on the chart-default kubernetes backend; every other suite, l4routes.sh included, forces etcd, which is #878's complaint in harness form. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft proposal — for review, not for acceptance. No code changes; one new file.
Renders at
docs/proposals/037_multi-protocol-per-service.md.What it is
A mesh workload is classified HTTP or TCP for the whole pod, and by extension the whole service. The invariant is stated once in
agent/internal/xds/cache/cluster.go:202and encoded in six other places (both cluster passes' shared map key, the registrar's protocol-partitioned cache and write-behind, the mesh-Service generator,RequireProtocolDisjoint, and the kubernetes backend'sreturn nilfor TCP). A pod serving an HTTP API on:8080and a raw-TCP protocol on:9000cannot say so.Splitting into two Services is not an escape: the mesh Service is generated per
<ns>/<serviceAccount>, so "two Services" means two ServiceAccounts means two pods, with every identity-keyed policy duplicated.The finding that reframes it
The constraint is not the
c.clusters[serviceName]collision.The TCP floor's mesh hop carries no SNI and no ALPN —
InjectUpstreamTCPMTLS(cl, …, "")atcapture.go:344, deliberately: #306 established that a non-empty SNI would land on the destination's per-port HCM chain, and #304 removed the bespokeaether-tcpALPN. So the destination has exactly one default floor chain, and it forwards to the pod's primary port with no input from the caller.Fixing the map key alone therefore yields "HTTP ports plus one TCP port (the primary)", not a service with several TCP ports.
Almost none of the rest is an Envoy limitation. Envoy evaluates
destination_portahead ofprefix_ranges, and the capture listener already setsuse_original_dst, so a per-port capture chain is a one-field addition to a match that already exists — and it dissolves the "/32outranks the HCM catch-all" conflict that forces the invariant today.What it proposes
A port has a protocol; a service has ports — the shape L7 already has since 005.
Extend the existing
endpoint.aether.io/portssuffix grammar ("8080,9090=h2") with=tcp, and keependpoint.aether.io/protocolas the default for unsuffixed ports, so every current manifest means exactly what it meant. A pure-TCP service is byte-for-byte unchanged.Also:
map<uint32, Service.Protocol> port_protocols = 12onServiceEndpoint(edition 2023, additive), dual registration under the existing keys rather than changing any key layout, per-porttcp:<fqdn>:<p>clusters withSNI=<port>, and matchingin_tcp_<pod>_<p>inbound chains so an HCM chain and a TCP chain never shareserver_names.Phasing
Phase 0 is #878 on the existing invariant and ships independently —
podToEndpointhonoursprotocol, and populatesPorts. That second half is a separate finding this turned up: the kubernetes backend has never readendpoint.aether.io/portseither, soPortsis nil on every endpoint it returns and 005's per-port EDS membership has never worked on the chart default backend.Phases 1–3 are cache keying, per-port protocol, then port-qualified L4 routes.
Review focus
(port, protocol). Everything else serves it.ProjectHTTPRuleresolvesbackendRef.portwithout knowing the port's protocol, and it also runs in the registrar's config-export controller where there are no endpoints. Needs a call.Each risk states what would make its gate fail, with negative controls; the two process gates are labelled as such rather than dressed as data-plane ones (#853).
Related: #878 (Phase 0), #877 (adjacent — design (d) closes its source half structurally, but the fix shouldn't wait), #868/#879 (the L4 harness the kind e2e extends).
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr