Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/helm: run helm template directly instead of via subprocess #1290

Merged
merged 1 commit into from
May 22, 2024

Conversation

chrisseto
Copy link
Contributor

@chrisseto chrisseto commented May 20, 2024

b705eab pkg/helm: run helm template directly instead of via subprocess

This commit modifies helm.Client.Template to run via depending on Helm as a
library rather than run through a subprocess. This provides a greater degree of
control over the helm execution environment but also reduces the overhead of
running helm template many times.

Note: The actual performance gain of this commit hasn't truly been measured.
The bulk of the time was wasted in deepCopy calls, this commit was required
to appropriately profile the execution of helm template.

@chrisseto chrisseto marked this pull request as draft May 20, 2024 19:19
@chrisseto chrisseto changed the title WIP: pkg/helm: run helm directly instead of via subprocess pkg/helm: run helm template directly instead of via subprocess May 20, 2024
@chrisseto chrisseto force-pushed the chris/p/helm-in-process branch 2 times, most recently from 655f3ac to e4894ad Compare May 20, 2024 20:50
@chrisseto chrisseto marked this pull request as ready for review May 20, 2024 21:08
client.GenerateName = opts.GenerateName
client.Namespace = opts.Namespace
client.ReleaseName = opts.Name
client.Replace = true // Skips "name" checks.
Copy link
Member

Choose a reason for hiding this comment

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

are we sure we want this default value in production?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is borrowed directly from helm itself. helm template needs to run in an isolated environment. Rather than having that logic baked in, they opted to use this as a work around. I'll add a back link and a note saying as much. I could have sworn that I had a few links peppered in there already but looks pretty scant.

This commit modifies helm.Client.Template to run via depending on Helm as a
library rather than run through a subprocess. This provides a greater degree of
control over the helm execution environment but also reduces the overhead of
running `helm template` many times.

Note: The actual performance gain of this commit hasn't truly been measured.
The bulk of the time was wasted in `deepCopy` calls, this commit was required
to appropriately profile the execution of `helm template`.
@RafalKorepta RafalKorepta merged commit d953e51 into main May 22, 2024
9 checks passed
@RafalKorepta RafalKorepta deleted the chris/p/helm-in-process branch May 22, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants