Skip to content

Commit

Permalink
fix: lsp define in nb is not clear when delete vm
Browse files Browse the repository at this point in the history
Signed-off-by: wujixin <[email protected]>
  • Loading branch information
wujixin committed Nov 17, 2023
1 parent 024b95e commit b94aa09
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,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
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 @@ -1057,8 +1064,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

0 comments on commit b94aa09

Please sign in to comment.