Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ipam clean all pod nic ip address and mac even if just delete a nic #3451

Merged
merged 4 commits into from
Nov 28, 2023

Conversation

bobz965
Copy link
Collaborator

@bobz965 bobz965 commented Nov 22, 2023

Pull Request

What type of this PR

Examples of user facing changes:

  • Features
  • Bug fixes

解决 vm pod 换一张网卡的时候会把所有 ip 释放的问题

  • Docs
  • Tests

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

To release IPs from subnets with ease
We modified ReleaseAddressByPod please
We added an argument
To specify the segment
And updated the callers and tests with these

HOW

🤖[deprecated] Generated by Copilot at 362fe2c

  • Modify 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)
  • Pass the subnet name from the IP CR to ReleaseAddressByPod function in markAndCleanLSP function, which garbage collects the logical switch ports and the IP CRs (link)
  • Pass the node switch name to ReleaseAddressByPod function in handleDeleteNode function, which handles the deletion of a node and its associated resources (link)
  • Pass the subnet name from the virtual IP CR to ReleaseAddressByPod function in podReuseVip function, which reuses a virtual IP for a pod that has the same labels as the previous owner of the virtual IP (link)
  • Pass the subnet name to ReleaseAddressByPod function in reconcileU2OInterconnectionIP function, which reconciles the underlay-to-overlay interconnection IP address for a subnet (link, link)
  • Pass an empty string as the subnet name to 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)
  • Add net and strings packages as imports to vpc_nat_gw_eip.go file, which handles the VPC NAT gateway external IP resources, to resolve the dependency of the modified ReleaseAddressByPod function on the imported packages (link)
  • Remove net and strings packages as imports from vpc_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)
  • Modify the unit tests and the benchmark test for the ReleaseAddressByPod function in ipam_test.go and ipam_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)

@bobz965 bobz965 changed the title fix: ipam clean all po nic ip address and mac even if just delete a nic fix: ipam clean all pod nic ip address and mac even if just delete a nic Nov 23, 2023
Signed-off-by: bobz965 <[email protected]>
Signed-off-by: bobz965 <[email protected]>
@bobz965 bobz965 requested a review from oilbeater November 23, 2023 02:03
@bobz965
Copy link
Collaborator Author

bobz965 commented Nov 23, 2023

@oilbeater cloud you please help review?

@bobz965 bobz965 merged commit a5063c8 into kubeovn:release-1.11 Nov 28, 2023
45 checks passed
@bobz965 bobz965 deleted the fix-1.11 branch November 28, 2023 06:05
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.

2 participants