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

🌱 Reuse the same RESTMapper for cache and client #3632

Merged

Conversation

vincepri
Copy link
Member

Signed-off-by: Vince Prignano vincepri@vmware.com

What this PR does / why we need it:
This PR switches the RESTMapper used in remote cluster caches to use a more efficient delegating cached one. By default NewDynamicRESTMapper calls https://github.com/kubernetes-sigs/controller-runtime/blob/d6829e9c4db802eb4d5703d22c6cd87e8bbf91da/pkg/client/apiutil/dynamicrestmapper.go#L109-L114

which creates a new RESTMapper with the group resources discovered from the client immediately.

Given that for remote clients we don't need to know all the resources available on every client before using them, using a deferred cached client seems the most straightforward way to reduce the amount of memory pressure seen in #3609

/milestone v0.3.10
/assign @ncdc @fabriziopandini

@k8s-ci-robot k8s-ci-robot added this to the v0.3.10 milestone Sep 11, 2020
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 11, 2020
@vincepri
Copy link
Member Author

/test pull-cluster-api-test

@vincepri vincepri force-pushed the delegating-client-tracker-cache branch from 2344104 to e5580ec Compare September 11, 2020 17:13
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 11, 2020
@vincepri vincepri force-pushed the delegating-client-tracker-cache branch from e5580ec to dae14ec Compare September 11, 2020 17:24
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 11, 2020
@vincepri vincepri changed the title 🌱 Use a Deferred (cached) RESTMapper in ClusterCacheTracker 🌱 Reuse the same RESTMapper for cache and client Sep 11, 2020
@vincepri vincepri force-pushed the delegating-client-tracker-cache branch from dae14ec to 0ea893d Compare September 11, 2020 17:28
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 11, 2020
@ncdc
Copy link
Contributor

ncdc commented Sep 11, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 11, 2020
@ncdc
Copy link
Contributor

ncdc commented Sep 11, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ncdc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 11, 2020
@vincepri
Copy link
Member Author

/test pull-cluster-api-e2e

Signed-off-by: Vince Prignano <vincepri@vmware.com>
@vincepri vincepri force-pushed the delegating-client-tracker-cache branch from 0ea893d to 211334d Compare September 11, 2020 19:27
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 11, 2020
@fabriziopandini
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 12, 2020
@k8s-ci-robot k8s-ci-robot merged commit c8b8d0f into kubernetes-sigs:master Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants