fix: clusterGet no error on no lb config
- clusterGet should not return an error, if it cannot get the loadbalancer config, as it's not critical -> it should not rely on files created in nodehook actions - this also fixes a nil pointer exception when cluster creation was interrupted even before the loadbalancer was added to the cluster in memory Fixes #683
This commit is contained in:
parent
a5c1d3becb
commit
25c6f65948
@ -794,10 +794,10 @@ func ClusterGet(ctx context.Context, runtime k3drt.Runtime, cluster *k3d.Cluster
|
||||
}
|
||||
}
|
||||
|
||||
if cluster.ServerLoadBalancer.Node != nil {
|
||||
if cluster.ServerLoadBalancer != nil && cluster.ServerLoadBalancer.Node != nil {
|
||||
lbcfg, err := GetLoadbalancerConfig(ctx, runtime, cluster)
|
||||
if err != nil {
|
||||
return cluster, fmt.Errorf("error getting loadbalancer config for cluster %s: %w", cluster.Name, err)
|
||||
log.Errorf("error getting loadbalancer config from %s: %v", cluster.ServerLoadBalancer.Node.Name, err)
|
||||
}
|
||||
cluster.ServerLoadBalancer.Config = &lbcfg
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user