From 25c6f65948291b093b59b9a8856c6f67c98df84a Mon Sep 17 00:00:00 2001 From: iwilltry42 Date: Wed, 21 Jul 2021 13:23:17 +0200 Subject: [PATCH] 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 --- pkg/client/cluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/client/cluster.go b/pkg/client/cluster.go index 99085ab0..ca8592db 100644 --- a/pkg/client/cluster.go +++ b/pkg/client/cluster.go @@ -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 }