Repository navigation
feat: topology-aware routing is a request the cluster can silently decline (ADR 0051) - #86
Merged
Conversation
…cline (ADR 0051)
Setting `spec.trafficDistribution` asks for zone-local traffic; the EndpointSlice
controller decides whether to arrange it, and declines when the endpoints are
distributed too unevenly against zone capacity. There is no event, no condition
and no status field — a Service whose routing works and one whose routing was
refused read identically, while the second keeps paying for cross-zone transfer.
`workload_policy` now carries, per Service, the field, the topology-mode
annotation, and ready-endpoint counts by zone with how many the cluster gave a
hint. The finding is one comparison: a mode set against `hinted: 0`.
Endpoint addresses, targetRef, node and hostname are removed as the object
enters the cache, so the agent never holds a pod IP — the join to a pod is never
made, which is what keeps the counts clear of invariant 6. Counts are per
address family: a dual-stack Service lists each pod twice, and summing doubles
every zone uniformly, leaving the skew plausible and every number wrong.
Adds `discovery.k8s.io/endpointslices` to the ClusterRole. Without it the cache
never syncs, `endpoint_slices` names itself in `unavailable_sources`, and the
Services still ship (ADR 0033).
go test -race ./... && make lint && make chart-lint # green
make policy-e2e # "service web asked for PreferSameZone; 2 ready
# endpoints, 2 hinted, zones map[e2e-zone-a:2]"
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011YRKuL97KRndaopfpixrhp
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.
Setting
spec.trafficDistributionasks for zone-local traffic. TheEndpointSlice controller decides whether to arrange it, and declines whenever the
endpoints are distributed too unevenly against the zones' CPU capacity. There is
no event, no condition and no status field: a Service whose routing works and one
whose routing was refused read identically in
kubectl get svc, and the secondkeeps paying a cross-zone transfer bill its owner believes they eliminated.
What ships.
workload_policynow carries, per Service:traffic_distribution,topology_mode(the two annotations that asked for this before the fieldexisted), and ready-endpoint counts by zone with how many the cluster gave
hints.forZones. The finding is one comparison on one payload — a mode setagainst
hinted: 0— and needs no history, so it belongs to the first-hourreport.
No endpoint identity is read. Addresses (pod IPs),
targetRef,nodeName,hostnameand the deprecated topology map are removed as the object enters thecache (ADR 0046), so they are never held rather than held and dropped. The join
to a pod is never made, which is what keeps the counts clear of invariant 6. It
also bounds memory: a Service with thousands of endpoints would otherwise carry
thousands of addresses for the life of the process.
Counts are per address family. A dual-stack Service lists each pod once in an
IPv4 slice and once in an IPv6 slice. Merged, every zone doubles — uniformly, so
the skew still looks right while every absolute number is wrong.
MUST NOT sum across familiesis stated inbackend-requirements.md.RBAC. Adds
discovery.k8s.io/endpointslices(get/list/watch) — the firstresource in that group. Without it the cache never syncs,
endpoint_slicesnamesitself in
unavailable_sources, and the Services still ship (ADR 0033).Two things the real cluster taught this PR: the API server warns that
PreferCloseis deprecated in favour ofPreferSameZone, which is a secondreason the value is passed through verbatim rather than normalized to a closed
set — the vocabulary moves and the agent cannot be updated to follow it. The e2e
now sets the current spelling and the unit tests keep the deprecated one, because
a fleet mid-migration has both.
backend-requirements.mdceiling 475 → 495;security.mdfits under itsexisting one.
Evidence:
🤖 Generated with Claude Code
https://claude.ai/code/session_011YRKuL97KRndaopfpixrhp