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

Use upstream's MergeValues with assets #3010

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

blampe
Copy link
Contributor

@blampe blampe commented May 16, 2024

Followup to my comment here, this removes our custom ValueOpts in favor of upstream's value.Options to handle merging.

Upstream expects to work with files on disk, so we fetch any assets in our provided values and then write them to disk temporarily.

@blampe blampe added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label May 16, 2024
Copy link

Does the PR have any schema changes?

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

@@ -121,7 +122,7 @@ image:
},
want: map[string]interface{}{
"configuration": map[string]any{
"backupStorageLocation": []map[string]any{},
"backupStorageLocation": []any{},
Copy link
Contributor Author

@blampe blampe May 16, 2024

Choose a reason for hiding this comment

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

A subtle (probably inconsequential) difference between the previous MergeValues and upstream's.

Copy link

codecov bot commented May 16, 2024

Codecov Report

Attention: Patch coverage is 65.85366% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 32.29%. Comparing base (675c630) to head (cadae3a).
Report is 1 commits behind head on master.

Files Patch % Lines
provider/pkg/provider/helm/v4/values.go 63.63% 7 Missing and 5 partials ⚠️
provider/pkg/provider/helm/v4/chart.go 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3010   +/-   ##
=======================================
  Coverage   32.29%   32.29%           
=======================================
  Files          69       69           
  Lines        8947     8963   +16     
=======================================
+ Hits         2889     2895    +6     
- Misses       5791     5796    +5     
- Partials      267      272    +5     

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

Copy link
Contributor

@EronWright EronWright left a comment

Choose a reason for hiding this comment

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

Nice!

cmd.addChartPathOptionsFlags()
}

func (cmd *TemplateOrInstallCommand) addValueOptionsFlags() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would still keep addValueOptionsFlags to set defaults on Values and to further resemble:
https://github.com/helm/helm/blob/14d0c13e9eefff5b4a1b511cf50643529692ec94/cmd/helm/flags.go#L45-L51

Comment on lines +116 to +118
// readAssets converts Pulumi values to Helm values, hydrating Asset values
// along the way.
func readAssets(p getter.Providers, a map[string]interface{}) (map[string]interface{}, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like marshalValues is a better name because it isn't just dealing with assets; imagine that resource references were marshaled in some way.

Values: tt.values,
}
p := getter.All(cli.New())
opts, cleanup, err := readValues(p, tt.values, tt.valuesFiles)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use getter.Providers{} for p?

@EronWright
Copy link
Contributor

On one hand, this approach allows us to leverage more of the Helm library, specifically related to loading values files. On the other hand, the need to write out the adhoc values to a file seems a bit contrived. Let's vote on it, in description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants