Repository navigation
feat(mesh): support non-HTTP (TCP) services end-to-end - #297
Merged
Merged
Conversation
PR #294 (TCP-over-mTLS floor) and #296 (TCPRoute/TLSRoute/UDPRoute L4 routing) were both unreachable because the service model was HTTP-only: a workload could never be classified as TCP. This lets a workload be registered and generated as a PROTOCOL_TCP service so the capture TCP floor and L4 routes become reachable and e2e-testable. - proto: add Service.Protocol PROTOCOL_TCP = 2. - registration (registry/cni.go): pick the protocol from the new endpoint.aether.io/protocol pod annotation (default "http"; "tcp" => PROTOCOL_TCP; unknown values rejected). - generator: project PROTOCOL_TCP services into selectorless mesh Services annotated aether.io/app-protocol=tcp (the agent capture reconciler's TCP-floor signal); one mesh Service per name, HTTP claimed first. - registrar snapshot/sync/server: list + sync every protocol; supersede write-behind unregisters across protocols. - agent watch cache (RegistrarRegistry): partition the watch-fed cache by protocol so ListAllEndpoints(protocol) returns only that protocol's services; ListAllEndpoints now gates on watch readiness (not a non-empty partition) so an empty protocol returns the truthful empty set. - agent EDS (cache/cluster.go): build TCP service cluster entries holding the bare-name EDS load assignment (+ SAN/sni) that the floor's "tcp:<svc>.<domain>" cluster references; no HTTP h2 cluster/vhost is emitted for a TCP service. - ghost sweep: reconcile both protocols so TCP endpoints aren't ghost-pruned. Operator marks a workload TCP with the pod annotation: endpoint.aether.io/protocol: tcp Adds unit tests: registration picks TCP from the annotation; the generator emits a tcp-annotated mesh Service; the agent builds a tcp:<svc> cluster with EDS endpoints. HTTP behavior is unchanged (default is HTTP). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S
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.
Why
PR #294 shipped a transparent-capture TCP-over-mTLS floor and #296 shipped TCPRoute/TLSRoute/UDPRoute L4 routing, but both were unreachable: the service model was HTTP-only, so a workload could never be classified as TCP. This makes a workload registerable/generatable as a PROTOCOL_TCP service so the floor + L4 routes become reachable and e2e-testable.
Goal e2e (parent runs it): an HTTP echo workload annotated
tcpis reached via the capture TCP floor as a raw mTLS passthrough (the HTTP request rides the passthrough connection) → HTTP 200.How an operator marks a workload TCP
Add a pod annotation (a registration fact — what the pod serves):
Unset or
httpregisters a normal HTTP service (unchanged).tcpregisters the workload underPROTOCOL_TCP; the registrar then projects a selectorless mesh Service annotatedaether.io/app-protocol=tcp, which the agent's capture reconciler reads to emit the per-ClusterIP TCP-proxy floor chain. An unknown value is rejected (no silent mis-registration).What changed
api/aether/registry/v1/service.proto):Service.Protocol PROTOCOL_TCP = 2.registry/cni.go): protocol chosen fromendpoint.aether.io/protocol(new constantAnnotationEndpointProtocol+ProtocolHTTP/ProtocolTCPincommon/constants/annotations.go).registrar/internal/services/generator.go): iterates every protocol and emits TCP services withappProtocol=tcp; one mesh Service per name (HTTP claimed first), no-clobber convergence preserved.syncedProtocols); write-behind unregister supersedes across protocols (the request carries no protocol; a service is registered under exactly one, and the external delete is protocol-agnostic).registry/internal/registrar/registrar.go): the watch-fed cache is partitioned by protocol soListAllEndpoints(protocol)returns only that protocol's services.ListAllEndpointsnow gates on watch readiness (firstSNAPSHOT_COMPLETE) instead of a non-empty partition, so a protocol with no services returns the truthful empty set instead of falling back to an RPC.agent/internal/xds/cache/cluster.go+cache.go): TCP services get a cluster entry holding only the bare-name EDS load assignment (+sanNamespaces/sni); the floor'stcp:<svc>.<domain>cluster (built incaptureTCPClusters) references that EDS byServiceName. No HTTP h2 cluster/vhost is emitted for a TCP service (newclusterEntry.tcpflag).agent/internal/cni/server/ghostsweep.go): reconciles both protocols (newsweptProtocols) so TCP endpoints aren't ghost-pruned.charts/aether/Chart.yamlbumped to0.38.0.Tests
registry/cni_test.go: registration picks TCP from the annotation (and rejects unknown).registrar/internal/services/generator_test.go: generator emits atcp-annotated mesh Service.agent/internal/xds/cache/tcp_service_test.go: agent builds atcp:<svc>.<domain>cluster (EDS service = bare name, per-source mTLS matcher) with the registry endpoint in EDS, and emits no HTTP cluster for it.bazel build //...,bazel test //...(59 pass),bazel run //:format,--config=lintall clean.Design note (called out per task)
The agent's watch-fed
RegistrarRegistrycache was keyed by service name only andListAllEndpointsignored itsprotocolargument. The clean generalization is to partition the cache by protocol (the watch stream already carriesProtocolper event). HTTP services land in the HTTP partition exactly as before, so HTTP behavior is identical; TCP services get their own partition. This is the one place the protocol partitioning was deeper than a pure additive change.🤖 Generated with Claude Code
https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S