diff --git a/README.md b/README.md index 59fdf929..f2934076 100644 --- a/README.md +++ b/README.md @@ -212,17 +212,17 @@ helmfiles: # The default is `environments: {"default": {}}` which implies: # # - `{{ .Environment.Name }}` evaluates to "default" -# - `{{ .Environment.Values }}` being empty +# - `{{ .Values }}` being empty environments: # The "default" environment is available and used when `helmfile` is run without `--environment NAME`. default: - # Everything from the values.yaml is available via `{{ .Environment.Values.KEY }}`. + # Everything from the values.yaml is available via `{{ .Values.KEY }}`. # Suppose `{"foo": {"bar": 1}}` contained in the values.yaml below, - # `{{ .Environment.Values.foo.bar }}` is evaluated to `1`. + # `{{ .Values.foo.bar }}` is evaluated to `1`. values: - environments/default/values.yaml # Each entry in values can be either a file path or inline values. - # The below is an example of inline values, which is merged to the `.Environment.Values` + # The below is an example of inline values, which is merged to the `.Values` - myChartVer: 1.0.0-dev # Any environment other than `default` is used only when `helmfile` is run with `--environment NAME`. # That is, the "production" env below is used when and only when it is run like `helmfile --environment production sync`. @@ -625,7 +625,7 @@ releaseName: prod `values.yaml.gotmpl` ```yaml -domain: {{ .Environment.Values | getOrNil "my.domain" | default "dev.example.com" }} +domain: {{ .Values | getOrNil "my.domain" | default "dev.example.com" }} ``` `helmfile sync` installs `myapp` with the value `domain=dev.example.com`, @@ -652,17 +652,26 @@ environments: - other.yaml.gotmpl # template directives with potential side-effects like `exec` and `readFile` will be honoured releases: -- name: myapp-{{ .Environment.Values.releaseName }} # release name will be one of `dev` or `prod` depending on selected environment +- name: myapp-{{ .Values.releaseName }} # release name will be one of `dev` or `prod` depending on selected environment values: - values.yaml.gotmpl -{{ if eq (.Environment.Values.releaseName "prod" ) }} +{{ if eq (.Values.releaseName "prod" ) }} # this release would be installed only if selected environment is `production` - name: production-specific-release ... {{ end }} ``` +### Note + +The `{{ .Values.foo }}` syntax is the recommended way of using environment values. + +Prior to this [pull request](https://github.com/roboll/helmfile/pull/647), environment values were made available through the `{{ .Environment.Values.foo }}` syntax. +This is still working but is **deprecated** and the new `{{ .Values.foo }}` syntax should be used instead. + +You can read more infos about the feature proposal [here](https://github.com/roboll/helmfile/issues/640). + ## Environment Secrets Environment Secrets (not to be confused with Kubernetes Secrets) are encrypted versions of `Environment Values`. @@ -697,7 +706,7 @@ releases: Then the environment secret `foo.bar` can be referenced by the below template expression in your `values.yaml.gotmpl`: ```yaml -{{ .Environment.Values.foo.bar }} +{{ .Values.foo.bar }} ``` ## Tillerless diff --git a/docs/writing-helmfile.md b/docs/writing-helmfile.md index 7f7d5e36..8bcc3b52 100644 --- a/docs/writing-helmfile.md +++ b/docs/writing-helmfile.md @@ -11,13 +11,13 @@ One example of how helmfile achieves it is that, `helmfile` fails when you tried That is, the following example let `helmfile` fail when you have no `eventApi.replicas` defined in environment values. ``` -{{ .Environment.Values.eventApi.replicas | default 1 }} +{{ .Values.eventApi.replicas | default 1 }} ``` In case it isn't a mistake and you do want to allow missing keys, use the `getOrNil` template function: ``` -{{ .Environment.Values | getOrNil "eventApi.replicas" }} +{{ .Values | getOrNil "eventApi.replicas" }} ``` This result in printing `