feat: Add HELM_GIT_CHART_CACHE_STRATEGY
variable to customize chart caching
#319
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #318
This MR allows cache customization via
HELM_GIT_CHART_CACHE_STRATEGY
variable.The default behavior causes N^2 builds if package=1 and you deploy multiple chats from the same repo.
There are 2 ways to fix it:
If you set
HELM_GIT_CHART_CACHE_STRATEGY
torepo
, then every chart will reuse the same cache from the repo. That's done by usinghelm_repo_uri
as the source for request_hash.If you set
HELM_GIT_CHART_CACHE_STRATEGY
tochart
, then every chart will have only single chart packaged, not all repository.Other values preserve the old behavior.
I'm not changing the default behavior since it can break existing setups and requires major version update according to SemVer.
One thing to consider is if we really need both strategies. If no, then we can only leave 1 and change the variable to boolean one.
In my opinion "repo" strategy is the right way to cache in all cases, but I don't have the bigger picture of how the plugin is used by others.
Tests cover both of the strategies usage.
For repo we ensure that cache is reused if we clone repo first and then try to fetch a chart.
For chart we ensure that without strategy all charts are built (> 1), with it turned on only a single one.