Repository navigation
fix(registry): honour endpoint.aether.io/protocol on the kubernetes backend (#878) - #888
Merged
Merged
Conversation
…ackend The kubernetes backend returned nil for every PROTOCOL_TCP query, so a pod annotated `endpoint.aether.io/protocol: tcp` was accepted at registration and silently dropped on read. On the chart-default backend the operator saw Accepted=True on their TCPRoute and no endpoints, with no diagnostic (#878). The blanket return was a workaround, not a property of Kubernetes, and its own comment said so. The real cause was one layer down: podToEndpoint never read the protocol annotation, so every managed pod looked like an HTTP endpoint and answering a TCP query with that same set made every mesh service collapse to a TCP-only entry -- LoadClustersFromRegistry overwrites the HTTP cluster + GAMMA cap_http vhost with a vhost-less tcp:true entry, and captured requests 503'd (#430). Reading the annotation removes the need for the workaround. Both listings now filter on the pod's declared protocol, in BOTH directions: returning HTTP pods under TCP is #430, and returning TCP pods under HTTP is the same bug mirrored. "A service is HTTP or TCP, never both" still holds, because every pod behind one ServiceAccount carries the same annotation, so RequireProtocolDisjoint keeps passing -- and now has a call site where both maps are non-empty and it can actually fail. Also fixes a second missing parser found alongside it: podToEndpoint never read endpoint.aether.io/ports either, so Ports was nil on every endpoint this backend returned and proposal 005's per-port EDS membership silently did nothing here while working on the write-based backends. Both omissions had one cause -- two copies of the annotation parsers that drifted by OMISSION rather than disagreement -- so the parsers move to a shared leaf package, //registry/endpointmeta, alongside //registry/export. The health-check mode deliberately does NOT move. The two readings differ on the UNSET case and the difference is load-bearing: the CNI path defaults to EDS (delegated liveness is its default) while this backend must default to UNSPECIFIED, because it derives endpoints from the API server and the delegated active-HC path applies only to the write-based backends. Unifying them would have silently flipped the CNI registration path in production. Both sides now say so. No behaviour change for the existing fleet: with no protocol annotation a pod is HTTP, which is what every managed pod is today, so the TCP listing stays empty exactly as before. Negative controls, both seen red before landing: - restoring the blanket TCP short-circuit fails 2 subtests of TestListEndpointsFiltersByPodProtocol (and only those -- the mirror-direction cases pass either way, as they should); - setting Ports back to nil fails 11 subtests. 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 21, 2026
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
bpalermo
added a commit
that referenced
this pull request
Sep 21, 2026
* docs(proposal): multi-protocol ports on one mesh service (037) 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 * docs(proposal): 037 — dedicated TCP mesh port + scheme-typed resolution 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 * docs(proposal): accept 037 and record Phase 0 as shipped 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 --------- Co-authored-by: Claude Opus 5 <[email protected]>
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.
Closes #878.
The bug
ListEndpoints/ListAllEndpointsreturned nil for everyPROTOCOL_TCPquery, so a pod annotatedendpoint.aether.io/protocol: tcpwas accepted at registration and silently dropped on read. On the chart-default backend that meansAccepted=Trueon the user's TCPRoute and no endpoints, with nothing said anywhere.The blanket return was a workaround, and its own comment admitted as much. The actual cause was a layer down:
podToEndpointnever read the protocol annotation. Every managed pod therefore looked like an HTTP endpoint, and answering a TCP query with that same set made every mesh service collapse to a TCP-only entry —LoadClustersFromRegistryoverwrites the HTTP cluster and GAMMAcap_httpvhost with a vhost-lesstcp:trueentry, and captured requests 503'd withno_healthy_upstream(#430). Suppressing the TCP listing hid the symptom; reading the annotation removes the cause.What changed
Both listings filter on the protocol each pod declares, in both directions. Returning HTTP pods under TCP is #430; returning TCP pods under HTTP is the same bug mirrored, and would put a raw-TCP pod behind an h2 cluster.
The "a service is HTTP or TCP, never both" invariant is untouched and still holds, because every pod behind one ServiceAccount carries the same annotation.
RequireProtocolDisjointkeeps passing — and now has a call site where both maps are non-empty, which is the only shape in which it can fail. Its existing call site runs the loop body zero times; that is now noted in place rather than left to look like coverage.A second missing parser, same cause
podToEndpointnever readendpoint.aether.io/portseither.Portswas nil on every endpoint this backend returned, so proposal 005's per-port EDS membership has never worked here while working fine on the write-based backends. Nobody had hit it, but it is the same defect wearing a different hat.Both omissions came from one thing: two copies of the annotation parsers that drifted by omission rather than disagreement. A missing parser is invisible in a way a wrong one is not — nothing fails, the field is simply zero. So the parsers move to a shared leaf package,
//registry/endpointmeta, following the//registry/exportprecedent.One parser deliberately did NOT move
The health-check mode. The two readings genuinely differ on the unset case:
//registry(CNI path)//registry/internal/k8sThe CNI path defaults to EDS because delegated liveness is its default; this backend must default to UNSPECIFIED, because it derives endpoints from the API server and the delegated active-HC path applies only to the write-based backends. Unifying them — which is exactly what a tidy-minded dedup would have done — would have silently flipped the CNI registration path in production. Both sides now carry a note saying not to.
Risk
No behaviour change for the existing fleet. With no protocol annotation a pod is HTTP, which is what every managed pod on talos-main is today, so the TCP listing stays empty exactly as it was. The change only becomes visible once somebody annotates a pod
tcp— which is the thing that is currently broken.Negative controls
Both halves were seen red before landing, not asserted by inspection:
TestListEndpointsFiltersByPodProtocol—tcp_pod_is_returned_for_a_TCP_queryandmixed_pods_split_cleanly:_TCP_side. Only those two: the mirror-direction cases pass either way, which is correct and is why the count matters.Portsback to nil fails 11 subtests.My first attempt at the second control was inconclusive — removing the field left
portsunused, so it was a compile error rather than a test failure. Redone so the assertion actually runs.Verification
//registry/...,//agent/internal/cni/...,//agent/internal/xds/...,//registrar/...all pass;bazel build //...clean (so nogo is happy);--config=lint --@aspect_rules_lint//lint:fail_on_violationclean; no gazelle drift.Existing test coverage for the moved parsers was repointed at
endpointmeta, not deleted.Relationship to #881
This is Phase 0 of proposal 037 and is deliberately independent of it: it fixes #878 on the existing invariant, needs no design decision, and nothing here presumes the multi-protocol direction is accepted.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr