Skip to content

ref(helm): sort hooks by kind - #7499

Merged
bacongobbler merged 2 commits into
helm:masterfrom
bacongobbler:fix-7416
Mar 24, 2020
Merged

bacongobbler merged 2 commits into
helm:masterfrom
bacongobbler:fix-7416

Conversation

@bacongobbler

Copy link
Copy Markdown
Member

supercedes #7432, DRYing up a ton of code and reverting to an in-place sort for sortManifestsByKind, preventing a ton of extra memory allocation.

sortManifestsByKind passes manifests by value, so it receives a copy of the input. Order is preserved. I added a test to confirm this.

closes #7416

Use the same install order for hooks as for normal resources (non-hooks) for hooks with equal weight.
This makes resource handling more consistent and helps, when there are hook consisting of several resources like e.g. a service account and a job using this service account.

The sort functions are changed from an in place search to an out of place sort to avoid inout parameters.

Closes #7416.

Signed-off-by: Daniel Strobusch <[email protected]>
@helm-bot helm-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 30, 2020
@bacongobbler bacongobbler added this to the 3.1.0 milestone Jan 30, 2020
@dastrobu

Copy link
Copy Markdown
Contributor

Nice cleanup @bacongobbler!
I would suggest to rename the functions

manifestsSortedByKind -> sortManifestsByKind
hooksSortedByKind -> sortHooksByKind

since sorted usually refers to an out of place sort and sort to in place sort. This might make the behavior of the functions clearer from the function names.

Comment thread pkg/releaseutil/kind_sorter.go Resolved
@bacongobbler bacongobbler modified the milestones: 3.1.0, 3.2.0 Feb 7, 2020
@bacongobbler bacongobbler changed the title fix(helm): sort hooks by kind ref(helm): sort hooks by kind Feb 7, 2020

@mattfarina mattfarina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

respect sort order for equal weight hooks

4 participants