|
| 1 | +--- |
| 2 | +hip: 0019 |
| 3 | +title: "Enable Running Hooks in Parallel" |
| 4 | +authors: [ "Michael Morris <[email protected]>" ] |
| 5 | +created: "2024-06-06" |
| 6 | +type: "feature" |
| 7 | +status: "draft" |
| 8 | +--- |
| 9 | + |
| 10 | +## Abstract |
| 11 | + |
| 12 | +Helm hooks are currently executed serially. In many cases there will be no reason why they cannot be run in parallel. Running hooks in parallel can significantly improve install/upgrade times |
| 13 | + |
| 14 | +## Motivation |
| 15 | + |
| 16 | +Decrease install/upgrade times by executing hooks in parallel |
| 17 | + |
| 18 | +## Specification |
| 19 | + |
| 20 | +Add a new flag to the install, upgrade, rollback and uninstall commands to enable parallel behavior for hook execution. The flag will be of integer type and will allow the user to specify the maximum number of hooks that can be executed in parallel. |
| 21 | + |
| 22 | +The flag shall be optional. If not set or set to "0" or "1", hook execution shall be done serially. If set to a value greater than "1", hook execution shall be done in parallel, subject to not exceeding the given value in the number of hooks executed in parallel. |
| 23 | + |
| 24 | +Only hooks of the same weight shall be executed in parallel. |
| 25 | + |
| 26 | +## Rationale |
| 27 | + |
| 28 | +While it may be desirable to run hooks in parallel, particularly those of the same weight, doing so by default may cause issues for users depending on the existing serial behavior. Therefore it is proposed to keep the existing serial behavior by default and enable parallel behavior through the use of a flag. |
| 29 | + |
| 30 | +Making the flag an integer rather than boolean allows the user to possibility to restrict the number of parallel processes where resource constraints are a concern. |
| 31 | + |
| 32 | +Allowing hooks of different weights to be executed in parallel is probably not consistent with the documented behavior of lower weight hooks being executed before higher weighted hooks and, therefore only hooks of the same weight shall be executed in parallel |
| 33 | + |
| 34 | +## Backwards compatibility |
| 35 | + |
| 36 | +Proposed solution is fully backwards compatible with no changes in default behavior. |
| 37 | + |
| 38 | +## Security implications |
| 39 | + |
| 40 | +None |
| 41 | + |
| 42 | +## How to teach this |
| 43 | + |
| 44 | +Document in command line help and https://helm.sh/docs/topics/charts_hooks/. |
| 45 | + |
| 46 | +## Reference implementation |
| 47 | + |
| 48 | +PR submitted some time ago: https://github.com/helm/helm/pull/11804 |
| 49 | +May need to be updated depending on decisions taken on what is proposed here. |
| 50 | + |
| 51 | +## Rejected ideas |
| 52 | + |
| 53 | +Why certain ideas that were brought while discussing this HIP were not |
| 54 | +ultimately pursued. |
| 55 | + |
| 56 | +## Open issues |
| 57 | + |
| 58 | +|Issue |Proposal|Decision| |
| 59 | +|-----------------------------------------------------------------------------------------|--------|--------| |
| 60 | +|Should we allow hooks to be run in parallel |Yes | | |
| 61 | +|Should the default behaviour continue to be to execute in serial |Yes | | |
| 62 | +|Is there benefit in allowing the user limit the max number of hooks executing in parallel|Yes | | |
| 63 | +|Should only hooks of the same weight be executed in parallel |Yes | | |
| 64 | + |
| 65 | + |
| 66 | +## References |
| 67 | + |
| 68 | +There exists an older closed HIP on hook parallelism, but its focus was on test hooks: https://github.com/helm/community/pull/165 |
0 commit comments