doc: Add a basic example for managfing oneshot jobs

Resolves #49
This commit is contained in:
Yusuke KUOKA 2018-03-26 13:01:40 +09:00
parent 5aa7da98af
commit 9d7c036753
2 changed files with 40 additions and 0 deletions

View File

@ -149,6 +149,7 @@ A few rules to clear up this ambiguity:
- Relative paths referenced on the command line are relative to the current working directory the user is in
For additional context, take a look at [paths examples](PATHS.md)
## Labels Overview
A selector can be used to only target a subset of releases when running helmfile. This is useful for large helmfiles with releases that are logically grouped together.
@ -159,3 +160,7 @@ Multiple labels can be specified using `,` as a separator. A release must match
The `selector` parameter can be specified multiple times. Each parameter is resolved independently so a release that matches any parameter will be used.
`--selector tier=frontend --selector tier=backend` will select all the charts
## Examples
For more examples, see [examples/REAMDME.md](https://github.com/roboll/helmfile/blob/master/examples/README.md).

35
examples/README.md Normal file
View File

@ -0,0 +1,35 @@
# Helmfile practical examples and advanced usages
## Managing oneshot-jobs with Helmfile
In case you want to manage oneshot-jobs like a report generation or a database migration and so on, add a dedicated release spec for the job in `helmfile.yaml` like:
```yaml
repositories:
- name: yourorg
url: https://yourorg.example.com/charts
releases:
- name: dbmigrator
labels:
job: dbmigrator
chart: ./dbmigrator
# DB host, port, and connection opts for the environment
values:
- "deploy/environments/{{ env "RAILS_ENV" }}/values.yaml"
# DB username and password encrypted with helm-secrets(mozilla/sops)
secrets:
- "deploy/environments/{{ env "RAILS_ENV" }}/secrets.yaml"
```
You would then start a database migration job by executing:
```console
# Start a database migration for the prod environment
$ RAILS_ENV=prod helmfile sync --selector job=dbmigrator
# Tail log until you are satisfied
$ kubectl logs -l job=dbmigrator
```
For more context, see [this issue](https://github.com/roboll/helmfile/issues/49).