Repository navigation
Auto-claim addresses for LoadBalancer Services that name no claim - #7
Open
Timofei Larkin (lllamnyp) wants to merge 1 commit into
Open
Timofei Larkin (lllamnyp) wants to merge 1 commit into
Timofei Larkin (lllamnyp) wants to merge 1 commit into
Conversation
A LoadBalancer Service without a claim annotation got either nothing or an address from an auto-assigning pool that nobody meters. Tenant clusters hit the first case: their cloud provider creates host-side Services with no claim, and the driver's pool is closed to automatic assignment. The core now watches Services. For a qualifying one it creates an IPAddressClaim named after the Service, in its namespace and controlled by it, from the class the Service names (ip-address-class) or else the single class marked is-auto-claim-class, and points the Service at it with the claim annotation. Services that name a claim, opt out (auto-claim: "false"), set loadBalancerClass or loadBalancerIP, or already have an address are skipped. A claim controlled by a Service deletes its addresses on deletion regardless of reclaimPolicy; removing the controller reference retains it as an ordinary claim. Assisted-By: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This was referenced Oct 30, 2026
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.
A LoadBalancer Service that names no
IPAddressClaimcurrently gets one of two outcomes. It gets nothing, or it gets an address from some auto-assigning pool that no ledger records or attributes. Tenant Kubernetes clusters hit the first case. cloud-provider-kubevirt creates their host-side Services with no claim annotation, metallb-iad's pool isautoAssign: false, and the Services sit at<pending>(MetalLB:no available IPs). This PR has the core controller provision a claim for such Services, so they draw metered addresses from a class like any tenant-made claim.Behaviour
type: LoadBalancerService qualifies when it:local.sdn.cozystack.io/ip-address-claim;local.sdn.cozystack.io/auto-claim: "false";spec.loadBalancerClassnorspec.loadBalancerIP;status.loadBalancer.ingressyet. This check keeps Services that already have an address from being moved to a new one.local.sdn.cozystack.io/ip-address-classwins. Otherwise it is the single class annotatedipaddressclass.local.sdn.cozystack.io/is-auto-claim-class: "true", which is independent ofis-default-class. With no marked class, nothing happens. With several, a warning event goes on the Service and nothing is claimed.IPAddressClaimnamed after the Service, in its namespace, with the Service as its controller.Dualonly forRequireDualStack.reclaimPolicy.Changes
internal/controller/service_controller.go: the newServiceReconciler. It is re-triggered by IPAddressClass events so a newly marked class unblocks waiting Services. It is wired up incmd/main.go.internal/controller/ipaddressclaim_controller.go: the Service-owned exception in the reclaim flow.api/v1alpha1/well_known.go:IsAutoClaimClassAnnotation,ServiceClassAnnotation,ServiceAutoClaimAnnotation, and the event reasons. Drivers referenceServiceAutoClaimAnnotationto exempt their own Services; metallb-iad needs this for its reservation placeholders, in a follow-up PR there.make manifests: Servicesget/list/watch/patch,services/finalizersupdate(for the owner reference'sblockOwnerDeletion), andcreateon claims.docs/design.mdgets a new §10, plus edits to §1–3, §6, §8 and §9 where they said the core never touches Services. The README gets an auto-claim section.Rollout notes
is-auto-claim-classor a Service names a class.ip-address-class,ip-address-claimand the opt-out work when set on the in-cluster Service before it is created, but not if added later.go build ./...,go vet ./...,go test ./internal/controller/andgolangci-lint runpass. The new unit tests cover the auto-claim cases above and the Service-owned reclaim.