-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
ResettableRESTMapper to make it possible to reset wrapped mappers #105623
ResettableRESTMapper to make it possible to reset wrapped mappers #105623
Conversation
@ash2k: The label(s) In response to this:
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 @yliaog |
71a1ae7
to
496de42
Compare
/retest |
/lgtm |
/assign @deads2k |
496de42
to
de4598d
Compare
@deads2k PTAL |
@seans3 I wonder what can be done to get this merged before 1.23 freeze (November 16th). I'd like to use it in |
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.
For SIG CLI:
/lgtm
/approve |
@@ -519,3 +519,12 @@ func (m *DefaultRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string | |||
} | |||
return mappings, nil | |||
} | |||
|
|||
// MaybeResetRESTMapper calls Reset() on the mapper if it is a ResettableRESTMapper. | |||
func MaybeResetRESTMapper(mapper RESTMapper) bool { |
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.
naive question, it seems the bool
output is never used , is it worth having it?
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.
It's not used at the moment, but may be used in the future, including by users of this library. I'm more than happy to remove it if this will increase chances of the PR getting merged.
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.
no no, I was curious only, wait for the maintainers opinion
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.
let me ping @liggitt
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.
My preference is to not have it.
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.
My preference is to not have it.
Given timing, I'm willing to take the removal of this bool as a followup.
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.
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ash2k, deads2k, seans3, yliaog 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 |
@deads2k Thank you very much! I'll open a followup to remove the return value today (to be merged later). |
What type of PR is this?
/kind cleanup
/sig api-machinery
/sig cli
What this PR does / why we need it:
Having a proper API to reset a REST mapper is useful:
cli-util
uses this functionality via reflection here (see also Bug: apply sets that include both CRD and CR fail when not using a caching RestMapper kubernetes-sigs/cli-utils#421 (comment)).Currently those implementations are fragile as if a mapper is wrapped, it becomes impossible to reset it properly (i.e. reset the delegate).
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: