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
Signed-off-by: [email protected] <[email protected]>

Co-authored-by: [email protected] <[email protected]>
Signed-off-by: bobz965 <[email protected]>
  • Loading branch information
2 people authored and bobz965 committed Nov 30, 2023
1 parent a5063c8 commit 97bfd4c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,14 +752,15 @@ func (c *Controller) handleDeletePod(pod *v1.Pod) error {
return nil
}

ports, err := c.ovnClient.ListPodLogicalSwitchPorts(key)
podKey := fmt.Sprintf("%s/%s", pod.Namespace, podName)
ports, err := c.ovnClient.ListPodLogicalSwitchPorts(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 @@ -831,8 +832,7 @@ func (c *Controller) handleDeletePod(pod *v1.Pod) error {
}
}
klog.Infof("release all ip address for deleting pod %s", key)
c.ipam.ReleaseAddressByPod(key, "")

c.ipam.ReleaseAddressByPod(podKey, "")
podNets, err := c.getPodKubeovnNets(pod)
if err != nil {
klog.Errorf("failed to get pod nets %v", err)
Expand Down

0 comments on commit 97bfd4c

Please sign in to comment.