From e82c42782b80676d18eac56c1addea7ea1fe1f90 Mon Sep 17 00:00:00 2001 From: bobz965 Date: Wed, 22 May 2024 14:49:31 +0800 Subject: [PATCH] fix backport (#4066) Signed-off-by: bobz965 --- pkg/controller/pod.go | 8 ++++---- pkg/ovs/ovn-nb-load_balancer.go | 8 +++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/controller/pod.go b/pkg/controller/pod.go index 2d145deb73f..3c1a70c0cff 100644 --- a/pkg/controller/pod.go +++ b/pkg/controller/pod.go @@ -508,7 +508,7 @@ func (c *Controller) getPodKubeovnNets(pod *v1.Pod) ([]*kubeovnNet, error) { func (c *Controller) changeVMSubnet(vmName, namespace, providerName, subnetName string) error { ipName := ovs.PodNameToPortName(vmName, namespace, providerName) - ipCr, err := c.ipsLister.Get(ipName) + ipCR, err := c.ipsLister.Get(ipName) if err != nil { if k8serrors.IsNotFound(err) { return nil @@ -517,10 +517,10 @@ func (c *Controller) changeVMSubnet(vmName, namespace, providerName, subnetName klog.Error(err) return err } - if ipCr.Spec.Subnet != subnetName { + if ipCR.Spec.Subnet != subnetName { key := fmt.Sprintf("%s/%s", namespace, vmName) - klog.Infof("release ipam for vm %s from old subnet %s", key, ipCr.Spec.Subnet) - c.ipam.ReleaseAddressByPod(key, ipCr.Spec.Subnet) + klog.Infof("release ipam for vm %s from old subnet %s", key, ipCR.Spec.Subnet) + c.ipam.ReleaseAddressByPod(key, ipCR.Spec.Subnet) klog.Infof("gc logical switch port %s", key) if err := c.OVNNbClient.DeleteLogicalSwitchPort(key); err != nil { klog.Errorf("failed to delete lsp %s, %v", key, err) diff --git a/pkg/ovs/ovn-nb-load_balancer.go b/pkg/ovs/ovn-nb-load_balancer.go index 134b8b49306..217c434d84a 100644 --- a/pkg/ovs/ovn-nb-load_balancer.go +++ b/pkg/ovs/ovn-nb-load_balancer.go @@ -153,11 +153,9 @@ func (c *OVNNbClient) LoadBalancerDeleteVip(lbName, vipEndpoint string, ignoreHe return err } - if lbhc != nil { - if err = c.LoadBalancerDeleteHealthCheck(lbName, lbhc.UUID); err != nil { - klog.Errorf("failed to delete lb health check: %v", err) - return err - } + if err = c.LoadBalancerDeleteHealthCheck(lbName, lbhc.UUID); err != nil { + klog.Errorf("failed to delete lb health check: %v", err) + return err } } if lb == nil || len(lb.Vips) == 0 {