From 5d0ac9d164b20c65f3655647de27db9083e90e1f Mon Sep 17 00:00:00 2001 From: bobz965 Date: Wed, 15 May 2024 15:04:50 +0800 Subject: [PATCH] fix add ip eip trigger subnet status count ip (#4023) Signed-off-by: bobz965 --- pkg/controller/ip.go | 14 -------------- pkg/controller/ovn_eip.go | 5 +---- pkg/controller/vip.go | 5 +---- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/pkg/controller/ip.go b/pkg/controller/ip.go index ca5ffd6c99ab..2f188a5072d0 100644 --- a/pkg/controller/ip.go +++ b/pkg/controller/ip.go @@ -554,20 +554,6 @@ func (c *Controller) createOrUpdateIPCR(ipCRName, podName, ip, mac, subnetName, return nil } -func (c *Controller) subnetCountIP(subnet *kubeovnv1.Subnet) error { - var err error - if util.CheckProtocol(subnet.Spec.CIDRBlock) == kubeovnv1.ProtocolDual { - _, err = c.calcDualSubnetStatusIP(subnet) - } else { - _, err = c.calcSubnetStatusIP(subnet) - } - if err != nil { - klog.Error(err) - return err - } - return nil -} - func (c *Controller) ipAcquireAddress(ip *kubeovnv1.IP, subnet *kubeovnv1.Subnet) (string, string, string, error) { key := fmt.Sprintf("%s/%s", ip.Spec.Namespace, ip.Spec.PodName) portName := ovs.PodNameToPortName(ip.Spec.PodName, ip.Spec.Namespace, subnet.Spec.Provider) diff --git a/pkg/controller/ovn_eip.go b/pkg/controller/ovn_eip.go index 990eeaeefdf5..7ff89f526fab 100644 --- a/pkg/controller/ovn_eip.go +++ b/pkg/controller/ovn_eip.go @@ -272,10 +272,7 @@ func (c *Controller) handleAddOvnEip(key string) error { klog.Errorf("failed to add finalizer for ovn eip, %v", err) return err } - if err = c.subnetCountIP(subnet); err != nil { - klog.Errorf("failed to count ovn eip '%s' in subnet, %v", cachedEip.Name, err) - return err - } + c.updateSubnetStatusQueue.Add(subnetName) return nil } diff --git a/pkg/controller/vip.go b/pkg/controller/vip.go index 0ebf3fa7456b..cec712f483c6 100644 --- a/pkg/controller/vip.go +++ b/pkg/controller/vip.go @@ -285,15 +285,12 @@ func (c *Controller) handleAddVirtualIP(key string) error { klog.Errorf("failed to create or update vip '%s', %v", vip.Name, err) return err } - if err = c.subnetCountIP(subnet); err != nil { - klog.Errorf("failed to count vip '%s' in subnet, %v", vip.Name, err) - return err - } if err := c.handleUpdateVirtualParents(key); err != nil { err := fmt.Errorf("error syncing virtual parents for vip '%s': %s", key, err.Error()) klog.Error(err) return err } + c.updateSubnetStatusQueue.Add(subnetName) return nil }