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

kapp-controller plugin handles missing metadata. #4527

Merged
merged 1 commit into from
Mar 30, 2022

Conversation

absoludity
Copy link
Contributor

Signed-off-by: Michael Nelson minelson@vmware.com

Description of the change

While helping @cmoulliard debug an issue he was seeing running Kubeapps with carvel support and the TAP 1.0.2 repo, we noticed that the repo itself appears to have invalid data (missing metadata for some packages). Running this locally myself, I would see the error in the UI:

An error occurred while fetching the catalog: Invalid GetAvailablePackageSummaries response from the plugin kapp_controller.packages: rpc error: code = Internal desc = unexpected order for kapp-controller packages, expected "cnrs.tanzu.vmware.com", found "cert-manager.tanzu.vmware.com".

This is because our kapp-controller plugin was asserting that there was always one PackageMetadata for any package's refName. It turns out that sometimes invalid repositories get published, as seemed to be the case with the TAP 1.0.2 repo.

This change removes the assumption in our plugin, so instead we'll log a message, but skip a package that doesn't have a corresponding package metadata.

As a result, I can then see the TAP catalog:

tap-catalog

and verify in the logs of our API service that it notes the correct missing package metadatas:

I0329 23:58:55.289368       1 packages.go:59] +core GetAvailablePackageSummaries (cluster="default", namespace="tanzu")
I0329 23:58:55.289399       1 server_ctrl_packages.go:38] +kapp-controller GetAvailablePackageSummaries (cluster="default", namespace="tanzu")
E0329 23:58:55.542709       1 server_ctrl_packages.go:103] Package "cert-manager.tanzu.vmware.com" did not have a corresponding metadata
E0329 23:58:55.542726       1 server_ctrl_packages.go:103] Package "contour.tanzu.vmware.com" did not have a corresponding metadata
I0329 23:58:55.630619       1 server.go:59] OK 341.253214ms /kubeappsapis.core.packages.v1alpha1.PackagesService/GetAvailablePackageSummaries

Benefits

Kubeapps can still present the valid packages from a repository, even when there are some invalid ones.

Possible drawbacks

Applicable issues

Additional information

Signed-off-by: Michael Nelson <minelson@vmware.com>
@castelblanque
Copy link
Collaborator

Great, now Kubeapps is capable of handling invalid repos.
Thanks!

I'm wondering if, for the future, it would be a nice feature addition to show somewhere in the UI the invalid packages info. So that the user knows about those "lost" packages. I mean, instead only logging the failing packages in output. In this way, the user would see that the package is in the repo, but incomplete and unable to be installed for some reason.

@absoludity
Copy link
Contributor Author

Great, now Kubeapps is capable of handling invalid repos. Thanks!

I'm wondering if, for the future, it would be a nice feature addition to show somewhere in the UI the invalid packages info. So that the user knows about those "lost" packages. I mean, instead only logging the failing packages in output. In this way, the user would see that the package is in the repo, but incomplete and unable to be installed for some reason.

Yeah, Charles mentioned something similar. Perhaps, though I tend to try to replicate what the CLI does, and when checking the code, it looks like the tanzu CLI will just not show packages that don't have an associated metadata, so happy with that for now.

@absoludity absoludity merged commit 03cc127 into vmware-tanzu:main Mar 30, 2022
@absoludity absoludity deleted the 4524-invalid-repo-handling branch March 30, 2022 07:32
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.

No packages are displayed within the console if we use the TAP 1.0.2 packages repository
2 participants