-
Notifications
You must be signed in to change notification settings - Fork 164
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
Fix install and upgrade applying subchart CRDs when condition is false #1123
Open
matheuscscp
wants to merge
8
commits into
main
Choose a base branch
from
remove-subchart-crd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
232947a
Fix install and upgrade applying subchart CRDs when condition is false
matheuscscp 0f909d6
Add test for CRDs not applied when condition is false
matheuscscp 85c1c7b
Add more tests
matheuscscp f250d5d
Add test for imported values
matheuscscp f708e0d
Add comment about helm bug
matheuscscp 0987c72
Add test for upgrade
matheuscscp da74708
Move common CRDs test chart to testutil package
matheuscscp 667a0f8
Fix upgrade test keeping CRD from previous test
matheuscscp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems I have encountered a related bug for the upgrade in our code. But it could be debatable considering how we pass values in helm.
While reading the upstream upgrade code that calls
ProcessDependenciesWithMerge()
, I noticed that unlike the install code, it reuses the value from the previous release, refer https://github.com/helm/helm/blob/v3.16.3/pkg/action/upgrade.go#L240-L246. This made me wonder about the scenario where initially, the dependency condition evaluates to false, no subchart CRD gets installed. But in the next upgrade, if the same values are not explicitly set, would it result in a different result? I tried this scenario with helm CLI and helm-controller and saw different results.I created a chart in which the default values.yaml doesn't have the value that determines the chart dependency condition. The dependencies in Chart.yaml has:
But
mysubchart.enabled
is not set in the default values.yaml file.While installing, I passed the value explicitly to disable the subchart:
$ helm install full-coral ./mychart/ --set 'mysubchart.enabled=false'
After installing the chart, when I query the values of the release, I get:
Then I run upgrade:
$ helm upgrade full-coral ./mychart
And see the values from the first release version still present:
And the subchart CRD has not been installed.
Trying the same scenario with HC.
Setting the values in HR:
After first install, querying the values results in:
Subchart CRD is not installed.
Removing the
mysubchart
value from HR and upgrading results in the subchart CRD getting installed and querying the values:Even if I pass
-a
to see all the values, there are other default values but there's nomysubchart
value present.The way values are used in HR, removing the values may not be something users are likely to do, but this shows a difference in behavior. Helm-controller doesn't reuse the values from the previous release if no values are explicitly passed during upgrade. This may be a separate issue as a whole, but applying the same theory of value reuse in upgrade to what this PR is trying to address, it still seems like a bug. The
ProcessDependenciesWithMerge()
call for apply CRD should receive the reused values, like the upstream upgrade does, to prevent subchart CRDs from getting installed.