Skip to content

Add pool/claim types and controllers for numbered resource allocation#258

Draft
felix-kaestner wants to merge 3 commits intomainfrom
numbered-resources
Draft

Add pool/claim types and controllers for numbered resource allocation#258
felix-kaestner wants to merge 3 commits intomainfrom
numbered-resources

Conversation

@felix-kaestner
Copy link
Contributor

@felix-kaestner felix-kaestner commented Mar 25, 2026

Introduces three pool types (IndexPool, IPAddressPool, IPPrefixPool) and a Claim type that references a pool via spec.poolRef. The claim controller allocates the lowest available resource from the referenced pool and writes it back to both the pool status and the claim status. Pools track allocations with ClaimRef+ClaimUID for idempotency, and support Recycle/Retain reclaim policies on claim deletion. All pool types expose an Available condition (HasCapacity/Exhausted).

A preferred value can be requested by setting the annotation pool.networking.metal.ironcore.dev/preferred-value on a Claim. The controller will attempt to allocate that exact value; if it is outside the pool's configured ranges or already taken, the claim enters a terminal error state with reason PreferredValueUnavailable. Removing the annotation re-triggers reconciliation and falls back to normal allocation.

Concept

numbered-resources

Usage

$ kubectl get idxpool -o wide
NAME               ALLOCATED   TOTAL      AVAILABLE   AGE
indexpool-sample   1           94968318   True        7m16s

$ kubectl get ippool -o wide
NAME                   ALLOCATED   TOTAL      AVAILABLE   AGE
ipaddresspool-sample   1           17891328   True        7m22s

$ kubectl get pfxpool -o wide
NAME                  ALLOCATED   TOTAL   AVAILABLE   AGE
ipprefixpool-sample   1           65536   True        7m28s

$ kubectl get claim -o wide
NAME              VALUE         ALLOCATED   AGE
claim-index       64512         True        5m43s
claim-ipaddress   10.0.0.0      True        4m43s
claim-subnet      10.0.0.0/24   True        4m43s

@github-actions
Copy link

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/ironcore-dev/network-operator/api/core/v1alpha1 0.00% (ø)
github.com/ironcore-dev/network-operator/api/pool/v1alpha1 0.00% (ø)
github.com/ironcore-dev/network-operator/cmd 0.00% (ø)
github.com/ironcore-dev/network-operator/internal/conditions 57.38% (+0.71%) 👍
github.com/ironcore-dev/network-operator/internal/controller/pool 73.36% (+73.36%) 🌟

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/ironcore-dev/network-operator/api/core/v1alpha1/index_range.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/core/v1alpha1/prefix_types.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/pool/v1alpha1/claim_types.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/pool/v1alpha1/doc.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/pool/v1alpha1/groupversion_info.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/pool/v1alpha1/indexpool_types.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/pool/v1alpha1/ipaddresspool_types.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/pool/v1alpha1/ipprefixpool_types.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/pool/v1alpha1/reclaim_policy.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/pool/v1alpha1/zz_generated.deepcopy.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/cmd/main.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/internal/conditions/conditions.go 57.38% (+0.71%) 61 (+1) 35 (+1) 26 👍
github.com/ironcore-dev/network-operator/internal/controller/pool/claim_controller.go 76.38% (+76.38%) 127 (+127) 97 (+97) 30 (+30) 🌟
github.com/ironcore-dev/network-operator/internal/controller/pool/indexpool_controller.go 68.97% (+68.97%) 29 (+29) 20 (+20) 9 (+9) 🌟
github.com/ironcore-dev/network-operator/internal/controller/pool/ipaddresspool_controller.go 68.97% (+68.97%) 29 (+29) 20 (+20) 9 (+9) 🌟
github.com/ironcore-dev/network-operator/internal/controller/pool/ipprefixpool_controller.go 68.97% (+68.97%) 29 (+29) 20 (+20) 9 (+9) 🌟

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/ironcore-dev/network-operator/api/pool/v1alpha1/indexpool_types_test.go
  • github.com/ironcore-dev/network-operator/api/pool/v1alpha1/ipaddresspool_types_test.go
  • github.com/ironcore-dev/network-operator/api/pool/v1alpha1/ipprefixpool_types_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/pool/claim_controller_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/pool/indexpool_controller_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/pool/ipaddresspool_controller_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/pool/ipprefixpool_controller_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/pool/suite_test.go

Introduces three pool types (IndexPool, IPAddressPool, IPPrefixPool) and
a Claim type that references a pool via spec.poolRef. The claim
controller allocates the lowest available resource from the referenced
pool and writes it back to both the pool status and the claim status.
Pools track allocations with ClaimRef+ClaimUID for idempotency, and
support Recycle/Retain reclaim policies on claim deletion. All pool
types expose an Available condition (HasCapacity/Exhausted).

A preferred value can be requested by setting the annotation
pool.networking.metal.ironcore.dev/preferred-value on a Claim. The
controller will attempt to allocate that exact value; if it is outside
the pool's configured ranges or already taken, the claim enters a
terminal error state with reason PreferredValueUnavailable. Removing
the annotation re-triggers reconciliation and falls back to normal
allocation.
Documents the pool-based allocation system introduced alongside the
IndexPool, IPAddressPool, IPPrefixPool, and Claim types. Covers pool
and claim concepts, reclaim policies, the preferred-value annotation,
and allocation result fields. Includes light/dark theme diagram images
and links to sample manifests in the repository.
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.

1 participant