Skip to content

Commit 081dfeb

Browse files
authored
Fix k0s CPLB config parsing interface conversion panic (#776)
Signed-off-by: Kimmo Lehto <[email protected]>
1 parent 0646847 commit 081dfeb

File tree

1 file changed

+5
-4
lines changed
  • pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster

1 file changed

+5
-4
lines changed

pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/spec.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ func (s *Spec) clusterExternalAddress() string {
8888
}
8989

9090
if cplb, ok := s.K0s.Config.Dig("spec", "network", "controlPlaneLoadBalancing").(dig.Mapping); ok {
91-
if enabled, ok := cplb.Dig("enabled").(bool); ok && enabled {
92-
vrrpAddresses := cplb.Dig("virtualServers").([]string)
93-
if len(vrrpAddresses) > 0 {
94-
return vrrpAddresses[0]
91+
if enabled, ok := cplb.Dig("enabled").(bool); ok && enabled && cplb.DigString("type") == "Keepalived" {
92+
if vrrpAddresses, ok := cplb.Dig("keepalived", "virtualServers").([]dig.Mapping); ok && len(vrrpAddresses) > 0 {
93+
if addr, ok := vrrpAddresses[0]["ipAddress"].(string); ok && addr != "" {
94+
return addr
95+
}
9596
}
9697
}
9798
}

0 commit comments

Comments
 (0)