-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
⚠️ Inteceptor: Unify Client and Subresource Client #2306
⚠️ Inteceptor: Unify Client and Subresource Client #2306
Conversation
@alvaroaleman: GitHub didn't allow me to request PR reviews from the following users: ludydoo. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. 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. |
87b7b56
to
611ea97
Compare
At the moment, the inteceptor has two different constructors for a client interceptor and a subresource interceptor. This means that in order to intercept subresource requests, one has to set up a normal interceptor, set the `SubResource` func to return a subresource interceptor and then configure the desired behavior on the subresource interceptor. This is needlessly complex, unify the two and add the parameters for the subresource funcs into the top-level `Funcs` struct. Also, change the signature of the subresource funcs to contain a `Client` instead of a `SubResourceClient` and the name of the subresource. This makes more sense, as for example if someone were to implement `Scale` this way, they likely want to check if the object to be scaled actually exists in the client and then modify it.
611ea97
to
6ca0111
Compare
@alvaroaleman: 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. |
That looks much simpler indeed |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, 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 |
/lgtm |
At the moment, the inteceptor has two different constructors for a client interceptor and a subresource interceptor. This means that in order to intercept subresource requests, one has to set up a normal interceptor, set the
SubResource
func to return a subresource interceptor and then configure the desired behavior on the subresource interceptor.This is needlessly complex, unify the two and add the parameters for the subresource funcs into the top-level
Funcs
struct.Also, change the signature of the subresource funcs to contain a
Client
instead of a
SubResourceClient
and the name of the subresource. Thismakes more sense, as for example if someone were to implement
Scale
this way, they likely want to check if the object to be scaled actually
exists in the client and then modify it.
/cc @vincepri @sbueringer @ludydoo