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).
More on Hooks, Tests & Validation
What are Helm hooks?BeginnerList all hook types and when they run.BeginnerWhat are the hook delete policies?IntermediateAre hook resources part of the release? What happens on uninstall?IntermediateHow does Helm decide a hook is "done"?AdvancedWhy is running a migration as a `pre-install` hook often a mistake?Advanced