fix(*): change TOML to YAML

pull/793/head
Matt Butcher 9 years ago
parent 7aa4ffa4d4
commit 9ca8c27e16

@ -16,7 +16,7 @@ option go_package = "services";
// config. At any given time a release has one
// chart and one config.
//
// Config: A config is a TOML file that supplies values
// Config: A config is a YAML file that supplies values
// to the parametrizable templates of a chart.
//
// Chart: A chart is a helm package that contains
@ -150,7 +150,7 @@ message UpdateReleaseResponse {
message InstallReleaseRequest {
// Chart is the protobuf representation of a chart.
hapi.chart.Chart chart = 1;
// Values is a string containing (unparsed) TOML values.
// Values is a string containing (unparsed) YAML values.
hapi.chart.Config values = 2;
// DryRun, if true, will run through the release logic, but neither create
// a release object nor deploy to Kubernetes. The release object returned

@ -19,7 +19,7 @@ something like this:
foo/
|- Chart.yaml # Information about your chart
|
|- values.toml # The default values for your templates
|- values.yaml # The default values for your templates
|
|- charts/ # Charts that this chart depends on
|

@ -42,7 +42,7 @@ var installCmd = &cobra.Command{
func init() {
f := installCmd.Flags()
f.StringVarP(&installValues, "values", "f", "", "path to a values TOML file")
f.StringVarP(&installValues, "values", "f", "", "path to a values YAML file")
f.StringVarP(&installRelName, "name", "n", "", "the release name. If unspecified, it will autogenerate one for you.")
f.BoolVar(&installDryRun, "dry-run", false, "simulate an install")

@ -25,7 +25,7 @@ wordpress/
Chart.yaml # A YAML file containing information about the chart
LICENSE # OPTIONAL: A plain text file containing the license for the chart
README.md # OPTIONAL: A human-readable README file
values.toml # The default configuration values for this chart
values.yaml # The default configuration values for this chart
charts/ # A directory containing any charts upon which this chart depends.
templates/ # A directory of templates that, when combined with values,
# will generate valid Kubernetes manifest files.
@ -133,13 +133,13 @@ Helm renders the charts, it will pass every file in that directory
through the template engine.
Values for the templates are supplied two ways:
- Chart developers may supply a file called `values.toml` inside of a
- Chart developers may supply a file called `values.yaml` inside of a
chart. This file can contain default values.
- Chart users may supply a TOML file that contains values. This can be
- Chart users may supply a YAML file that contains values. This can be
provided on the command line with `helm install`.
When a user supplies custom values, these values will override the
values in the chart's `values.toml` file.
values in the chart's `values.yaml` file.
### Template Files
Template files follow the standard conventions for writing Go templates.
@ -207,36 +207,36 @@ used to pass arbitrarily structured data into the template.
### Values files
Considering the template in the previous section, a `values.toml` file
Considering the template in the previous section, a `values.yaml` file
that supplies the necessary values would look like this:
```toml
```yaml
imageRegistry = "quay.io/deis"
dockerTag = "latest"
pullPolicy = "alwaysPull"
storage = "s3"
```
A values file is formatted in TOML. A chart may include a default
`values.toml` file. The Helm install command allows a user to override
values by supplying additional TOML values:
A values file is formatted in YAML. A chart may include a default
`values.yaml` file. The Helm install command allows a user to override
values by supplying additional YAML values:
```console
$ helm install --values=myvals.toml wordpress
$ helm install --values=myvals.yaml wordpress
```
When values are passed in this way, they will be merged into the default
values file. For example, consider a `myvals.toml` file that looks like
values file. For example, consider a `myvals.yaml` file that looks like
this:
```toml
```yaml
storage = "gcs"
```
When this is merged with the `values.toml` in the chart, the resulting
When this is merged with the `values.yaml` in the chart, the resulting
generated content will be:
```toml
```yaml
imageRegistry = "quay.io/deis"
dockerTag = "latest"
pullPolicy = "alwaysPull"
@ -246,7 +246,7 @@ storage = "gcs"
Note that only the last field was overridden.
**NOTE:** The default values file included inside of a chart _must_ be named
`values.toml`. But files specified on the command line can be named
`values.yaml`. But files specified on the command line can be named
anything.
### Scope, Dependencies, and Values
@ -259,7 +259,7 @@ demonstration Wordpress chart above has both `mysql` and `apache` as
dependencies. The values file could supply values to all of these
components:
```toml
```yaml
title = "My Wordpress Site" # Sent to the Wordpress template
[mysql]
@ -289,7 +289,7 @@ standard references that will help you out.
- [Go templates](https://godoc.org/text/template)
- [Extra template functions](https://godoc.org/github.com/Masterminds/sprig)
- [The TOML format](https://github.com/toml-lang/toml)
- [The YAML format]()
## Using Helm to Manage Charts

@ -3,7 +3,7 @@ This example was generated using the command `helm create alpine`.
The `templates/` directory contains a very simple pod resource with a
couple of parameters.
The `values.toml` file contains the default values for the
The `values.yaml` file contains the default values for the
`alpine-pod.yaml` template.
You can install this example using `helm install docs/examples/alpine`.

@ -1,2 +0,0 @@
# The pod name
name = "my-alpine"

@ -0,0 +1,2 @@
# The pod name
name: my-alpine

@ -93,7 +93,9 @@ func loadFiles(files []*afile) (*chart.Chart, error) {
return c, err
}
c.Metadata = m
} else if f.name == "values.toml" || f.name == "values.yaml" {
} else if f.name == "values.toml" {
return c, errors.New("values.toml is illegal as of 2.0.0-alpha.2")
} else if f.name == "values.yaml" {
c.Values = &chart.Config{Raw: string(f.data)}
} else if strings.HasPrefix(f.name, "templates/") {
c.Templates = append(c.Templates, &chart.Template{Name: f.name, Data: f.data})

Binary file not shown.

@ -1,4 +1,4 @@
# Default values for mast1.
# This is a TOML-formatted file. https://github.com/toml-lang/toml
# This is a YAML-formatted file.
# Declare name/value pairs to be passed into your templates.
# name = "value"

@ -7,8 +7,7 @@ import (
"text/template"
"github.com/Masterminds/sprig"
chartutil "k8s.io/helm/pkg/chart"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/proto/hapi/chart"
)
@ -177,7 +176,7 @@ func coalesceValues(c *chart.Chart, v chartutil.Values) chartutil.Values {
nv, err := chartutil.ReadValues([]byte(c.Values.Raw))
if err != nil {
// On error, we return just the overridden values.
// FIXME: We should log this error. It indicates that the TOML data
// FIXME: We should log this error. It indicates that the YAML data
// did not parse.
log.Printf("error reading default values: %s", err)
return v
@ -226,7 +225,7 @@ func coalesceTables(dst, src map[string]interface{}) {
}
}
// istable is a special-purpose function to see if the present thing matches the definition of a TOML table.
// istable is a special-purpose function to see if the present thing matches the definition of a YAML table.
func istable(v interface{}) bool {
_, ok := v.(map[string]interface{})
return ok

@ -5,7 +5,7 @@ import (
"sync"
"testing"
chartutil "k8s.io/helm/pkg/chart"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/proto/hapi/chart"
)
@ -31,13 +31,12 @@ func TestRender(t *testing.T) {
{Name: "test1", Data: []byte("{{.outer | title }} {{.inner | title}}")},
},
Values: &chart.Config{
Raw: `outer = "DEFAULT"\ninner= "DEFAULT"\n`,
Raw: "outer: DEFAULT\ninner: DEFAULT",
},
}
vals := &chart.Config{
Raw: `outer = "BAD"
inner= "inn"`,
Raw: "outer: BAD\ninner: inn",
}
overrides := map[string]interface{}{
@ -207,18 +206,20 @@ func TestRenderNestedValues(t *testing.T) {
{Name: outerpath, Data: []byte(`Gather ye {{.what}} while ye may`)},
},
Values: &chart.Config{
Raw: `what = "stinkweed"
[herrick]
who = "time"
`},
Raw: `
what: stinkweed
herrick:
who: time`,
},
Dependencies: []*chart.Chart{inner},
}
inject := chart.Config{
Raw: `
what = "rosebuds"
[herrick.deepest]
what = "flower"`,
what: rosebuds
herrick:
deepest:
what: flower`,
}
out, err := e.Render(outer, &inject, map[string]interface{}{})

@ -9,7 +9,7 @@ const (
ErrMissingTpls = Error("missing chart templates")
// ErrMissingChart indicates that the Chart.yaml data is missing.
ErrMissingChart = Error("missing chart metadata")
// ErrMissingValues indicates that the config values.toml data is missing.
// ErrMissingValues indicates that the config values.yaml data is missing.
ErrMissingValues = Error("missing chart values")
)

@ -53,8 +53,8 @@ func TestBadValues(t *testing.T) {
if len(m) != 1 {
t.Errorf("All didn't fail with expected errors, got %#v", m)
}
if !strings.Contains(m[0].Text, "Bare keys cannot contain ':'") {
t.Errorf("All didn't have the error for invalid key format")
if !strings.Contains(m[0].Text, "cannot unmarshal") {
t.Errorf("All didn't have the error for invalid key format: %s", m[0].Text)
}
}

@ -8,7 +8,7 @@ type Severity int
const (
// UnknownSev indicates that the severity of the error is unknown, and should not stop processing.
UnknownSev = iota
// InfoSev indicates information, for example missing values.toml file
// InfoSev indicates information, for example missing values.yaml file
InfoSev
// WarningSev indicates that something does not meet code standards, but will likely function.
WarningSev

@ -1 +0,0 @@
name = "mariner"

@ -0,0 +1 @@
name: "mariner"

@ -1,4 +0,0 @@
# Default values for badchartfile.
# This is a TOML-formatted file. https://github.com/toml-lang/toml
# Declare name/value pairs to be passed into your templates.
# name = "value"

@ -0,0 +1 @@
# Default values for badchartfile.

@ -1,2 +1,2 @@
# Invalid value for badvaluesfile for testing lint fails with invalid toml format
name: "value"
# Invalid value for badvaluesfile for testing lint fails with invalid yaml format
name= "value"

@ -1 +0,0 @@
name = "goodone here"

@ -0,0 +1 @@
name: "goodone here"

@ -4,18 +4,18 @@ import (
"os"
"path/filepath"
"k8s.io/helm/pkg/chart"
"k8s.io/helm/pkg/chartutil"
)
// Values lints a chart's values.toml file.
// Values lints a chart's values.yaml file.
func Values(basepath string) (messages []Message) {
vf := filepath.Join(basepath, "values.toml")
vf := filepath.Join(basepath, "values.yaml")
messages = []Message{}
if _, err := os.Stat(vf); err != nil {
messages = append(messages, Message{Severity: InfoSev, Text: "No values.toml file"})
messages = append(messages, Message{Severity: InfoSev, Text: "No values.yaml file"})
return
}
_, err := chart.ReadValuesFile(vf)
_, err := chartutil.ReadValuesFile(vf)
if err != nil {
messages = append(messages, Message{Severity: ErrorSev, Text: err.Error()})
}

@ -238,7 +238,7 @@ func (*UpdateReleaseResponse) Descriptor() ([]byte, []int) { return fileDescript
type InstallReleaseRequest struct {
// Chart is the protobuf representation of a chart.
Chart *hapi_chart3.Chart `protobuf:"bytes,1,opt,name=chart" json:"chart,omitempty"`
// Values is a string containing (unparsed) TOML values.
// Values is a string containing (unparsed) YAML values.
Values *hapi_chart.Config `protobuf:"bytes,2,opt,name=values" json:"values,omitempty"`
// DryRun, if true, will run through the release logic, but neither create
// a release object nor deploy to Kubernetes. The release object returned

Loading…
Cancel
Save