mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-27 14:31:11 +01:00
fix: only set gateway if set in context (opennebula)
Fix the network config setup. Signed-off-by: Christian WALDBILLIG <christian@waldbillig.io> Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
parent
4575dd8e74
commit
c79d69c2e2
@ -127,27 +127,29 @@ func (o *OpenNebula) ParseMetadata(st state.State, oneContextPlain []byte) (*run
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// Parse gateway address and create RouteSpecSpec entry
|
if oneContext[ifaceName+"_GATEWAY"] != "" {
|
||||||
gateway, err := netip.ParseAddr(oneContext[ifaceName+"_GATEWAY"])
|
// Parse gateway address and create RouteSpecSpec entry
|
||||||
if err != nil {
|
gateway, err := netip.ParseAddr(oneContext[ifaceName+"_GATEWAY"])
|
||||||
return nil, fmt.Errorf("failed to parse gateway ip: %w", err)
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to parse gateway ip: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
route := network.RouteSpecSpec{
|
||||||
|
ConfigLayer: network.ConfigPlatform,
|
||||||
|
Gateway: gateway,
|
||||||
|
OutLinkName: ifaceNameLower,
|
||||||
|
Table: nethelpers.TableMain,
|
||||||
|
Protocol: nethelpers.ProtocolStatic,
|
||||||
|
Type: nethelpers.TypeUnicast,
|
||||||
|
Family: nethelpers.FamilyInet4,
|
||||||
|
Priority: network.DefaultRouteMetric,
|
||||||
|
}
|
||||||
|
|
||||||
|
route.Normalize()
|
||||||
|
|
||||||
|
networkConfig.Routes = append(networkConfig.Routes, route)
|
||||||
}
|
}
|
||||||
|
|
||||||
route := network.RouteSpecSpec{
|
|
||||||
ConfigLayer: network.ConfigPlatform,
|
|
||||||
Gateway: gateway,
|
|
||||||
OutLinkName: ifaceNameLower,
|
|
||||||
Table: nethelpers.TableMain,
|
|
||||||
Protocol: nethelpers.ProtocolStatic,
|
|
||||||
Type: nethelpers.TypeUnicast,
|
|
||||||
Family: nethelpers.FamilyInet4,
|
|
||||||
Priority: network.DefaultRouteMetric,
|
|
||||||
}
|
|
||||||
|
|
||||||
route.Normalize()
|
|
||||||
|
|
||||||
networkConfig.Routes = append(networkConfig.Routes, route)
|
|
||||||
|
|
||||||
// Parse DNS servers
|
// Parse DNS servers
|
||||||
dnsServers := strings.Fields(oneContext[ifaceName+"_DNS"])
|
dnsServers := strings.Fields(oneContext[ifaceName+"_DNS"])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user