ipam: Add allocator-independent ENI AllocationResult builder#45089
Merged
ipam: Add allocator-independent ENI AllocationResult builder#45089
AllocationResult builder#45089Conversation
Add `buildENIAllocationResult` which derives ENI-specific metadata by matching an allocated IP against each ENI's Addresses and Prefixes lists. This replaces the CRD allocator's inline ENI branch in `buildAllocationResult`, which looked up the ENI by `AllocationIP.Resource` (ENI ID). The IP-based lookup is needed for the multi-pool allocator, as it allocates IPs from CIDRs without tracking per-IP resource metadata. The `eniContainsIP` helper covers all cases: * IP is a secondary ENI IP: under `eni.Addresses` * IP belongs to a delegated prefix: under `eni.Prefixes` * IP is ENI primary IP (necessary for when `UsePrimaryAddress` is enabled): under `eni.IP` Relates to cilium/design-cfps#87 Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
Member
Author
|
/test |
pippolo84
approved these changes
Apr 1, 2026
Member
pippolo84
left a comment
There was a problem hiding this comment.
Thanks!
If you are up to it, I suggest a follow up PR to clean buildAllocationResult and move Azure and AlibabaCloud code too in separate functions.
HadrienPatte
added a commit
to DataDog/cilium
that referenced
this pull request
Apr 3, 2026
Replace the CRD allocator with the multi-pool allocator for ENI IPAM mode on the agent side. Previous PRs cilium#45110 and cilium#45124 ensure the operator already supports this new agent setup. The new `eniMultiPoolAllocator` is a light wrapper on the standard `multiPoolAllocator` that enriches `AllocationResult` with ENI-specific required metadata via `buildENIAllocationResult` (see cilium#45089). Key differences from the standard multi-pool allocator: * `AllowFirstLastIPs` is enabled so /28 prefix delegation ranges are fully allocatable (see cilium#45025 and cilium#45082). * `LinearPreAlloc` uses a simple `inUse + preAlloc` formula for demand computation instead of `neededIPCeil` rounding. This matches the CRD allocator's `calculateNeededIPs` semantics and is necessary to ensure the operator can recover the exact IP usage from the demand signal (requested - preAllocate) (see cilium#45124). * No dependency on `CiliumPodIPPool` CRDs, pools are managed by the operator via Spec.IPAM.Pools.Allocated (see cilium#45110). The agents now read CIDRs from `Spec.IPAM.Pools.Allocated`, allocate IPs locally, and write aggregate demand to `Spec.IPAM.Pools.Requested`. They no longer writes per-IP usage to `Status.IPAM.Used`, achieving a reduction of kubernetes API pressure. Relates to cilium/design-cfps#87 Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
HadrienPatte
added a commit
to DataDog/cilium
that referenced
this pull request
Apr 3, 2026
Replace the CRD allocator with the multi-pool allocator for ENI IPAM mode on the agent side. Previous PRs cilium#45110 and cilium#45124 ensure the operator already supports this new agent setup. The new `eniMultiPoolAllocator` is a light wrapper on the standard `multiPoolAllocator` that enriches `AllocationResult` with ENI-specific required metadata via `buildENIAllocationResult` (see cilium#45089). Key differences from the standard multi-pool allocator: * `AllowFirstLastIPs` is enabled so /28 prefix delegation ranges are fully allocatable (see cilium#45025 and cilium#45082). * `LinearPreAlloc` uses a simple `inUse + preAlloc` formula for demand computation instead of `neededIPCeil` rounding. This matches the CRD allocator's `calculateNeededIPs` semantics and is necessary to ensure the operator can recover the exact IP usage from the demand signal (requested - preAllocate) (see cilium#45124). * No dependency on `CiliumPodIPPool` CRDs, pools are managed by the operator via Spec.IPAM.Pools.Allocated (see cilium#45110). The agents now read CIDRs from `Spec.IPAM.Pools.Allocated`, allocate IPs locally, and write aggregate demand to `Spec.IPAM.Pools.Requested`. They no longer writes per-IP usage to `Status.IPAM.Used`, achieving a reduction of kubernetes API pressure. Relates to cilium/design-cfps#87 Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
HadrienPatte
added a commit
that referenced
this pull request
Apr 3, 2026
Replace the CRD allocator with the multi-pool allocator for ENI IPAM mode on the agent side. Previous PRs #45110 and #45124 ensure the operator already supports this new agent setup. The new `eniMultiPoolAllocator` is a light wrapper on the standard `multiPoolAllocator` that enriches `AllocationResult` with ENI-specific required metadata via `buildENIAllocationResult` (see #45089). Key differences from the standard multi-pool allocator: * `AllowFirstLastIPs` is enabled so /28 prefix delegation ranges are fully allocatable (see #45025 and #45082). * `LinearPreAlloc` uses a simple `inUse + preAlloc` formula for demand computation instead of `neededIPCeil` rounding. This matches the CRD allocator's `calculateNeededIPs` semantics and is necessary to ensure the operator can recover the exact IP usage from the demand signal (requested - preAllocate) (see #45124). * No dependency on `CiliumPodIPPool` CRDs, pools are managed by the operator via Spec.IPAM.Pools.Allocated (see #45110). The agents now read CIDRs from `Spec.IPAM.Pools.Allocated`, allocate IPs locally, and write aggregate demand to `Spec.IPAM.Pools.Requested`. They no longer writes per-IP usage to `Status.IPAM.Used`, achieving a reduction of kubernetes API pressure. Relates to cilium/design-cfps#87 Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
HadrienPatte
added a commit
that referenced
this pull request
Apr 4, 2026
Replace the CRD allocator with the multi-pool allocator for ENI IPAM mode on the agent side. Previous PRs #45110 and #45124 ensure the operator already supports this new agent setup. The new `eniMultiPoolAllocator` is a light wrapper on the standard `multiPoolAllocator` that enriches `AllocationResult` with ENI-specific required metadata via `buildENIAllocationResult` (see #45089). Key differences from the standard multi-pool allocator: * `AllowFirstLastIPs` is enabled so /28 prefix delegation ranges are fully allocatable (see #45025 and #45082). * `LinearPreAlloc` uses a simple `inUse + preAlloc` formula for demand computation instead of `neededIPCeil` rounding. This matches the CRD allocator's `calculateNeededIPs` semantics and is necessary to ensure the operator can recover the exact IP usage from the demand signal (requested - preAllocate) (see #45124). * No dependency on `CiliumPodIPPool` CRDs, pools are managed by the operator via Spec.IPAM.Pools.Allocated (see #45110). The agents now read CIDRs from `Spec.IPAM.Pools.Allocated`, allocate IPs locally, and write aggregate demand to `Spec.IPAM.Pools.Requested`. They no longer writes per-IP usage to `Status.IPAM.Used`, achieving a reduction of kubernetes API pressure. Relates to cilium/design-cfps#87 Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
HadrienPatte
added a commit
that referenced
this pull request
Apr 4, 2026
Replace the CRD allocator with the multi-pool allocator for ENI IPAM mode on the agent side. Previous PR #45124 ensures the operator already supports this new agent setup. The new `eniMultiPoolAllocator` is a light wrapper on the standard `multiPoolAllocator` that enriches `AllocationResult` with ENI-specific required metadata via `buildENIAllocationResult` (see #45089). Key differences from the standard multi-pool allocator: * `AllowFirstLastIPs` is enabled so /28 prefix delegation ranges are fully allocatable (see #45025 and #45082). * `LinearPreAlloc` uses a simple `inUse + preAlloc` formula for demand computation instead of `neededIPCeil` rounding. This matches the CRD allocator's `calculateNeededIPs` semantics and is necessary to ensure the operator can recover the exact IP usage from the demand signal (requested - preAllocate) (see #45124). * No dependency on `CiliumPodIPPool` CRDs, pools are instead populated by the agent from `Status.ENI.ENIs` which is maintained by the operator. The agents now read CIDRs from `Status.ENI.ENIs`, allocate IPs locally, and write aggregate demand to `Spec.IPAM.Pools.Requested`. They no longer writes per-IP usage to `Status.IPAM.Used`, achieving a reduction of kubernetes API pressure. Relates to cilium/design-cfps#87 Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
HadrienPatte
added a commit
that referenced
this pull request
Apr 4, 2026
Replace the CRD allocator with the multi-pool allocator for ENI IPAM mode on the agent side. Previous PR #45124 ensures the operator already supports this new agent setup. The new `eniMultiPoolAllocator` is a light wrapper on the standard `multiPoolAllocator` that enriches `AllocationResult` with ENI-specific required metadata via `buildENIAllocationResult` (see #45089). Key differences from the standard multi-pool allocator: * `AllowFirstLastIPs` is enabled so /28 prefix delegation ranges are fully allocatable (see #45025 and #45082). * `LinearPreAlloc` uses a simple `inUse + preAlloc` formula for demand computation instead of `neededIPCeil` rounding. This matches the CRD allocator's `calculateNeededIPs` semantics and is necessary to ensure the operator can recover the exact IP usage from the demand signal (requested - preAllocate) (see #45124). * No dependency on `CiliumPodIPPool` CRDs, pools are instead populated by the agent from `Status.ENI.ENIs` which is maintained by the operator. The agents now read CIDRs from `Status.ENI.ENIs`, allocate IPs locally, and write aggregate demand to `Spec.IPAM.Pools.Requested`. They no longer writes per-IP usage to `Status.IPAM.Used`, achieving a reduction of kubernetes API pressure. Relates to cilium/design-cfps#87 Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
HadrienPatte
added a commit
that referenced
this pull request
Apr 5, 2026
Replace the CRD allocator with the multi-pool allocator for ENI IPAM mode on the agent side. Previous PR #45124 ensures the operator already supports this new agent setup. The new `eniMultiPoolAllocator` is a light wrapper on the standard `multiPoolAllocator` that enriches `AllocationResult` with ENI-specific required metadata via `buildENIAllocationResult` (see #45089). Key differences from the standard multi-pool allocator: * `AllowFirstLastIPs` is enabled so /28 prefix delegation ranges are fully allocatable (see #45025 and #45082). * `LinearPreAlloc` uses a simple `inUse + preAlloc` formula for demand computation instead of `neededIPCeil` rounding. This matches the CRD allocator's `calculateNeededIPs` semantics and is necessary to ensure the operator can recover the exact IP usage from the demand signal (requested - preAllocate) (see #45124). * No dependency on `CiliumPodIPPool` CRDs, pools are instead populated by the agent from `Status.ENI.ENIs` which is maintained by the operator. The agents now read CIDRs from `Status.ENI.ENIs`, allocate IPs locally, and write aggregate demand to `Spec.IPAM.Pools.Requested`. They no longer writes per-IP usage to `Status.IPAM.Used`, achieving a reduction of kubernetes API pressure. Relates to cilium/design-cfps#87 Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
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.
Add
buildENIAllocationResultwhich derives ENI-specific metadata by matching an allocated IP against each ENI's Addresses and Prefixes lists. This replaces the CRD allocator's inline ENI branch inbuildAllocationResult, which looked up the ENI byAllocationIP.Resource(ENI ID).The IP-based lookup is needed for the multi-pool allocator, as it allocates IPs from CIDRs without tracking per-IP resource metadata. The
eniContainsIPhelper covers all cases:eni.Addresseseni.PrefixesUsePrimaryAddressis enabled): undereni.IPRelates to cilium/design-cfps#87