Skip to content

Commit 460effd

Browse files
committed
incusd/network/ovn: Don't advertise offline load-balancers on startup
Signed-off-by: Stéphane Graber <[email protected]> Sponsored-by: Luizalabs (https://luizalabs.com)
1 parent dd11c0c commit 460effd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

internal/server/network/driver_ovn.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6632,6 +6632,29 @@ func (n *ovn) loadBalancerBGPSetupPrefixes() error {
66326632
continue
66336633
}
66346634

6635+
// Check health of load-balancer (if enabled).
6636+
online := false
6637+
for _, protocol := range []string{"tcp", "udp"} {
6638+
lb, err := n.ovnnb.GetLoadBalancer(context.TODO(), networkOVN.OVNLoadBalancer(fmt.Sprintf("incus-net%d-lb-%s-%s", n.id, listenAddr.String(), protocol)))
6639+
if err != nil {
6640+
continue
6641+
}
6642+
6643+
lbOnline, err := n.ovnsb.CheckLoadBalancerOnline(context.TODO(), *lb)
6644+
if err != nil {
6645+
continue
6646+
}
6647+
6648+
if lbOnline {
6649+
online = true
6650+
break
6651+
}
6652+
}
6653+
6654+
if !online {
6655+
continue
6656+
}
6657+
66356658
_, ipRouteSubnet, err := net.ParseCIDR(fmt.Sprintf("%s/%d", listenAddr.String(), routeSubnetSize))
66366659
if err != nil {
66376660
return err

0 commit comments

Comments
 (0)