Repository navigation
feat(edge): Add public listeners for Edge providers - #1514
Conversation
|
What changes
Choices to review
Risk
Tests
Local runs passed: |
|
Review record for this PR, two passes by two reviewers. First pass at 786cb61. pr-adversary returned merge; it ran go build, go vet, the listener, NetworkService and policy envtests, and go test ./internal/edge/.... pr-conventions-reviewer returned hold on one decision, the overlap with draft #845. The human decided this PR lands first and #845 reconciles the backendSelector rule when it lands. Fixes applied in f49685b and in the PR title, body and first comment: the #1465 regeneration note, a shorter body, the staging-first note, a documented galactic-system assumption in the namespace policy, and a new title. Second pass at f49685b. pr-rereviewer returned merge, confirming all five applied findings are fixed; it ran git diff and git log over the fix and gh pr view. pr-conventions-reviewer returned merge; it ran kustomize build on config/galactic-edge and config/crd, task docs:check-generated, the full diff, and an open-PR overlap check. Nothing above nit remained. Both nits are now applied: f49685b was squashed into one commit, 6725484, with the same tree, which also removes the 59-character subject. Local runs before publishing: task lint, task build, task test:unit with envtest, task test:e2e and task docs:check all passed. CI on f49685b: 26 checks passed and 2 were skipped, none failed. CI reruns on 6725484. Auto-merge is enabled with the merge method, which is the only method the base branch ruleset allows. The ruleset requires one approving review, code owner review and approval of the last push, so the PR waits for a human approval. |
f49685b to
6725484
Compare
ecv
left a comment
There was a problem hiding this comment.
Approve.
API-only change that implements the merged design's Phase 1 and serves nothing: gateways give an edgeListenerRef service no backends, so no VIP is advertised and nothing is reachable. The safety of the merge rests on these claims:
- A provider ServiceAccount cannot create, change, delete or write the status of an
EdgeListenerorNetworkService:galactic-edge-provider-listener(policies.yaml) denies every ServiceAccount anEdgeProviderlists, andgalactic-edge-listener-authorityis an unbound ClusterRole.TestListenerPoliciesexercises the shipped policy (create, update, status, delete, listener and selector services). It runs as the shipped VAP only, not with RBAC. EdgeListener, and anyNetworkServicewithedgeListenerRef, exist only ingalactic-system(galactic-edge-listener-namespace, tested for both kinds), so a project namespace cannot take a provider's backends.- Nothing is served:
ruleCandidateBackendsreturns no backends and a pending reason foredgeListenerRef, covered byTestSelectRuleBackends_EdgeListenerHasNoBackends. TheNetworkServicerule is exactly one ofbackendSelectorandedgeListenerRef, with the non-empty rule kept, andTestNetworkServiceBackendSourceandTestNetworkServiceOmitsEmptySelectorcover it. - Addresses, ports and the provider are platform-set: the spec is writable only by whoever the operator binds the authority role to, and
providerRefandserviceRefare immutable by CEL. The address pool, claim and grant checks (AddressOutsidePool,AddressClaimed,CapabilityNotGranted) are only status constants here; core enforces them in a later phase, and nothing in this PR does.
Follow-ups:
- Phase 2 (core) must be the first thing that makes an
EdgeListenerserve anything, and it must carry the address-pool, cross-listener claim andserviceRefgrant checks with envtest cases before gateways resolve listener backends in phase 4. Today a spec can name anyserviceRefnamespace (another tenant's gVPC) or any address, and only the write path stops it. - The policy denies only ServiceAccounts an
EdgeProviderlists and only matchessystem:serviceaccount:users, like the other edge policies. A provider's own ability to edit itsEdgeProvider.spec.serviceAccountsis therefore load-bearing for claim 1: confirm that is already refused, and add a test line if so. - Source spoofing from another gVPC's addresses is not touched here. It rests on the existing attachment datapath and traffic policy, and design goal 6 should get a negative packet test in phase 3, as its table already says.
- The follow-ups raised on #1513 are half handled:
EdgeListenerPort.protocolis lowercasetcp/udp, matchingNetworkService, so no mapping is needed, but the design's YAML example still usesUDP/TCPand a per-portnamethe CRD does not have, so it would not be admitted as written.drainSecondsis still not explained in the API text; spell out that it also keeps a draining backend selectable. serviceRefhas no UID pin, unlikeEdgeAttachment.serviceRef, as the body says. A delete and recreate of the EdgeService under the same name keeps the grant; fine while the authority is trusted, worth a pin when core lands.
Add EdgeListener, the public addresses and ports the platform gives one provider, and the PublicListener capability on EdgeProvider and EdgeService. Core implements PublicListener v1; an EdgeAttachment still takes only SocketAccess and PacketAccess. NetworkService gains edgeListenerRef. Exactly one of backendSelector and edgeListenerRef is required. backendSelector keeps its value type with omitzero, so callers that build it by value compile unchanged. Until gateways resolve listener backends, a service with edgeListenerRef has no backends and is reported pending instead of failing on an empty selector. Two admission policies refuse any provider ServiceAccount write to an EdgeListener or NetworkService, and keep listeners and services naming one in galactic-system, which the policy assumes is the gateway namespace. An unbound ClusterRole lets an operator grant the platform authority write access to EdgeListeners. Fixes #1508
6725484 to
d907bb8
Compare
Summary
The platform can now give an Edge provider public listeners, though nothing serves one yet. Existing gateway services and providers behave as before, and providers cannot write listeners or gateway services.
Merging this reaches the staging labs, which track main, first, and production edge sites only after a release tag.
Test plan
task lint,task build,task test:unitandtask docs:checkpassFixes #1508