diff --git a/pkg/controller/ip.go b/pkg/controller/ip.go index ca5ffd6c99a..2f188a5072d 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 990eeaeefdf..7ff89f526fa 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 0ebf3fa7456..cec712f483c 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 }