mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Adjust first node-ip based on configured clusterCIDR
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
This commit is contained in:
parent
1fe0371e95
commit
88c431aea5
@ -447,6 +447,14 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
|
||||
}
|
||||
}
|
||||
|
||||
if controlConfig.ClusterIPRange != nil {
|
||||
if utilsnet.IPFamilyOfCIDR(controlConfig.ClusterIPRange) != utilsnet.IPFamilyOf(nodeIPs[0]) && len(nodeIPs) > 1 {
|
||||
firstNodeIP := nodeIPs[0]
|
||||
nodeIPs[0] = nodeIPs[1]
|
||||
nodeIPs[1] = firstNodeIP
|
||||
}
|
||||
}
|
||||
|
||||
nodeExternalIPs, err := util.ParseStringSliceToIPs(envInfo.NodeExternalIP)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid node-external-ip: %w", err)
|
||||
|
Loading…
Reference in New Issue
Block a user