-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed as not planned
Closed as not planned
Copy link
Labels
area/agentCilium agent related.Cilium agent related.area/eniImpacts ENI based IPAM.Impacts ENI based IPAM.area/ipamIP address management, including cloud IPAMIP address management, including cloud IPAMarea/operatorImpacts the cilium-operator componentImpacts the cilium-operator componentkind/bugThis is a bug in the Cilium logic.This is a bug in the Cilium logic.staleThe stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.
Description
Cilium operator incorrectly calculates ExcessIPs when both IPPrefixes and Secondary IPAddresses are in use.
Below is an example where I have 4 individual IP addresses and one prefix allocated. So my Available IPs are 20(16 from prefix), UsedIPs are 16 because 8 of those IPs from prefix are in use so we can consider all of them are in use per this function. We do not need any IPs and preAllocate = 8
time=2025-06-04T22:38:19Z level=info msg="Available IPs are " !BADKEY=20
time=2025-06-04T22:38:19Z level=info msg="usedIPForExcessCalc are" !BADKEY=16
time=2025-06-04T22:38:19Z level=info msg="neededIps are" !BADKEY=0
time=2025-06-04T22:38:19Z level=info msg="ExcessIPs from ipam " !BADKEY=0
When we calculate excesss IPs in calculateExcessIPs function,
we have the below formula
excessIPs = max(availableIPs-usedIPs-preAllocate-maxAboveWatermark, 0)
By using above values if calculate excessIPs, it's -4 instead of 4 because we are using preAllocate
in this case.
excessIPs = max(20-16-8-0, 0) = max(-4, 0) =0
I think the right math will be, so the operator will be able to remove those 4 IP addresses if they're free.
excessIPs = max(availableIPs-usedIPs-maxAboveWatermark, 0)
we are using cilium 1.17.3
Metadata
Metadata
Assignees
Labels
area/agentCilium agent related.Cilium agent related.area/eniImpacts ENI based IPAM.Impacts ENI based IPAM.area/ipamIP address management, including cloud IPAMIP address management, including cloud IPAMarea/operatorImpacts the cilium-operator componentImpacts the cilium-operator componentkind/bugThis is a bug in the Cilium logic.This is a bug in the Cilium logic.staleThe stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.