diff --git a/README.md b/README.md index 68f18e70..aac911b2 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..f6372ce2 --- /dev/null +++ b/examples/README.md @@ -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).