Repository navigation
feat(edge): Create an ingress gVPC per public listener provider - #1520
Conversation
Core now keeps one ingress gVPC per approved provider that lists PublicListener: the VPC edge-ingress-<provider> in the gateway namespace, with a /64 carved from an operator-configured unique local prefix and the provider's operator-assigned fabric identity as its status.vpc. Two galactic-controller flags configure it, both read with --edge: --edge-ingress-identity maps a provider to its decimal identity, and --edge-ingress-prefix is the prefix the /64s come from; it must be reserved for ingress gVPCs. The first /64 a provider tries is fixed by a hash of its name, and the one recorded in the VPC's immutable spec never moves. A provider the prefix has no free /64 for is retried every minute. A recorded identifier is kept, and reported in the VPC's Ready condition, if the configured identity changes. A provider without an identity gets no gVPC and an Event on its EdgeProvider. A provider that may no longer hold a listener loses its gVPC only once no EdgeService grants it and no NetworkService names its identifier. A VPC of that name with a controller is not core's: NSO adopts the VPC named after a NetworkContext in the same namespace, so core neither trusts nor writes one that has a controller. Listener admission finds the gVPC through the IngressVPCs interface, so a later change can look up a VPC another component creates instead. A Role in galactic-system grants the VPC writes. Refs #1509
Before core records a provider's ingress identity as its ingress gVPC's status.vpc, it now lists the VPCs in every namespace. When another VPC already holds that identifier, core writes nothing, reports Ready False with reason IdentityInUse, records an Event on the EdgeProvider, and refuses the gVPC to listeners. It looks again every retry interval, so the identity is recorded once the other VPC lets it go. A provider whose ingress gVPC name, edge-ingress-<provider>, exceeds the object-name limit gets no gVPC and an IngressVPCNameTooLong Event, and is not retried. Tests cover both, and that a VPC of the ingress gVPC's name without core's label and annotation is never written or deleted. Refs #1509
|
Review verdicts at head 2899f07: the correctness re-review says merge, and the conventions review says merge. The first pass asked for three changes, and all three are in. Core now refuses an ingress identity that another network already holds. A test proves core never writes or deletes a network object it did not label. A provider name too long for a network name gets an event and no create loop. The re-review confirmed that both new tests fail when their guard is removed. Two points were declined. The branch keeps its signed merge of main rather than being rebased, because this stack carries main up with merges and never force-pushes. The cluster-wide read on the Role stays, because the controller's informer lists cluster-wide. One CI job, the root-gated installer test, failed on an unrelated health-check timing flake and passed on rerun. |
ecv
left a comment
There was a problem hiding this comment.
Approve.
Per-provider ingress gVPC is isolated by construction (distinct operator-set fabric identity, disjoint /64, a provider's name can never reach another's VPC) and nothing happens until an operator passes --edge-ingress-identity/--edge-ingress-prefix, so merging changes no production behavior; production moves only when infra pins a galactic tag and sets those flags. Checks at 2899f07 are green (Unit Tests, E2E, Lint, Manifests). Repo is public, nothing site-specific here. Stack note: #1522 is not stacked on this PR directly; the chain is #1520 <- #1521 <- #1522 <- #1523.
- Isolation:
carveavoids only /64s of VPCs in the gateway namespace, so overlap with a VPC elsewhere or a prefix not reserved for ingress is not caught (the comment says the prefix must be reserved). Follow-up: say in the infra pin docs that--edge-ingress-prefixis a reserved range, or list VPCs cluster-wide asidentityHolderalready does. - Isolation: the identity-in-use check lists VPCs then patches only its own VPC with an optimistic lock, so two writers claiming one identity (a hand-reserved one now, fabric allocation after #1516) can both pass. Safe today because
ParseIdentitiesrejects duplicates in one flag set. Follow-up: revisit when #1516 lands. - Lifecycle: the gVPC has no owner or finalizer. A provider deleted while the controller is down is still reclaimed because the VPC watch enqueues the provider name on start and the
prov == nilpath runsreclaim. Delete uses a UID precondition and is refused while an EdgeService or NetworkService still holds it. Good. - RBAC: Role
galactic-controller-edge-listenergrants create/update/patch/delete on every VPC ingalactic-system, not just labelled ones; the author documents it and the code only writes objects it labelled and that carry no controller (isIngressVPC). Agree with the declined cluster-wide-read point. Follow-up: if tenant or NSO VPCs live ingalactic-system, a ValidatingAdmissionPolicy limiting this SA toedge-ingresslabelled VPCs would make "least privilege" real. - Tests: the guards (unlabelled/adopted VPC untouched, identity in use, name taken, prefix exhausted) are envtest only; this checkout had no envtest binaries, so I did not run the mutation test myself. The PR comment says the re-review confirmed both new tests fail without their guard, and CI ran them at this head.
- Teammates: none reviewed this PR.
scotwells
left a comment
There was a problem hiding this comment.
Please leave an ingress network alone if another controller adopts it during cleanup. reclaim checks ownership before deletion, but the delete only checks the UID, which adoption does not change. Guard the delete with the resource version you inspected and recheck ownership on conflict. Please cover adoption between the read and delete.
Reclaim checked that core still owned the ingress gVPC, then deleted it on a UID precondition alone. Adoption by another controller does not change the UID, so a gVPC adopted between the check and the delete was deleted anyway. The delete now also requires the resource version inspected. On a conflict core reads the gVPC again and leaves it alone when it is no longer an ingress gVPC core created; otherwise the provider is decided again on the next pass.
|
Fixed in f594e5c. |
scotwells
left a comment
There was a problem hiding this comment.
Approved the per-provider ingress network design. Cleanup now leaves a network alone if another controller adopts it.
Summary
An Edge provider's public listener needs a private network of its own, holding only that provider's listener attachments, and nothing creates one.
Core, the Galactic cell controller, now creates one ingress network per approved provider with the public listener capability, using a /64 from an operator-set unique local prefix and an identity the operator reserves by hand until #1516 moves allocation to the fabric.
It refuses an identity another network already holds, and the later pull requests in this stack put listeners on it.
Its new Role can write any network object in the gateway namespace, so core touches only the ones it labelled, and nothing happens until an operator sets an ingress identity.
Test plan
Related to #1509