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

New K8s clients provider for Kapp and Resources plugins #5405

Merged
merged 6 commits into from
Sep 28, 2022

Conversation

castelblanque
Copy link
Collaborator

@castelblanque castelblanque commented Sep 28, 2022

Description of the change

3rd and final PR related to K8s Go clients optimization (#5358 and #5379)
In this one, Kapp and Resources plugins code have been refactored. Previously used client getter has been removed.
Now all plugins use the same client getter/provider.

Instead of creating two clients most of the times and ignoring one:

typedClient, _, err := s.GetClients(ctx, cluster)
...
_, dynClient, err := s.GetClients(ctx, cluster)

now each one can be created independently:

typedClient, err := s.clientGetter.Typed(ctx, cluster)
...
dynClient, err := s.clientGetter.Dynamic(ctx, cluster)

Benefits

  • Faster creation of K8s clients in Go. E.g. No need to create the dynamic client when only the typed one is necessary.
  • Unified management of K8s clients in all plugins.

Possible drawbacks

N/A

Applicable issues

Additional information

There is still lag when creating a dynamic client and using pinniped-proxy. This might be related to K8s APIs throttling from Rust.

Rafa Castelblanque added 4 commits September 22, 2022 16:50
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
@castelblanque castelblanque changed the title K8s client go 2 New clients provider for Kapp and Resources plugins Sep 28, 2022
@netlify
Copy link

netlify bot commented Sep 28, 2022

Deploy Preview for kubeapps-dev canceled.

Name Link
🔨 Latest commit 4ebb628
🔍 Latest deploy log https://app.netlify.com/sites/kubeapps-dev/deploys/633444ce9cf0070009e8a921

@castelblanque castelblanque changed the title New clients provider for Kapp and Resources plugins New K8s clients provider for Kapp and Resources plugins Sep 28, 2022
@castelblanque castelblanque marked this pull request as draft September 28, 2022 12:34
Rafa Castelblanque added 2 commits September 28, 2022 14:40
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
@castelblanque castelblanque marked this pull request as ready for review September 28, 2022 13:50
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 fanning the change out of every plugin!

@castelblanque castelblanque merged commit 2f04269 into main Sep 28, 2022
@castelblanque castelblanque deleted the k8s-client-go-2 branch September 28, 2022 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend usage of new clients provider in Kubeapps APIs Requests for catalog delayed
3 participants