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

Fix: Chart v4 fails on update #3046

Merged
merged 3 commits into from
Jun 4, 2024
Merged

Fix: Chart v4 fails on update #3046

merged 3 commits into from
Jun 4, 2024

Conversation

EronWright
Copy link
Contributor

@EronWright EronWright commented Jun 4, 2024

Proposed changes

This PR fixes a problem with how Chart v4 uses the Helm library. The design goal is to allow for connectivity during template rendering, to support the lookup function (see helm/helm#9426) and to provide an accurate Capabilities object. Unfortunately we were slightly too aggressive and caused some of Helm's "non-template" code to execute.

This fix works by turning off the helm template --validation flag, so that the internal ClientOnly flag is true thus avoiding this block of code that causes the unexpected error. A side-effect of ClientOnly being true is that the capabilities aren't automatically set, and so we set them using the provider's kube client (akin to using --kube-version).

Detailed changes:

  • (chart.go) use ClientOnly mode, set KubeVersion and APIVersions
  • (tool.go) remove redundant KubeVersion and ExtraAPIs
  • (testdata/reference) add a version check
  • (chart_test.go) unit tests for .Capabilities
  • integration test to install cert-manager

Related issues (optional)

Closes #3045

@EronWright EronWright self-assigned this Jun 4, 2024
@EronWright EronWright requested a review from rquitales June 4, 2024 17:26
Copy link

github-actions bot commented Jun 4, 2024

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link
Contributor

@rquitales rquitales left a comment

Choose a reason for hiding this comment

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

First pass on this PR looks reasonable. 👍

Comment on lines +182 to +184
cmd.DisableOpenAPIValidation = true
cmd.Validate = false
cmd.ClientOnly = true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Emulates:

helm template --dry-run=server --validate=false --disable-openapi-validation \
  --kube-version $VERSION --api-versions $APIVERSIONS

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

Attention: Patch coverage is 68.18182% with 7 lines in your changes missing coverage. Please review.

Project coverage is 36.77%. Comparing base (4fddc20) to head (d96468b).

Files Patch % Lines
provider/pkg/provider/helm/v4/chart.go 68.18% 4 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3046      +/-   ##
==========================================
+ Coverage   36.67%   36.77%   +0.09%     
==========================================
  Files          71       71              
  Lines        9249     9262      +13     
==========================================
+ Hits         3392     3406      +14     
+ Misses       5520     5518       -2     
- Partials      337      338       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@EronWright EronWright enabled auto-merge (squash) June 4, 2024 18:11
@EronWright EronWright merged commit 1100978 into master Jun 4, 2024
17 of 18 checks passed
@EronWright EronWright deleted the issue-3045 branch June 4, 2024 18:30
rquitales added a commit that referenced this pull request Jun 4, 2024
### Proposed changes
 
This PR explicitly sets the `opttest.SkipInstall()` option for our yaml
tests. It is observed that the test framework/automation API is unable
successfully run `pulumi install` prior to the other pulumi operations.
This error was hit in the presubmit for
#3046, but went
unnoticed in the past due to the `TestTerraformConvert` installing the
right plugins before the other tests hit the installation step.

Manual validation:

- Deleted the local `~/.pulumi/plugin` folder
- Run the tests without the changes and notice the test errors
- Run the tests with the changes here and they pass

### Related issues (optional)

Fixes: #3048
EronWright added a commit that referenced this pull request Jun 4, 2024
### Added
- Kustomize Directory v2 resource
(#3036)
- CustomResource for Java SDK
(#3020)

### Changed
- Update to pulumi-java v0.12.0
(#3025)

### Fixed
- Fixed Chart v4 fails on update
(#3046)
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.

Chart v4 fails on update
3 participants