Skip to content

Commit

Permalink
fix backport (#4066)
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <zhangbingbing2_yewu@cmss.chinamobile.com>
  • Loading branch information
bobz965 committed May 22, 2024
1 parent 1ba289c commit e82c427
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions pkg/ovs/ovn-nb-load_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e82c427

Please sign in to comment.