Skip to content

Conversation

@luolanzone
Copy link
Contributor

Cherry pick of #7511 #7538 #7571 on release-2.4.

#7511: Clean up stale secondary IPs in IPPool when Node restarts
#7538: Improve stale IP recycling in AntreaIPAM controller (#7538)
#7571: Recycle IPs in IPPools for terminated Pods (#7571)

For details on the cherry pick process, see the cherry pick requests page.

…7511)

When a Kubernetes Node reboots and the OVSDB file is not properly restored,
the primary and secondary OVS ports are lost. Pods may temporarily
appear as "unknown" and later get recreated with new container IDs.

The cleanup of secondary interfaces during agent restart relies on the
InterfaceStores being initialized with existing OVS ports. If the OVSDB file
is missing, the primary InterfaceStore is empty, which prevents the secondary
InterfaceStore from initializing correctly. Consequently, secondary IPs assigned
to old Pods (with previous container IDs) are not deleted, leaving stale entries
in the IPPool.

This change adds logic to periodically verify all IPPool allocations and release
any secondary IPs associated with non-existing container IDs. This also covers
the case where a Pod is recreated with the same name on another Node and has any
secondary IPs.

Signed-off-by: Lan Luo <[email protected]>
When a Node is deleted, the CNI DEL command may not be invoked for Pods
running on that Node. As a result, antrea-agent cannot release their IPs,
leaving stale entries in the IPPool. To mitigate this, increase the IP
recycle interval from 10 minutes to 1 minute.

Additionally, add a benchmark test for the IP recycle function and refine
its implementation based on benchmark results to reduce memory allocations
and improve cleanup performance.

Signed-off-by: Lan Luo <[email protected]>
* Recycle IPs in IPPools for terminated Pods
* Improves the logging behavior to avoid emitting repetitive
messages every minute

Signed-off-by: Lan Luo <[email protected]>
@luolanzone luolanzone added kind/cherry-pick Categorizes issue or PR as related to the cherry-pick of a bug fix from the main branch to a release kind/cherry-pick-clean Categorizes a cherry-pick PR where patches applied cleanly without conflicts labels Nov 24, 2025
@luolanzone
Copy link
Contributor Author

/test-all

@luolanzone luolanzone merged commit f502dd5 into antrea-io:release-2.4 Nov 25, 2025
58 of 59 checks passed
@luolanzone luolanzone deleted the automated-cherry-pick-of-#7511-#7538-#7571-upstream-release-2.4 branch November 25, 2025 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cherry-pick Categorizes issue or PR as related to the cherry-pick of a bug fix from the main branch to a release kind/cherry-pick-clean Categorizes a cherry-pick PR where patches applied cleanly without conflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants