I have 2 preinstall scripts that should run sequentially. They have obviously different weights The second script must have the first one to finish running. Is there anyway to make helm support this behavior?
And also for bonus point can you make a pre-install hook to block till the object becomes ready?
The scenario is as follows:
You have a database, and an application.
The setup is:
First, you need to set the hook weights properly. E.g:
annotations:
"helm.sh/hook-weight": "5"
Hook weights can be positive or negative numbers but must be represented as strings. When Tiller starts the execution cycle of hooks of a particular kind (ex. the
pre-install
hooks orpost-install
hooks, etc.) it will sort those hooks in ascending order.
According to the Hooks and release lifecycle, by default, the Tiller waits until a hook becomes “Ready” before executing the next ones. The catch is: When dealing with scripts managed by hooks, you need to create the resource as a Job
:
What does it mean to wait until a hook is ready? This depends on the resource declared in the hook. If the resources is a Job kind, Tiller will wait until the job successfully runs to completion. And if the job fails, the release will fail. This is a blocking operation, so the Helm client will pause while the Job is run.
If you want to run jobs that depend on the database or application to be Ready, it's better to use the hooks as post-install
, combined with the --wait
flag. When this flag is set, Tiller will wait until all release resources are deployed and in a ready state and will not run the post-install
hook until they are ready.