Merge pull request #74 from mumoshu/oneshot-job-example
doc: Add a basic example for managing oneshot jobs
This commit is contained in:
		
						commit
						70b1e8ae1f
					
				| 
						 | 
					@ -150,6 +150,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
 | 
					- 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)
 | 
					For additional context, take a look at [paths examples](PATHS.md)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Labels Overview
 | 
					## 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.
 | 
					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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,3 +161,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. 
 | 
					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
 | 
					`--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).
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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).
 | 
				
			||||||
		Loading…
	
		Reference in New Issue