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

🐛 Clean restmapper cache if a version is notFound #2663

Conversation

g-gaston
Copy link
Contributor

@g-gaston g-gaston commented Jan 24, 2024

This avoids:

  • Extra calls to https://host/apis/<group>/<version> when a version seen before and cached in apiGroups is deleted or marked as not served.
  • Returnning a valid mapping for a cached version that is deleted or not served anymore.

I would like backport this fix to v0.16 (or at version of it since it won't apply cleanly). It would help us solve this issue in cluster-api kubernetes-sigs/cluster-api#10032

This avoids:
- Extra calls to https://host/apis/<group>/<version> when a version seen
  before and cached in apiGroups is deleted or marked as not served.
- Returnning a valid mapping for a cached version that is deleted or not
  served anymore.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 24, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 24, 2024
@g-gaston
Copy link
Contributor Author

cc @fabriziopandini @sbueringer

@g-gaston
Copy link
Contributor Author

/retest

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Nice work, thx!

pkg/client/apiutil/restmapper.go Outdated Show resolved Hide resolved
pkg/client/apiutil/restmapper.go Outdated Show resolved Hide resolved
pkg/client/apiutil/restmapper.go Show resolved Hide resolved
pkg/client/apiutil/restmapper.go Show resolved Hide resolved
pkg/client/apiutil/restmapper_test.go Outdated Show resolved Hide resolved
pkg/client/apiutil/restmapper_test.go Show resolved Hide resolved
pkg/client/apiutil/restmapper_test.go Outdated Show resolved Hide resolved
pkg/client/apiutil/restmapper_test.go Outdated Show resolved Hide resolved
pkg/client/apiutil/restmapper_test.go Show resolved Hide resolved
@sbueringer
Copy link
Member

Thank you very much!

/lgtm

/assign @alvaroaleman @vincepri
PTAL :)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 7, 2024
@sbueringer sbueringer added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Feb 7, 2024
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

one minor comment, rest lgtm

pkg/client/apiutil/restmapper.go Show resolved Hide resolved
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: g-gaston, vincepri

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 Feb 7, 2024
@k8s-ci-robot k8s-ci-robot merged commit 7032a3c into kubernetes-sigs:main Feb 7, 2024
9 checks passed
@sbueringer
Copy link
Member

As mentioned in the issue. We would like to backport this into v0.17 and v0.16. v0.16 requires a manual backport. Let's see if we get lucky with 0.17

/cherry-pick release-0.17

@k8s-infra-cherrypick-robot

@sbueringer: cannot checkout release-0.17: error checking out "release-0.17": exit status 1 error: pathspec 'release-0.17' did not match any file(s) known to git

In response to this:

As mentioned in the issue. We would like to backport this into v0.17 and v0.16. v0.16 requires a manual backport. Let's see if we get lucky with 0.17

/cherry-pick release-0.17

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sbueringer
Copy link
Member

/cherry-pick release-0.17

@k8s-infra-cherrypick-robot

@sbueringer: cannot checkout release-0.17: error checking out "release-0.17": exit status 1 error: pathspec 'release-0.17' did not match any file(s) known to git

In response to this:

/cherry-pick release-0.17

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sbueringer
Copy link
Member

Pushed the release-0.17 branch based on v0.17.0

@sbueringer
Copy link
Member

/cherry-pick release-0.17

@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #2676

In response to this:

/cherry-pick release-0.17

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants