-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
⚠️ DynamicRestMapper: return NoMatchError when resource doesn't exist #1151
⚠️ DynamicRestMapper: return NoMatchError when resource doesn't exist #1151
Conversation
Hi @timebertt. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/assign @droot |
/assign @DirectXMan12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like the general concept. Left a comment re: your question.
@DirectXMan12 WDYT about my comment? |
@timebertt can we retitle the PR to clarify the problem its solving rather than implementation details (something like "DynamicRestMapper: Return NoMatchError when resource type doesn't exist") ? |
/title DynamicRestMapper: return NoMatchError when resource doesn't exist Any thought on the compatability story, @alvaroaleman? |
Pinging @alvaroaleman @DirectXMan12 |
c486b65
to
faaa991
Compare
I made this PR backwards-compatible by deprecating Can we now proceed with the PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
/milestone v0.7.x |
faaa991
to
93a5448
Compare
Expect(callWithOther()).To(Succeed()) | ||
Expect(callWithTarget()).To(Succeed()) | ||
}) | ||
Expect(callWithOther()).To(beNoMatchError()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this fail on the first attempt now and only works on the second?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
93a5448
to
b8e24db
Compare
/retest |
@timebertt: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
@alvaroaleman @vincepri Thanks for your feedback. Makes sense to me. |
How can I make |
You can't, because its a breaking change. The job is optional though. /lgtm Thanks for your work! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, timebertt 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 |
Ah, got it. |
Fixes #1120
This PR fixes the DynamicRESTMapper's behaviour when it is rate limited:
Instead of returning
ErrRateLimited
, it now directly returns themeta.NoKindMatchError
/meta.NoResourceMatchError
given by the underlying mapper. This way, existing controller code usingmeta.IsNoMatchError
works as expected also in the case when the RESTMapper is rate limited.This is breaking⚠️ because:
DynamicRESTMapper
does now return aNoKindMatchError
/NoResourceMatchError
instead ofErrRateLimited
in case the resource doesn't exist and it was rate limitedErrRateLimited
andDelayIfRateLimited
are removed, as they aren't needed anymoreAdditional notes:
The given rate limit can now be seen as an agreement on how often the mapper should refresh its cache (at max). So if the limit is reached, it basically means, we have refreshed often enough (met the contract) and we can safely rely on the cache and directly return the error.
I improved the tests a bit along the way, to ensure all cases are properly tested and made them a bit faster.