Interview Prep/Helm/Hooks, Tests & Validation

How do hook weights work?

IntermediateConceptHooks, Tests & Validation
Answer

helm.sh/hook-weight is a string containing an integer (negative allowed). For each hook event, Helm sorts hooks by weight ascending, then by kind, then by name, and runs them in that order, waiting for each to be ready (Jobs: complete) before the next.

"helm.sh/hook-weight": "-5"   # ConfigMap with migration SQL
"helm.sh/hook-weight": "0"    # migration Job that mounts it

It must be quoted: an unquoted number makes the annotation value an integer and the manifest fails validation (annotations must be strings).

All Helm questions Roadmap: Helm

More on Hooks, Tests & Validation