Skip to content

Commit

Permalink
fix add ip eip trigger subnet status count ip
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <[email protected]>
  • Loading branch information
bobz965 committed May 15, 2024
1 parent 85e28bc commit 091e5df
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 22 deletions.
14 changes: 0 additions & 14 deletions pkg/controller/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions pkg/controller/ovn_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 1 addition & 4 deletions pkg/controller/vip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 091e5df

Please sign in to comment.