fix ip statistics in subnet status #2769
Merged
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.
What type of this PR
Which issue(s) this PR fixes:
Fixes incorrect ip statistics in subnet status:
During deleting a pod, kube-ovn-controller deletes the IP CR first and then releases the IP address. There is a chance that subnet status update is triggered by the IP CR deletion before the IP address is released.
This patch fixes the ip statistics by releasing the IP address before deleting the IP CR.
WHAT
🤖 Generated by Copilot at 6d17481
This pull request improves the IP address management for pods by avoiding duplicate or stale allocations. It modifies the
pod.go
file to release the pod's IP address only once and before assigning a new one.🤖 Generated by Copilot at 6d17481
HOW
🤖 Generated by Copilot at 6d17481
handleAddUpdatePod
(link)handleDeletePod
, since it is already done inhandleAddUpdatePod
(link)