Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <[email protected]>
  • Loading branch information
zbb88888 committed Jan 24, 2024
1 parent 276034a commit 34887da
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/external_gw.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (c *Controller) createDefaultVpcLrpEip() (string, string, error) {
klog.Errorf("failed to acquire ip address for default vpc lrp %s, %v", lrpEipName, err)
return "", "", err
}
if err := c.createOrUpdateCrdOvnEip(lrpEipName, c.config.ExternalGatewaySwitch, v4ip, v6ip, mac, util.OvnEipTypeLRP); err != nil {
if err := c.createOrUpdateOvnEipCR(lrpEipName, c.config.ExternalGatewaySwitch, v4ip, v6ip, mac, util.OvnEipTypeLRP); err != nil {
klog.Errorf("failed to create ovn eip cr for lrp %s, %v", lrpEipName, err)
return "", "", err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func (c *Controller) InitIPAM() error {
if err != nil {
klog.Errorf("failed to init pod %s.%s address %s: %v", podName, pod.Namespace, pod.Annotations[fmt.Sprintf(util.IPAddressAnnotationTemplate, podNet.ProviderName)], err)
} else {
err = c.createOrUpdateCrdIPs(portName, podName, ip, mac, podNet.Subnet.Name, pod.Namespace, pod.Spec.NodeName, podType, false)
err = c.createOrUpdateIPCR(portName, podName, ip, mac, podNet.Subnet.Name, pod.Namespace, pod.Spec.NodeName, podType, false)
if err != nil {
klog.Errorf("failed to create/update ips CR %s.%s with ip address %s: %v", podName, pod.Namespace, ip, err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (c *Controller) handleAddReservedIP(key string) error {
return err
}
ipStr := util.GetStringIP(v4IP, v6IP)
if err := c.createOrUpdateCrdIPs(ip.Name, ip.Spec.PodName, ipStr, mac, subnet.Name, ip.Spec.Namespace, ip.Spec.NodeName, ip.Spec.PodType, true); err != nil {
if err := c.createOrUpdateIPCR(ip.Name, ip.Spec.PodName, ipStr, mac, subnet.Name, ip.Spec.Namespace, ip.Spec.NodeName, ip.Spec.PodType, true); err != nil {
err = fmt.Errorf("failed to create ips CR %s.%s: %v", ip.Spec.PodName, ip.Spec.Namespace, err)
klog.Error(err)
return err
Expand Down Expand Up @@ -398,7 +398,7 @@ func (c *Controller) acquireStaticIPAddress(subnetName, name, nicName, ip string
return v4ip, v6ip, mac, nil
}

func (c *Controller) createOrUpdateCrdIPs(ipCRName, podName, ip, mac, subnetName, ns, nodeName, podType string, keep bool) error {
func (c *Controller) createOrUpdateIPCR(ipCRName, podName, ip, mac, subnetName, ns, nodeName, podType string, keep bool) error {
// pod or vm IP name must set ipCRName when creating ip CR
// pod or vm IP can be pre-reserved when you set keep to true

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func (c *Controller) handleAddNode(key string) error {
return err
}

if err := c.createOrUpdateCrdIPs("", "", ipStr, mac, c.config.NodeSwitch, "", node.Name, "", false); err != nil {
if err := c.createOrUpdateIPCR("", "", ipStr, mac, c.config.NodeSwitch, "", node.Name, "", false); err != nil {
klog.Errorf("failed to create or update IPs node-%s: %v", key, err)
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/ovn_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func (c *Controller) handleAddOvnEip(key string) error {
cachedEip.Spec.Type = util.OvnEipTypeNAT
}

if err = c.createOrUpdateCrdOvnEip(key, subnet.Name, v4ip, v6ip, mac, cachedEip.Spec.Type); err != nil {
if err = c.createOrUpdateOvnEipCR(key, subnet.Name, v4ip, v6ip, mac, cachedEip.Spec.Type); err != nil {
klog.Errorf("failed to create or update ovn eip '%s', %v", cachedEip.Name, err)
return err
}
Expand Down Expand Up @@ -351,7 +351,7 @@ func (c *Controller) handleDelOvnEip(key string) error {
return nil
}

func (c *Controller) createOrUpdateCrdOvnEip(key, subnet, v4ip, v6ip, mac, usage string) error {
func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usage string) error {
cachedEip, err := c.ovnEipsLister.Get(key)
if err != nil {
if k8serrors.IsNotFound(err) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ func (c *Controller) reconcileAllocateSubnets(cachedPod, pod *v1.Pod, needAlloca
}
// CreatePort may fail, so put ip CR creation after CreatePort
ipCrName := ovs.PodNameToPortName(podName, pod.Namespace, podNet.ProviderName)
if err := c.createOrUpdateCrdIPs(ipCrName, podName, ipStr, mac, subnet.Name, pod.Namespace, pod.Spec.NodeName, podType, false); err != nil {
if err := c.createOrUpdateIPCR(ipCrName, podName, ipStr, mac, subnet.Name, pod.Namespace, pod.Spec.NodeName, podType, false); err != nil {
err = fmt.Errorf("failed to create ips CR %s.%s: %v", podName, pod.Namespace, err)
klog.Error(err)
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/pod_iptables_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (c *Controller) handleAddPodAnnotatedIptablesEip(key string) error {
return err
}
externalNetwork := util.GetExternalNetwork(eip.Spec.ExternalSubnet)
if err := c.createOrUpdateCrdEip(eipName, "", "", "", "", natGw, externalNetwork); err != nil {
if err := c.createOrUpdateEipCR(eipName, "", "", "", "", natGw, externalNetwork); err != nil {
klog.Errorf("failed to create eip %s: %v", eipName, err)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/pod_iptables_fip.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (c *Controller) handleAddPodAnnotatedIptablesFip(key string) error {
return err
}
klog.V(3).Infof("handle add pod annotated iptables fip %s", fipName)
if err := c.createOrUpdateCrdFip(fipName, fipName, cachedPod.Annotations[util.IPAddressAnnotation]); err != nil {
if err := c.createOrUpdateFipCR(fipName, fipName, cachedPod.Annotations[util.IPAddressAnnotation]); err != nil {
klog.Errorf("failed to create fip %s: %v", fipName, err)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,7 @@ func (c *Controller) reconcileU2OInterconnectionIP(subnet *kubeovnv1.Subnet) err
case kubeovnv1.ProtocolDual:
subnet.Status.U2OInterconnectionIP = fmt.Sprintf("%s,%s", v4ip, v6ip)
}
if err := c.createOrUpdateCrdIPs("", u2oInterconnName, subnet.Status.U2OInterconnectionIP, "", subnet.Name, "default", "", "", false); err != nil {
if err := c.createOrUpdateIPCR("", u2oInterconnName, subnet.Status.U2OInterconnectionIP, "", subnet.Name, "default", "", "", false); err != nil {
klog.Errorf("failed to create or update IPs of %s : %v", u2oInterconnLrpName, err)
return err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/vip.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func (c *Controller) handleAddVirtualIP(key string) error {
parentV6ip = vip.Spec.ParentV6ip
parentMac = vip.Spec.ParentMac
}
if err = c.createOrUpdateCrdVip(key, vip.Spec.Namespace, subnet.Name, v4ip, v6ip, mac, parentV4ip, parentV6ip, parentMac); err != nil {
if err = c.createOrUpdateVipCR(key, vip.Spec.Namespace, subnet.Name, v4ip, v6ip, mac, parentV4ip, parentV6ip, parentMac); err != nil {
klog.Errorf("failed to create or update vip '%s', %v", vip.Name, err)
return err
}
Expand Down Expand Up @@ -322,7 +322,7 @@ func (c *Controller) handleUpdateVirtualIP(key string) error {
// should update
if vip.Status.Mac == "" {
// TODO:// add vip in its parent port aap list
if err = c.createOrUpdateCrdVip(key, vip.Spec.Namespace, vip.Spec.Subnet,
if err = c.createOrUpdateVipCR(key, vip.Spec.Namespace, vip.Spec.Subnet,
vip.Spec.V4ip, vip.Spec.V6ip, vip.Spec.MacAddress,
vip.Spec.ParentV4ip, vip.Spec.ParentV6ip, vip.Spec.MacAddress); err != nil {
return err
Expand Down Expand Up @@ -435,7 +435,7 @@ func (c *Controller) handleUpdateVirtualParents(key string) error {
return nil
}

func (c *Controller) createOrUpdateCrdVip(key, ns, subnet, v4ip, v6ip, mac, pV4ip, pV6ip, pmac string) error {
func (c *Controller) createOrUpdateVipCR(key, ns, subnet, v4ip, v6ip, mac, pV4ip, pV6ip, pmac string) error {
vipCR, err := c.virtualIpsLister.Get(key)
if err != nil {
if k8serrors.IsNotFound(err) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ func (c *Controller) handleAddVpcExternalSubnet(key, subnet string) error {
klog.Errorf("failed to acquire ip address for lrp eip %s, %v", lrpEipName, err)
return err
}
if err := c.createOrUpdateCrdOvnEip(lrpEipName, subnet, v4ip, v6ip, mac, util.OvnEipTypeLRP); err != nil {
if err := c.createOrUpdateOvnEipCR(lrpEipName, subnet, v4ip, v6ip, mac, util.OvnEipTypeLRP); err != nil {
klog.Errorf("failed to create ovn eip for lrp %s: %v", lrpEipName, err)
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/vpc_nat_gw_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (c *Controller) handleAddIptablesEip(key string) error {
return err
}
}
if err = c.createOrUpdateCrdEip(key, v4ip, v6ip, mac, cachedEip.Spec.NatGwDp, cachedEip.Spec.QoSPolicy, externalNetwork); err != nil {
if err = c.createOrUpdateEipCR(key, v4ip, v6ip, mac, cachedEip.Spec.NatGwDp, cachedEip.Spec.QoSPolicy, externalNetwork); err != nil {
klog.Errorf("failed to update eip %s, %v", key, err)
return err
}
Expand Down Expand Up @@ -645,7 +645,7 @@ func (c *Controller) GetGwBySubnet(name string) (string, string, error) {
return "", "", fmt.Errorf("failed to get subnet %s", name)
}

func (c *Controller) createOrUpdateCrdEip(key, v4ip, v6ip, mac, natGwDp, qos, externalNet string) error {
func (c *Controller) createOrUpdateEipCR(key, v4ip, v6ip, mac, natGwDp, qos, externalNet string) error {
needCreate := false
cachedEip, err := c.iptablesEipsLister.Get(key)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/vpc_nat_gw_nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,7 @@ func (c *Controller) isDnatDuplicated(gwName, eipName, dnatName, externalPort st
return false, nil
}

func (c *Controller) createOrUpdateCrdFip(key, eipName, internalIP string) error {
func (c *Controller) createOrUpdateFipCR(key, eipName, internalIP string) error {
cachedFip, err := c.iptablesFipsLister.Get(key)
if err != nil {
klog.V(3).Infof("create fip cr %s", key)
Expand Down

0 comments on commit 34887da

Please sign in to comment.