design-proposal: public IPs as a first-class resource (PublicIP / PublicIPClaim / PublicIPClass) - #35
Open
Timofei Larkin (lllamnyp) wants to merge 2 commits into
Open
design-proposal: public IPs as a first-class resource (PublicIP / PublicIPClaim / PublicIPClass)#35Timofei Larkin (lllamnyp) wants to merge 2 commits into
Timofei Larkin (lllamnyp) wants to merge 2 commits into
Conversation
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.
What
Adds a design proposal under
design-proposals/public-ip-claims/introducing public addresses as a first-class resource: a cluster-scopedPublicIP, a namespacedPublicIPClaim, aPublicIPClass, and a provisioner contract in the shape of CSI.Status: stub. The problem statement, the primitives survey and the object model are worked out. The controller mechanics, the provisioner contract details and the rollout are deliberately sketched. It is opened early to settle the shape — is an address a resource? — before anyone writes code.
Why
A tenant cannot own a public address. One appears as a side effect of creating a
Service type: LoadBalancer, and evaporates when that Service is deleted. So an address cannot be:The experience we want is the AWS one: allocate an address, keep it, attach it, detach it, attach it to something else, release it when done.
This is a regression, not a wishlist
Cozystack has reserve-then-associate today, via kube-ovn:
OvnEipis created independently and later bound by anOvnFip/OvnSnatRule/OvnDnatRulethat references it by name. Migrating off kube-ovn drops that capability unless something replaces it. The question is not "should Cozystack gain an AWS-style EIP" but "on what terms does it keep the one it already has."The model
The
PersistentVolumepattern, applied to addresses:StorageClassPublicIPClassPersistentVolumePublicIP(cluster-scoped)claimRefand a reclaim policyPersistentVolumeClaimPublicIPClaim(namespaced)Two things fall out of the survey and are worth a reviewer's attention:
fromClassvsproviderRef), directly analogous to PV's volume-source union. Self-allocating backends (MetalLB, Cilium, kube-vip) have no reservation concept anywhere, so our provisioner is the IPAM of record. Cloud backends (AWS, GCP) already hold the reservation with a stable handle and their own IAM, so the provisioner must adopt, not allocate. Surviving a backend where allocation isn't ours is the evidence the shape isn't bent around MetalLB.Pincapability, which the entire model depends on: a backend that cannot be told which address to use can never attach a reserved one, so a class over it must reject claims outright rather than allocate an address it can never bind.The sharp edge (please read the Security section)
The per-backend "pin this IP" annotation (
metallb.io/loadBalancerIPs,lbipam.cilium.io/ips, …) is a privilege-escalation surface. A self-allocating backend has no concept of a reservation, so it will hand a tenant an address that another tenant has reserved but not yet attached. That theft window exists on MetalLB and Cilium alike.The fix is the move Cozystack already makes elsewhere: turn the ungatable field into a reference to an RBAC-gated object. Tenants may only write
network.cozystack.io/public-ip-claim(naming an object in their own namespace); the controller writes the raw pin annotation; aValidatingAdmissionPolicyrejects any other principal writing one. Without that policy the model is advisory, so it belongs in the same release as the CRDs.Notes for reviewers
structured-external-exposure). That proposal restructures how an application requests exposure; this one is about what an address is. They meet at one point — an exposure entry ought to be able to name a claim instead of implicitly minting an address — but neither needs the other to land first, and this does not assume design-proposal: structured, additive external exposure for managed applications #29's shape.ExposureClassis touched on but not depended on. The class idea is right and survives here in some form; binding an address's lifetime to aServiceis the part that structurally cannot serve this use case. Open question 4 defers the merge-or-separate call, since that kind's future is being re-examined independently.ServiceCIDR/IPAddressand explicitly named "any generalization onto something like an IPAM API" a non-goal;loadBalancerIPwas deprecated in 1.24 with no core replacement. Cluster API'sIPAddressClaim/IPAddressis literally this pattern but has only ever been wired to Machine addressing — open question 3 asks whether we adopt it or merely copy the contract.The test that is the proposal
Claim → bind → associate → delete the Service → the address is still held → associate it to a different workload → the same address comes back.
That single integration test is precisely what cannot pass today.
Summary by CodeRabbit