Skip to content

Commit

Permalink
Make sure we marshall version too…
Browse files Browse the repository at this point in the history
… otherwise the k8s controller might fail to parse the file as it will
think it's version 1.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
  • Loading branch information
vdemeester committed Feb 20, 2018
1 parent bbe7f84 commit 568167e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cli/command/stack/kubernetes/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ type versionedConfig struct {
Version string
}

func (c versionedConfig) MarshalYAML() (interface{}, error) {
i, err := c.Config.MarshalYAML()
if err != nil {
return nil, err
}
i.(map[string]interface{})["version"] = c.Version
return i, nil
}

// LoadStack loads a stack from a Compose config, with a given name.
func LoadStack(name, version string, cfg composetypes.Config) (*apiv1beta1.Stack, error) {
cfg.Filename = ""
Expand Down
1 change: 1 addition & 0 deletions cli/command/stack/kubernetes/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ services:
image: bar
foo:
image: foo
version: "3.1"
volumes: {}
`),
},
Expand Down

0 comments on commit 568167e

Please sign in to comment.