Skip to content

Commit

Permalink
document environment keys refererences to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
David Genest committed Sep 11, 2018
1 parent 29fa346 commit 394b48d
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repositories:
context: kube-context # kube-context (--kube-context)

#default values to set for args along with dedicated keys that can be set by contributers, cli args take precedence overe these
helmDefaults:
helmDefaults:
tillerNamespace: tiller-namespace #dedicated default key for tiller-namespace
kubeContext: kube-context #dedicated default key for kube-context
# additional and global args passed to helm
Expand Down Expand Up @@ -396,7 +396,7 @@ releases:
# snip
{{ end }}
- name: myapp
# snip
# snip
```

## Environment Values
Expand Down Expand Up @@ -424,6 +424,7 @@ releases:

```yaml
domain: prod.example.com
releaseName: prod
```

`values.yaml.gotmpl`
Expand All @@ -435,6 +436,38 @@ domain: {{ .Environment.Values.domain | default "dev.example.com" }}
`helmfile sync` installs `myapp` with the value `domain=dev.example.com`,
whereas `helmfile --environment production sync` installs the app with the value `domain=production.example.com`.

For even more flexibility, you can now use values declared in the `environments:` section in other parts of your helmfiles:

consider:
`default.yaml`

```yaml
domain: dev.example.com
releaseName: dev
```

```yaml
environments:
default:
values:
- default.yaml
production:
values:
- production.yaml # template directives with potential side-effects like `exec` and `readFile` will NOT be executed
- other.yaml.gotmpl # `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
values:
- values.yaml.gotmpl

{{ if eq (.Environment.Values.releaseName "prod" ) }}
# this release would be installed only if selected environment is `production`
- name: production-specific-release
...
{{ end }}
```

## Environment Secrets

Environment Secrets are encrypted versions of `Environment Values`.
Expand Down

0 comments on commit 394b48d

Please sign in to comment.