Skip to content

feat(api): Let a ServiceEndpoint spread traffic across its producers - #1092

Merged
privateip merged 1 commit into
mainfrom
fix/issue-1086-api
Oct 25, 2026
Merged

privateip merged 1 commit into
mainfrom
fix/issue-1086-api

Conversation

@privateip

@privateip privateip commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A private service endpoint can have only one ready producer per node and VPC, so a service that runs several replicas per node needs one consumer address per replica.

This adds an opt-in spread setting with a required TCP health check, and a status list in which each node reports the health of its own producers.

Nothing reads the new fields yet, so every endpoint behaves as it does today. The generated API reference also picks up a policy description that main had not regenerated.

Test plan

  • The API server accepts spread with a health check, and refuses spread without one, a health check without spread, and a UDP endpoint whose health check names no port
  • Two nodes report their own producers without removing each other's entries
  • Lint and unit suites pass

First of three. Next is the datapath in #1093, then the router in #1094.

Fixes #1086

🤖 Generated with Claude Code

A private service endpoint can have only one ready producer on each node and VPC, so a service that runs two replicas per node for rollouts and crash tolerance needs one consumer address per replica, and clients then lean on the first address and wait out timeouts on the second.

ServiceEndpoint gains spec.distribution, Single by default and Spread to send a consumer's traffic to every ready producer on its node, and spec.healthCheck, a TCP probe of each producer that Spread requires and every other distribution refuses. A udp endpoint's health check must name a TCP port. The endpoint gets a status subresource whose status.producers lists each producer's health decision, keyed by the attachment's namespace and name, so each node can apply its own producers' entries under its own field manager without touching another node's.

Nothing reads these fields yet: a router still treats every endpoint as Single. The generated API reference also picks up a ServiceRouteAuthorization description that main had not regenerated.

Related to #1086

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@privateip privateip self-assigned this Oct 25, 2026
@privateip privateip changed the title feat(api): Let a service endpoint spread traffic across producers feat(api): Let a ServiceEndpoint spread traffic across its producers Oct 25, 2026
@privateip
privateip added this pull request to stack #1096 October 25, 2026 15:29
@privateip
privateip marked this pull request as ready for review October 25, 2026 15:37
@privateip

Copy link
Copy Markdown
Contributor Author

Two independent reviews ran on head 0fca054, and both returned merge with no blocker or warning on this PR's code.

  • The adversarial review regenerated the CRD and found it matches the types. It ran the admission and per-node status test against a real API server and found it passes.
  • The conventions review checked the commit, body and reach, and found nothing blocking. Its one warning was the overlap with Allow NLB backends by address within a VPC #845's generated files, which is settled by landing order: this stack lands first, and Allow NLB backends by address within a VPC #845 regenerates after.

CI is green on this head, including the root and end-to-end jobs.

This is the bottom of stack #1096. The stack merges as a whole into main with gh stack merge 1096 --merge once all three PRs are approved, so per-PR auto-merge stays off. On the upper PRs it would merge into their stack branches, not main.

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve.

Additive, API-only change. Existing ServiceEndpoints (no distribution, no healthCheck) still validate, and no controller code reads the new fields yet, so single-producer behavior is unchanged.

  • Both new CEL rules pass for an object with neither field: the Spread/healthCheck pairing evaluates false == false, and the udp-port rule short-circuits on !has(self.healthCheck). spec.protocol is required, so self.protocol == 'tcp' cannot hit a missing key. The envtest covers the single-default, single, spread, mismatch, udp-no-port and unknown-enum cases.
  • distribution has no CRD default, so stored objects stay unchanged and "Single" is a code-side default. Fine, but the consumer must treat empty as Single.
  • Enabling the status subresource on an existing CRD is safe: no served-version change, no conversion, and existing objects just gain an empty status. After the CRD applies, a spec update no longer writes status, which is fine since nothing wrote it before.
  • Nested defaults (interval 5, timeout 2, thresholds 3) are applied before the timeoutSeconds <= intervalSeconds rule, so omitted values validate.

Follow-ups:

  • config/galactic-router/rbac.yaml grants only get/list/watch on serviceendpoints. The node-side writer needs serviceendpoints/status patch (server-side apply) in the consumer PR, or the first Spread endpoint will fail silently on 403.
  • "Single allows one ready producer per node and VPC; an endpoint that selects more is refused" documents refusal behavior. Confirm the router already enforces this today, otherwise the doc claims behavior this PR does not deliver.
  • status.producers is capped at 4096 but nothing ties it to 16 per node times node count. Large fleets could exceed it; worth a sizing note.
  • The comment on ServiceEndpointHealthCheck has one overlong, unwrapped line ("...stays Unknown. A probe succeeds ..."); tidy when next touched.

@privateip
privateip merged commit f143176 into main Oct 25, 2026
18 checks passed
@privateip
privateip deleted the fix/issue-1086-api branch October 25, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Share private-service traffic across healthy servers

2 participants