fix: ipam clean all pod nic ip address and mac even if just delete a nic #3451
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.
Pull Request
What type of this PR
Examples of user facing changes:
解决 vm pod 换一张网卡的时候会把所有 ip 释放的问题
Which issue(s) this PR fixes
Fixes #(issue-number)
WHAT
🤖[deprecated] Generated by Copilot at 362fe2c
This pull request modifies the
ReleaseAddressByPod
function and its callers to take a subnet name as an argument, and to release the IP address only from the specified subnet if it is not empty, or from all subnets if it is empty. This improves the performance and correctness of the IP address management for various features, such as underlay-to-overlay interconnection, VPC NAT gateway, virtual IPs, and garbage collection. It also updates the unit and benchmark tests to reflect the changes.🤖[deprecated] Generated by Copilot at 362fe2c
HOW
🤖[deprecated] Generated by Copilot at 362fe2c
ReleaseAddressByPod
function to take a subnet name as an argument and release the IP address only from the specified subnet if it is not empty, or from all subnets if it is empty (link)ReleaseAddressByPod
function inmarkAndCleanLSP
function, which garbage collects the logical switch ports and the IP CRs (link)ReleaseAddressByPod
function inhandleDeleteNode
function, which handles the deletion of a node and its associated resources (link)ReleaseAddressByPod
function inpodReuseVip
function, which reuses a virtual IP for a pod that has the same labels as the previous owner of the virtual IP (link)ReleaseAddressByPod
function inreconcileU2OInterconnectionIP
function, which reconciles the underlay-to-overlay interconnection IP address for a subnet (link, link)ReleaseAddressByPod
function in the following functions, which handle the deletion of various resources that do not belong to any specific subnet:handleDelOvnEip
(link),handleDeletePod
(link),handleDelVirtualIp
(link),handleDelIptablesEip
(link)net
andstrings
packages as imports tovpc_nat_gw_eip.go
file, which handles the VPC NAT gateway external IP resources, to resolve the dependency of the modifiedReleaseAddressByPod
function on the imported packages (link)net
andstrings
packages as imports fromvpc_nat_gw_eip.go
file, which handles the VPC NAT gateway external IP resources, to clean up the unused imports and avoid potential conflicts or errors (link)ReleaseAddressByPod
function inipam_test.go
andipam_bench_test.go
files, which test the IPAM module, to pass an empty string as the subnet name to the modified function and test the default behavior of releasing the IP address from all subnets (link, link, link, link, link, link, link, link, link, link, link, link, link)