Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 8 additions & 26 deletions pkg/controller/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ func (c *Controller) enqueueAddIP(obj any) {
if strings.HasPrefix(ipObj.Name, util.U2OInterconnName[0:19]) {
return
}
klog.V(3).Infof("enqueue update status subnet %s", ipObj.Spec.Subnet)
c.updateSubnetStatusQueue.Add(ipObj.Spec.Subnet)
for _, as := range ipObj.Spec.AttachSubnets {
klog.V(3).Infof("enqueue update attach status for subnet %s", as)
c.updateSubnetStatusQueue.Add(as)
}

key := cache.MetaObjectToName(ipObj).String()
klog.V(3).Infof("enqueue add ip %s", key)
c.addIPQueue.Add(key)
Expand Down Expand Up @@ -162,25 +155,6 @@ func (c *Controller) handleAddReservedIP(key string) error {
return err
}

portName := ovs.PodNameToPortName(ip.Spec.PodName, ip.Spec.Namespace, subnet.Spec.Provider)
if portName != ip.Name {
// invalid ip or node ip, no need to handle it here
klog.V(3).Infof("port name %s is not equal to ip name %s", portName, ip.Name)
return nil
}

// not handle add the ip, which created in pod process, lsp created before ip
lsp, err := c.OVNNbClient.GetLogicalSwitchPort(portName, true)
if err != nil {
klog.Errorf("failed to list logical switch ports %s, %v", portName, err)
return err
}
if lsp != nil {
// port already exists means the ip already created
klog.V(3).Infof("ip %s is ready", portName)
return nil
}

// v6 ip address can not use upper case
if util.ContainsUppercase(ip.Spec.V6IPAddress) {
err := fmt.Errorf("ip %s v6 ip address %s can not contain upper case", ip.Name, ip.Spec.V6IPAddress)
Expand Down Expand Up @@ -220,6 +194,14 @@ func (c *Controller) handleAddReservedIP(key string) error {
return err
}
}

klog.V(3).Infof("enqueue update status subnet %s", ip.Spec.Subnet)
c.updateSubnetStatusQueue.Add(ip.Spec.Subnet)
for _, as := range ip.Spec.AttachSubnets {
klog.V(3).Infof("enqueue update attach status for subnet %s", as)
c.updateSubnetStatusQueue.Add(as)
}

return nil
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/vpc_nat_gw_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ func (c *Controller) enqueueUpdateIptablesEip(oldObj, newObj any) {
klog.Infof("enqueue update iptables eip %s", key)
c.updateIptablesEipQueue.Add(key)
}
externalNetwork := util.GetExternalNetwork(newEip.Spec.ExternalSubnet)
c.updateSubnetStatusQueue.Add(externalNetwork)
}

func (c *Controller) enqueueDelIptablesEip(obj any) {
Expand Down Expand Up @@ -156,6 +154,7 @@ func (c *Controller) handleAddIptablesEip(key string) error {
klog.Errorf("failed to update eip %s, %v", key, err)
return err
}
c.updateSubnetStatusQueue.Add(subnet.Name)
return nil
}

Expand Down
Loading