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 timeout for Carvel installed package summaries #4607

Merged

Conversation

absoludity
Copy link
Contributor

  • Solution that works with the exception of across namespaces.
  • Adapt solution to cater for requests across namespaces.

Description of the change

I thought this was going to be similar to #4378 but although a similar approach can be taken, the solution is quite different, due to the iteration of package installs (rather than metadata).

It also ended up substantially more complicated for two reasons that I've highlighted in the code with a comment.

Benefits

Response times are approximately 1/6th for fetching installed package summaries (tested locally with 10 installed packages).

Possible drawbacks

Applicable issues

Additional information

Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
@@ -163,7 +163,7 @@ func (s *Server) buildInstalledPackageSummary(pkgInstall *packagingv1alpha1.Pack
IconUrl: iconStringBuilder.String(),
InstalledPackageRef: &corev1.InstalledPackageReference{
Context: &corev1.Context{
Namespace: pkgMetadata.Namespace,
Namespace: pkgInstall.Namespace,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously the package metadata was requested in the same namespace (individually) as the package install, and the aggregate API (remember, not a CR), returns a result with that same namespace, so they were equivalent. Now that we're fetching all package metadatas once (potentially across all namespaces if requested by the user), the pkgMetadata.Namespace might be the global carvel one, rather than the one we're after for the installed package (ie. they can differ now).

@cmoulliard
Copy link

I did a test successfully on TCE 0.11 (= kubernetes 1.23.4 )after doing a build of images using the makefile of this PR
No timeout have been reported :-) @absoludity

Screenshot 2022-04-21 at 17 19 01
Screenshot 2022-04-21 at 17 18 54

@absoludity
Copy link
Contributor Author

I did a test successfully on TCE 0.11 (= kubernetes 1.23.4 )after doing a build of images using the makefile of this PR No timeout have been reported :-) @absoludity

Excellent, thanks for checking @cmoulliard . That's still only a handful of installed apps, but it's definitely much more responsive.

Copy link
Contributor

@antgamdia antgamdia left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for the detailed explanations across the code, really useful for understanding the issue and how you solved it!

versions map[string]*datapackagingv1alpha1.Package
}
pkgDatas := make(map[string]map[string]*pkgMetaAndVersionsData)
for _, pi := range pkgInstalls {
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a slight preference for using the singular name (pkgInstall) instead of acronyms, but not doesn't really matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I do too... I think I initially was having naming issues and thought this would just be used over 2 lines, but it's not. I'll update before landing.

Signed-off-by: Michael Nelson <minelson@vmware.com>
@absoludity absoludity merged commit cfd1578 into vmware-tanzu:main Apr 27, 2022
@absoludity absoludity deleted the 4542-timeout-deployed-apps-carvel branch April 27, 2022 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants