Skip to content

Commit

Permalink
clear load-balancer vips when delete last vip (#3555)
Browse files Browse the repository at this point in the history
Signed-off-by: 马洪贞 <hzma@alauda.io>
  • Loading branch information
hongzhen-ma committed Dec 21, 2023
1 parent d049124 commit b97f0d5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/ovs/ovn-nbctl-legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1228,9 +1228,17 @@ func (c LegacyClient) DeleteLoadBalancerVip(vip, lb string) error {
return err
}
// vip is empty or delete last rule will destroy the loadbalancer
if vip == "" || len(existVips) == 1 {
if vip == "" {
return nil
}
if len(existVips) == 1 {
if output, err := c.ovnNbCommand("clear", "load_balancer", lb, "vips"); err != nil {
klog.Errorf("failed to clear vips %v for load_balancer %v, %q", existVips, lb, output)
return err
}
return nil
}

_, err = c.ovnNbCommand(IfExists, "lb-del", lb, vip)
return err
}
Expand Down

0 comments on commit b97f0d5

Please sign in to comment.