From 081dfeb085418df4824e00778b092e77f84715ad Mon Sep 17 00:00:00 2001 From: Kimmo Lehto Date: Fri, 25 Oct 2024 13:43:06 +0300 Subject: [PATCH] Fix k0s CPLB config parsing interface conversion panic (#776) Signed-off-by: Kimmo Lehto --- pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/spec.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/spec.go b/pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/spec.go index 050be23e..5959e9cb 100644 --- a/pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/spec.go +++ b/pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/spec.go @@ -88,10 +88,11 @@ func (s *Spec) clusterExternalAddress() string { } if cplb, ok := s.K0s.Config.Dig("spec", "network", "controlPlaneLoadBalancing").(dig.Mapping); ok { - if enabled, ok := cplb.Dig("enabled").(bool); ok && enabled { - vrrpAddresses := cplb.Dig("virtualServers").([]string) - if len(vrrpAddresses) > 0 { - return vrrpAddresses[0] + if enabled, ok := cplb.Dig("enabled").(bool); ok && enabled && cplb.DigString("type") == "Keepalived" { + if vrrpAddresses, ok := cplb.Dig("keepalived", "virtualServers").([]dig.Mapping); ok && len(vrrpAddresses) > 0 { + if addr, ok := vrrpAddresses[0]["ipAddress"].(string); ok && addr != "" { + return addr + } } } }