Skip to content

Commit 47e78b9

Browse files
authored
Fix panic when parsing separate YAML documents in same file (#926)
Signed-off-by: Anton Trye <2375231+antontrye@users.noreply.github.com>
1 parent bedaa91 commit 47e78b9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cmd/flags.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ func readConfig(ctx *cli.Context) (*v1beta1.Cluster, error) {
275275
return nil, fmt.Errorf("failed to unmarshal cluster config: %w", err)
276276
}
277277
if k0sConfigs, err := mr.GetResources("k0s.k0sproject.io/v1beta1", "ClusterConfig"); err == nil && len(k0sConfigs) > 0 {
278+
if cfg.Spec.K0s.Config == nil {
279+
cfg.Spec.K0s.Config = make(dig.Mapping)
280+
}
278281
for _, k0sConfig := range k0sConfigs {
279282
k0s := make(dig.Mapping)
280283
log.Debugf("unmarshalling %d bytes of config from %v", len(k0sConfig.Raw), k0sConfig.Filename())

0 commit comments

Comments
 (0)