Skip to content

Commit

Permalink
delete vm's lsp and release ipam.ip (#3476)
Browse files Browse the repository at this point in the history
  • Loading branch information
lynn901 and [email protected] authored Nov 30, 2023
1 parent ab0cf22 commit 6233434
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,14 +996,15 @@ func (c *Controller) handleDeletePod(key string) error {
}
}

ports, err := c.OVNNbClient.ListNormalLogicalSwitchPorts(true, map[string]string{"pod": key})
podKey := fmt.Sprintf("%s/%s", pod.Namespace, podName)
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
}

if len(ports) != 0 {
addresses := c.ipam.GetPodAddress(key)
addresses := c.ipam.GetPodAddress(podKey)
for _, address := range addresses {
if strings.TrimSpace(address.IP) == "" {
continue
Expand Down Expand Up @@ -1083,7 +1084,7 @@ func (c *Controller) handleDeletePod(key string) error {
}
}

c.ipam.ReleaseAddressByPod(key)
c.ipam.ReleaseAddressByPod(podKey)

podNets, err := c.getPodKubeovnNets(pod)
if err != nil {
Expand Down

0 comments on commit 6233434

Please sign in to comment.