Skip to content

Commit

Permalink
Don't marshall cluster config object
Browse files Browse the repository at this point in the history
ClusterConfig has a method that fills in defaults when Marshalling it to yaml
this provides some defaults that breaks cluster installation
  • Loading branch information
danj-replicated committed Oct 6, 2023
1 parent 4289f2c commit 7d74013
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,21 +336,10 @@ func UpdateHelmConfigs(cfg *v1beta1.Cluster, opts ...addons.Option) error {
Helm: newHelmExtension,
}

spec := k0s.Spec
spec := cfg.Spec.K0s.Config["spec"].(dig.Mapping)
spec["extensions"] = newClusterExtensions

spec.Extensions = newClusterExtensions

newSpecString, err := yamlv2.Marshal(spec)
if err != nil {
return fmt.Errorf("unable to marshal k0s spec: %w", err)
}

specMapping := dig.Mapping{}
if err := yamlv2.Unmarshal(newSpecString, &specMapping); err != nil {
return fmt.Errorf("unable to unmarshal k0s spec: %w", err)
}

cfg.Spec.K0s.Config["spec"] = specMapping
cfg.Spec.K0s.Config["spec"] = spec

return nil
}
Expand Down

0 comments on commit 7d74013

Please sign in to comment.