Skip to content

Commit

Permalink
Fix k0s CPLB config parsing interface conversion panic (#776)
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke authored Oct 25, 2024
1 parent 0646847 commit 081dfeb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Expand Down

0 comments on commit 081dfeb

Please sign in to comment.