Repository navigation
feat(registry): carry per-port protocol on the endpoint (037 Phase 2, Release B part 1) - #892
Merged
Merged
Conversation
… Release B part 1)
The registry half of Release B: ServiceEndpoint now records the L4 class of
each advertised port, and the shared parser understands the `=tcp` suffix that
declares it.
- `map<uint32, PortProtocol> port_protocols = 12` on ServiceEndpoint
(edition 2023, IMPLICIT presence, additive). A port present in `ports` but
absent here takes the protocol of the endpoint's registry KEY -- the
pre-037 whole-pod classification, kept as the per-port default -- so an
endpoint written by an older agent means exactly what it always meant and
readers must tolerate the field's absence.
- endpointmeta.PortProtocols parses the extended suffix grammar:
"8080,9090=h2,9000=tcp". An unsuffixed port inherits the pod-level
endpoint.aether.io/protocol, which is why that annotation is KEPT rather
than deprecated -- it becomes the default for the port set and every
existing manifest is unchanged.
- Both construction paths populate it from the same parser: the CNI
registration path and the kubernetes backend's podToEndpoint. The two must
not drift again (#878).
The proposal specified `map<uint32, Service.Protocol>`, which does not compile:
service.proto already imports endpoint.proto (a Service carries its endpoints),
so referencing Service.Protocol from ServiceEndpoint is a CIRCULAR import.
Declared a top-level PortProtocol enum with identical values instead.
TestPortProtocolMatchesServiceProtocol pins the correspondence -- including the
value COUNT, so a value added to one and not the other fails -- because nothing
in the proto system enforces it and every conversion between them relies on it.
Unifying properly means moving Protocol out of Service, which renames
registryv1.Service_Protocol at 441 sites across 47 files; that is worth doing
on its own, not folded into a feature diff where it would hide the feature.
`grpc` is deliberately not an accepted suffix: gRPC is h2 on the wire and the
mesh does nothing gRPC-specific at L4, so accepting it would advertise a
distinction the data plane does not make. h1 and h2 are both HTTP here -- the
codec is an agent-local loopback concern the registry does not carry.
An unrecognised suffix is an ERROR, not a default. Defaulting is how a typo
becomes a port silently served over the wrong protocol, which is the failure
this proposal exists to remove.
NOT included, deliberately: dual registration and dual promotion. A pod serving
both classes still registers under its pod-level protocol only, so its TCP port
is not yet in the TCP listing. Those touch four call sites and carry the
half-promotion risk (037 Risk 5: promoting health under one key leaves the
other UNHEALTHY forever, with no error -- the cluster is simply empty of
healthy hosts). They land next, on their own.
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.
Proposal 037 Phase 2, Release B part 1 — the registry half. Follows #890 (Release A, deployed to talos-main as rev232).
What ships
map<uint32, PortProtocol> port_protocols = 12onServiceEndpoint(edition 2023, IMPLICIT presence, additive). A port present inportsbut absent here takes the protocol of the endpoint's registry key — the pre-037 whole-pod classification kept as the per-port default. An endpoint written by an older agent therefore means exactly what it always meant, and readers must tolerate absence.endpointmeta.PortProtocolsparses the extended suffix grammar,"8080,9090=h2,9000=tcp". An unsuffixed port inherits the pod-levelendpoint.aether.io/protocol— which is why that annotation is kept rather than deprecated. It becomes the default for the port set, so every existing manifest is unchanged.podToEndpoint. They must not drift again (endpoint.aether.io/protocol: tcp is silently downgraded to http on the kubernetes registry backend #878).The proposal's spec didn't compile
It specified
map<uint32, Service.Protocol>. That's a circular import:service.protoalready importsendpoint.proto, because aServicecarries its endpoints.I declared a top-level
PortProtocolenum with identical values instead.TestPortProtocolMatchesServiceProtocolpins the correspondence — including the value count, so adding a value to one and not the other fails — because nothing in the proto system enforces it and every conversion relies on it.Unifying them properly means moving
Protocolout ofService, which renamesregistryv1.Service_Protocolat 441 sites across 47 files. That's worth doing on its own, not folded into a feature diff where it would hide the feature.Two vocabulary decisions
grpcis not accepted as a suffix. gRPC is h2 on the wire and the mesh does nothing gRPC-specific at L4, so accepting it would advertise a distinction the data plane doesn't make.h1andh2both map to HTTP here — the codec is an agent-local loopback concern the registry doesn't carry.An unrecognised suffix is an error, not a default. Defaulting is how a typo becomes a port silently served over the wrong protocol, which is the failure this proposal exists to remove. Note the agent-side
AppPortProtocolsdoes default an unknown suffix to HTTP/1.1 today — that asymmetry is Release B part 2's problem.Deliberately NOT included
Dual registration and dual promotion. A pod serving both classes still registers under its pod-level protocol only, so its TCP port isn't in the TCP listing yet. The field is populated and carried; nothing consumes it for keying.
They're held back because they touch four call sites (
pod.go,termination.go,liveness.go,ghostsweep.go) and carry Risk 5: promoting health under one key leaves the otherUNHEALTHYforever, with no error — the cluster is simply empty of healthy hosts. That deserves its own diff and its own contract test.Verification
bazel build //...clean, 57 tests pass, lint clean,deps-auditOK.New coverage: the suffix grammar (including both error paths), the protocol-set derivation that dual registration will key off, the enum correspondence, and the CNI construction path asserting a mixed pod's map. Existing k8s fixtures were extended rather than weakened.
Release A is live
rev232 on talos-main, 19/19 Ready, 0 restarts — and the migration fix is proven on Services created months ago: all 14 mesh Services converged to
mesh=18081 mesh-tcp=18082 http=80 https=443, zero drift. Without that fix they'd have kept their single port and the new spellings would have worked only on a fresh install.One limit worth stating: the CNI's 18082 redirect can't be verified at runtime from here. The plugin runs as a binary invoked by containerd rather than in the agent pod, and
kubectl execis denied, so the live nftables ruleset isn't readable. The unit test pins the encoded dport (0x46a2); runtime confirmation arrives with Release B part 2, when a chain actually matches it.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr