chore: make qemu lb address bind work on darwin

The loadbalancer is bound to all interfaces on macos.
The bridge interface address is not used as the bridge is not yet created at this stage.
Multiple loadbalancers can be assigned via different ports.

Signed-off-by: Orzelius <33936483+Orzelius@users.noreply.github.com>
This commit is contained in:
Orzelius 2025-05-05 21:28:35 +09:00
parent 97ceab001c
commit ab7e693d76
No known key found for this signature in database
GPG Key ID: C17C8E3962A0D9B1
3 changed files with 27 additions and 1 deletions

View File

@ -38,7 +38,7 @@ func (p *Provisioner) CreateLoadBalancer(state *State, clusterReq provision.Clus
args := []string{
"loadbalancer-launch",
"--loadbalancer-addr", clusterReq.Network.GatewayAddrs[0].String(),
"--loadbalancer-addr", getLbBindIP(clusterReq.Network.GatewayAddrs[0]),
"--loadbalancer-upstreams", strings.Join(controlPlaneIPs, ","),
}

View File

@ -0,0 +1,14 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package vm
import "net/netip"
// getLbBindIP returns the 0.0.0.0 address to bind to all interfaces on macos.
// The bridge interface address is not used as the bridge is not yet created at this stage.
// Multiple loadbalancers can be assigned via different ports.
func getLbBindIP(_ netip.Addr) string {
return "0.0.0.0"
}

View File

@ -0,0 +1,12 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package vm
import "net/netip"
// getLbBindIP returns the gateway address to bind the loadbalancer to the bridge interface.
func getLbBindIP(gateway netip.Addr) string {
return gateway.String()
}