From eb9bcd583118d4a24ae16d11d9b17bd46031faad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=B4=AA=E8=B4=9E?= Date: Mon, 28 Aug 2023 18:43:45 +0800 Subject: [PATCH] delete append externalIds process in initIPAM (#3134) --- pkg/controller/init.go | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/pkg/controller/init.go b/pkg/controller/init.go index 99338eb752e..13532d0a049 100644 --- a/pkg/controller/init.go +++ b/pkg/controller/init.go @@ -294,15 +294,6 @@ func (c *Controller) InitIPAM() error { } } - result, err := c.ovnLegacyClient.CustomFindEntity("logical_switch_port", []string{"name"}, `external-ids:vendor{<}""`) - if err != nil { - klog.Errorf("failed to find logical switch port without external-ids:vendor: %v", err) - } - lspWithoutVendor := make(map[string]struct{}, len(result)) - for _, lsp := range result { - lspWithoutVendor[lsp["name"][0]] = struct{}{} - } - pods, err := c.podsLister.List(labels.Everything()) if err != nil { klog.Errorf("failed to list pods: %v", err) @@ -370,12 +361,6 @@ func (c *Controller) InitIPAM() error { klog.Errorf("failed to create/update ips CR %s.%s with ip address %s: %v", podName, pod.Namespace, ip, err) } } - - if _, ok := lspWithoutVendor[portName]; ok { - if err = c.initAppendLspExternalIds(portName, pod); err != nil { - klog.Errorf("failed to append external-ids for logical switch port %s: %v", portName, err) - } - } // Append ExternalIds is added in v1.7, used for upgrading from v1.6.3. It should be deleted now since v1.7 is not used anymore. } } @@ -441,12 +426,6 @@ func (c *Controller) InitIPAM() error { if v4IP != "" && v6IP != "" { node.Annotations[util.IpAddressAnnotation] = util.GetStringIP(v4IP, v6IP) } - - if _, ok := lspWithoutVendor[portName]; ok { - if err = c.initAppendLspExternalIds(portName, nil); err != nil { - klog.Errorf("failed to append external-ids for logical switch port %s: %v", portName, err) - } - } } } @@ -767,21 +746,6 @@ func (c *Controller) initNodeRoutes() error { return nil } -func (c *Controller) initAppendLspExternalIds(portName string, pod *v1.Pod) error { - externalIDs := make(map[string]string, 2) - externalIDs["vendor"] = util.CniTypeName - if pod != nil { - externalIDs["pod"] = fmt.Sprintf("%s/%s", pod.Namespace, pod.Name) - } - - if err := c.ovnLegacyClient.SetLspExternalIds(portName, externalIDs); err != nil { - klog.Errorf("failed to set lsp external_ids for port %s: %v", portName, err) - return err - } - - return nil -} - func (c *Controller) initNodeChassis() error { nodes, err := c.nodesLister.List(labels.Everything()) if err != nil {