From 97bfd4c29d65c548d818b760f8c8187d68363b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E5=8F=88=E8=A2=81?= Date: Thu, 30 Nov 2023 10:26:33 +0800 Subject: [PATCH] delete vm's lsp and release ipam.ip (#3476) Signed-off-by: yuanliu@cmss.chinamobile.com Co-authored-by: yuanliu@cmss.chinamobile.com Signed-off-by: bobz965 --- pkg/controller/pod.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/controller/pod.go b/pkg/controller/pod.go index 15f1e2eafa6..93546901bb1 100644 --- a/pkg/controller/pod.go +++ b/pkg/controller/pod.go @@ -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 @@ -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)