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

compute version field in Check, use 3-way diff #2672

Merged
merged 6 commits into from
Nov 27, 2023
Merged

Conversation

EronWright
Copy link
Contributor

@EronWright EronWright commented Nov 17, 2023

Proposed changes

This PR stabilizes Helm upgrades by abandoning the use of checksums (which was added in v4.5.0, see PR), while allowing for local chart change detection via the chart's version number. That is, the user is now expected to touch the chart's version to compel Pulumi to roll out the change.

Implementation-wise, this is accomplished by resolving the version property during Check. The checked input reflects the goal version, and if the goal has changed, then Diff detects this in the natural way and effects an upgrade. Check no longer uses helm template to render the chart, it simply resolves the chart version.

The diff logic is improved here to use a three-way merge, to be able to detect drift in the actual Helm release.

The refresh logic is improved to not mutate inputs (as was done in the past to help with drift detection).

Demonstration

This video clip demonstrates:

  1. An initial deployment using the current version of the provider.
  2. A repro of the issue that Pulumi sees a spurious change to checksum.
  3. Upon building the new provider, the spurious change is gone because the checksum property is gone and the diff logic for version property compares new input to old state.
  4. Upon a change to the local chart's version, Pulumi sees a change to version.
  5. Drift detection, by using helm upgrade and then pulumi refresh such that Pulumi sees the change.

Note that the demo app doesn't set the version property, it relies on the new logic in Check to resolve the version.

issue-2649-low.mov

Summary of Old/New Behavior

Old:

Action Op Raw Input Checked Old (Input) Old (State) New (State)
Deploy 3.47.1 Check ~3.47.0 ~3.47.0 - - -
  Create - ~3.47.0 - - 3.47.1
Upgrade to 3.47.2 Check ~3.47.0 ~3.47.0 - - -
  Diff - ~3.47.0 ~3.47.0 3.47.1 -
  Update - - - - -
Drift to 3.47.3 Read - 3.47.3 - - 3.47.3
  Check ~3.47.0 ~3.47.0 3.47.3 - -
  Diff - ~3.47.0 3.47.3 3.47.3 -

New:

Action Op Raw Input Checked Old (Input) Old (State) New (State)
Deploy 3.47.1 Check ~3.47.0 3.47.1 - - -
  Create - 3.47.1 - - 3.47.1
Upgrade to 3.47.2 Check ~3.47.0 3.47.2 - - -
  Diff - 3.47.2 3.47.1 3.47.1 -
  Update - 3.47.2 3.47.1 3.47.1 3.47.2
Drift to 3.47.3 Read - 3.47.2 - - 3.47.3
  Check ~3.47.0 3.47.2 3.47.2 - -
  Diff - 3.47.2 3.47.2 3.47.3 -

Related issues (optional)

Closes #2649

Copy link

Does the PR have any schema changes?

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

@EronWright EronWright marked this pull request as ready for review November 20, 2023 01:00
@EronWright EronWright requested a review from a team November 20, 2023 05:41
@EronWright EronWright changed the title compute version field in Check compute version field in Check, use 3-way diff Nov 20, 2023
provider/pkg/provider/helm_release.go Show resolved Hide resolved
provider/pkg/provider/helm_release.go Show resolved Hide resolved
provider/pkg/provider/helm_release.go Show resolved Hide resolved
provider/pkg/provider/helm_release.go Outdated Show resolved Hide resolved
provider/pkg/provider/helm_release.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Attention: 49 lines in your changes are missing coverage. Please review.

Comparison is base (9078fd3) 18.52% compared to head (5545d9b) 18.42%.

Files Patch % Lines
provider/pkg/provider/helm_release.go 0.00% 49 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2672      +/-   ##
==========================================
- Coverage   18.52%   18.42%   -0.11%     
==========================================
  Files          47       47              
  Lines        9643     9587      -56     
==========================================
- Hits         1786     1766      -20     
+ Misses       7753     7722      -31     
+ Partials      104       99       -5     

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

@EronWright EronWright enabled auto-merge (squash) November 27, 2023 21:04
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.

LGTM

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.

Helm Chart Trigging a Diff on Each Run for Checksum Changes
2 participants