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

[Helm3] Return chart version and metadata when listing #1441

Merged
merged 6 commits into from Jan 14, 2020
Merged

Conversation

andresmgot
Copy link
Contributor

Description of the change

When listing apps, the expected result (AppOverview) is expected to have the chart version and the chart metadata included in the response. This is used to build hte AppList view, showing updates if necessary.

See the tiller-proxy implementation:

https://github.com/kubeapps/kubeapps/blob/8bb060e15ad315c1561d0133cbd30827d292dcd2/pkg/proxy/proxy.go#L216

Benefits

Before this change:
Screenshot from 2020-01-13 13-42-07

After the change:

Screenshot from 2020-01-13 13-36-11

Additional information

cc/ @latiif @SimonAlling

Copy link
Contributor

@SimonAlling SimonAlling left a comment

Choose a reason for hiding this comment

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

Nice spot and good job! I have one semi-large and two small remarks; see inline comments.

Comment on lines 186 to 197
ChartMetadata: chartv1.Metadata{
Name: r.Chart.Metadata.Name,
Home: r.Chart.Metadata.Home,
Sources: r.Chart.Metadata.Sources,
Version: r.Chart.Metadata.Version,
Description: r.Chart.Metadata.Description,
Keywords: r.Chart.Metadata.Keywords,
Icon: r.Chart.Metadata.Icon,
ApiVersion: r.Chart.Metadata.APIVersion,
Tags: r.Chart.Metadata.Tags,
AppVersion: r.Chart.Metadata.AppVersion,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could and should re-use compatibleMetadata. I managed to make it typecheck with little effort at least.

This would of course mean said function would have to be moved to somewhere in pkg. At closer thought, maybe it makes more sense to put the entire dashboardcompat.go in pkg. It really is more of a package than a command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. At the end we have a package to convert releases from one format to the other so we can reuse it.

Comment on lines 247 to 278
Version: "2",
Version: "1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change trivially correct? If not, maybe add a note in the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The version is irrelevant here but I can change the number so the title still applies 👍

Comment on lines -291 to +334
Version: "2",
Version: "1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change trivially correct? If not, maybe add a note in the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case it's not needed (the version is not relevant either)

Namespace: r.Namespace,
Status: r.Info.Status.String(),
func appOverviewFromRelease(r *release.Release) (proxy.AppOverview, error) {
releaseHelm2, err := helm3to2.Convert(*r)
Copy link
Contributor

Choose a reason for hiding this comment

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

Converting the release to a helm 2 release seems unnecessary (it's only used for the maintainers) and also the only reason for requiring an error in the signature of this function?

That is, if helm3to2.ConvertMaintainers(r.Chart.Metadata.Maintainers) could be used below instead (ie. just making compatableMaintainers public), then we don't need to handle the error at all (nor convert the whole release).

Fine either way, just a thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, we need the whole metadata (not just the maintainers) so the function to expose would be compatibleMetadata but yes, we could do that. I wanted to to keep the methods exposed by the compatibility package as minimum as possible but there is not a good reason for not exposing the metadata conversion.

Copy link
Contributor

Choose a reason for hiding this comment

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

I for one see no problem with exporting helm3to2 functions at will. They're all supposed to be pure and reusable anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

Although one must keep in mind that some of the type signatures in helm3to2 are essentially lies, since it's impossible in general to write a function from Helm 2 releases to Helm 3 releases.

@andresmgot andresmgot merged commit 9c2df18 into master Jan 14, 2020
@absoludity absoludity deleted the listVersions branch January 15, 2020 00:58
@SimonAlling SimonAlling mentioned this pull request Jan 22, 2020
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.

None yet

3 participants