This commit is contained in:
Julian Sommer
2026-03-27 11:30:39 +10:00
parent 46670ee8af
commit a92ea13798
4 changed files with 23 additions and 14 deletions
+1 -1
View File
@@ -220,7 +220,7 @@ func init() {
// External networking flags
adminInitCmd.Flags().String("external-mode", "", "External network mode: 'pool' (default when WAN detected) or '' (disabled)")
adminInitCmd.Flags().String("external-iface", "", "WAN NIC for br-external (auto-detected from default route)")
adminInitCmd.Flags().String("external-source", "", "Pool IP source: 'static' (default, uses --external-pool range) or 'dhcp' (from router DHCP)")
adminInitCmd.Flags().String("external-source", "dhcp", "Pool IP source: 'dhcp' (default, from router DHCP) or 'static' (uses --external-pool range)")
adminInitCmd.Flags().String("external-pool", "", "External IP pool range as start-end (e.g., 192.168.1.150-192.168.1.250)")
adminInitCmd.Flags().String("external-gateway", "", "WAN gateway IP (auto-detected from default route)")
adminInitCmd.Flags().String("gateway-ip", "", "OVN gateway router's external IP for SNAT (default: pool range_start for pool mode, required for nat mode without DHCP)")
-1
View File
@@ -197,7 +197,6 @@ if [ -n "$WAN_IFACE" ] && [ -n "$WAN_GW" ]; then
ADMIN_INIT_ARGS="$ADMIN_INIT_ARGS --external-mode=pool --external-pool=${POOL_START}-${POOL_END} --external-gateway=${WAN_GW} --external-prefix-len=${WAN_PREFIX}"
fi
fi
./bin/spx admin init $ADMIN_INIT_ARGS
# Re-initialize with --force to regenerate credentials, certs, config, and
# update ~/.aws/credentials. Must carry the same args so external networking
+18 -10
View File
@@ -673,12 +673,18 @@ func (h *TopologyHandler) handleIGWAttach(msg *nats.Msg) {
if gip == "" {
gip = pool.RangeStart // Default: first IP in range
}
gatewayIP = gip
prefixLen := pool.PrefixLen
if prefixLen == 0 {
prefixLen = 24
if gip != "" {
// Static pool: use the pool's IP for the gateway router port
gatewayIP = gip
prefixLen := pool.PrefixLen
if prefixLen == 0 {
prefixLen = 24
}
gatewayNetwork = fmt.Sprintf("%s/%d", gip, prefixLen)
}
gatewayNetwork = fmt.Sprintf("%s/%d", gip, prefixLen)
// DHCP-sourced pools have no GatewayIP/RangeStart — keep the
// link-local defaults for the OVN router port but still use the
// pool's WAN gateway for the default route.
wanGateway = pool.Gateway
slog.Info("vpcd: using external pool for IGW",
"pool", pool.Name,
@@ -1059,12 +1065,14 @@ func (h *TopologyHandler) reconcileIGW(ctx context.Context, vpcId, igwId string)
if gip == "" {
gip = pool.RangeStart
}
gatewayIP = gip
prefixLen := pool.PrefixLen
if prefixLen == 0 {
prefixLen = 24
if gip != "" {
gatewayIP = gip
prefixLen := pool.PrefixLen
if prefixLen == 0 {
prefixLen = 24
}
gatewayNetwork = fmt.Sprintf("%s/%d", gip, prefixLen)
}
gatewayNetwork = fmt.Sprintf("%s/%d", gip, prefixLen)
wanGateway = pool.Gateway
}
+4 -2
View File
@@ -191,10 +191,12 @@ var discoverChassis = func(sbAddr string) ([]string, error) {
if sbAddr != "" {
args = append(args, "--db="+sbAddr)
}
args = append(args, "list-chassis")
// OVN 25.03+ removed the "list-chassis" convenience command.
// Use "--columns=name list Chassis" which works on all versions.
args = append(args, "--bare", "--columns=name", "list", "Chassis")
out, err := sudoCommand("ovn-sbctl", args...).CombinedOutput()
if err != nil {
return nil, fmt.Errorf("ovn-sbctl list-chassis: %s: %w", strings.TrimSpace(string(out)), err)
return nil, fmt.Errorf("ovn-sbctl list Chassis: %s: %w", strings.TrimSpace(string(out)), err)
}
var names []string
for line := range strings.SplitSeq(strings.TrimSpace(string(out)), "\n") {