From 6233434a8f5a14e6f6ce2e29411840b9fb670d39 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 --- pkg/controller/pod.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/controller/pod.go b/pkg/controller/pod.go index 86ec2205f8b..e28c438c96c 100644 --- a/pkg/controller/pod.go +++ b/pkg/controller/pod.go @@ -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 @@ -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 {