Merge pull request #5728 from bacongobbler/fix-v1-apiversion-missing

fix(loader): assume apiVersion is v1 when loading charts
pull/5735/head
Matthew Fisher 5 years ago committed by GitHub
commit 867c525a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -79,6 +79,12 @@ func LoadFiles(files []*BufferedFile) (*chart.Chart, error) {
if err := yaml.Unmarshal(f.Data, c.Metadata); err != nil {
return c, errors.Wrap(err, "cannot load Chart.yaml")
}
// NOTE(bacongobbler): while the chart specification says that APIVersion must be set,
// Helm 2 accepted charts that did not provide an APIVersion in their chart metadata.
// Because of that, if APIVersion is unset, we should assume we're loading a v1 chart.
if c.Metadata.APIVersion == "" {
c.Metadata.APIVersion = chart.APIVersionV1
}
case f.Name == "Chart.lock":
c.Lock = new(chart.Lock)
if err := yaml.Unmarshal(f.Data, &c.Lock); err != nil {

@ -1,4 +1,3 @@
apiVersion: v1
name: albatross
description: A Helm chart for Kubernetes
version: 0.1.0

Loading…
Cancel
Save