Skip to content

Commit

Permalink
default and override values.yaml files are now optional
Browse files Browse the repository at this point in the history
  • Loading branch information
dkapanidis committed Aug 12, 2016
1 parent 6285c1a commit e5b6712
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions cmd/tide/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package main // import "github.com/harbur/tide/cmd/tide"

import (
"bytes"

"k8s.io/helm/cmd/tiller/environment"
chartutil "k8s.io/helm/pkg/chartutil"
chart "k8s.io/helm/pkg/proto/hapi/chart"
"os"
)

var env = environment.New()
Expand All @@ -17,17 +17,25 @@ func readManifest(chartname string) (string, error) {
return "", err
}

vals, err := chartutil.ReadValuesFile(chartname + "/values.yaml")
debug("Values loaded %v", vals)
if err != nil {
print_error("Values cannot be loaded: %s", err)
return "", err
// values.yaml is optional
vals := chartutil.Values{}
if _, err := os.Stat(chartname + "/values.yaml"); err == nil {
vals, err = chartutil.ReadValuesFile(chartname + "/values.yaml")
debug("Values loaded %v", vals)
if err != nil {
print_error("Values cannot be loaded: %s", err)
return "", err
}
}

overrides, err := chartutil.ReadValuesFile(input_file)
if err != nil {
print_error("Overrides cannot be loaded: %s", err)
return "", err
// input_file is optional
overrides := chartutil.Values{}
if _, err := os.Stat(input_file); err == nil {
overrides, err = chartutil.ReadValuesFile(input_file)
if err != nil {
print_error("Overrides cannot be loaded: %s", err)
return "", err
}
}

valsYAML, _ := vals.YAML()
Expand Down

0 comments on commit e5b6712

Please sign in to comment.