[FIX] Prevent segmentation fault with --no-lb and --verbose/trace (#775)

This commit is contained in:
Benjamin Blattberg 2021-10-08 04:32:11 -05:00 committed by GitHub
parent de5805640b
commit 2040a458b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,8 +100,9 @@ func TransformPorts(ctx context.Context, runtime runtimes.Runtime, cluster *k3d.
}
// print generated loadbalancer config
if l.Log().GetLevel() >= logrus.DebugLevel {
// print generated loadbalancer config if exists
// (avoid segmentation fault if loadbalancer is disabled)
if l.Log().GetLevel() >= logrus.DebugLevel && cluster.ServerLoadBalancer != nil {
yamlized, err := yaml.Marshal(cluster.ServerLoadBalancer.Config)
if err != nil {
l.Log().Errorf("error printing loadbalancer config: %v", err)