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: lsp define in nb is not clear when delete vm #3429

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,14 @@ func (c *Controller) handleDeletePod(key string) error {
}
}

ports, err := c.OVNNbClient.ListNormalLogicalSwitchPorts(true, map[string]string{"pod": key})
isVMPod, vmName := isVMPod(pod)
isVMPodNeedKeepIP := isVMPod && c.config.EnableKeepVMIP
podkey := key
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面的 c.ipam.ReleaseAddressByPod(key) 应该也有问题

if isVMPodNeedKeepIP {
podkey = fmt.Sprintf("%s/%s", pod.GetNamespace(), vmName)
}

ports, err := c.OVNNbClient.ListNormalLogicalSwitchPorts(true, map[string]string{"pod": podkey})
if err != nil {
klog.Errorf("failed to list lsps of pod '%s', %v", pod.Name, err)
return err
Expand Down Expand Up @@ -1061,8 +1068,8 @@ func (c *Controller) handleDeletePod(key string) error {
}
keepIPCR = !toDel && !isDelete && err == nil
}
isVMPod, vmName := isVMPod(pod)
if isVMPod && c.config.EnableKeepVMIP {

if isVMPodNeedKeepIP {
toDel := c.isVMPodToDel(pod, vmName)
isDelete, err := appendCheckPodToDel(c, pod, vmName, util.VMInstance)
if pod.DeletionTimestamp != nil {
Expand Down
Loading