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

⚠️ Inteceptor: Unify Client and Subresource Client #2306

Merged

Conversation

alvaroaleman
Copy link
Member

@alvaroaleman alvaroaleman commented May 7, 2023

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.

/cc @vincepri @sbueringer @ludydoo

@k8s-ci-robot
Copy link
Contributor

@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:

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.

/cc @vincepri @sbueringer @ludydoo

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 7, 2023
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.
@alvaroaleman alvaroaleman added this to the v0.15.x milestone May 7, 2023
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented May 7, 2023

@alvaroaleman: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-controller-runtime-apidiff 6ca0111 link false /test pull-controller-runtime-apidiff

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.

@ludydoo
Copy link
Contributor

ludydoo commented May 8, 2023

That looks much simpler indeed

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.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 8, 2023
@k8s-ci-robot
Copy link
Contributor

[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:
  • OWNERS [alvaroaleman,vincepri]

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 merged commit 955306a into kubernetes-sigs:main May 8, 2023
11 of 12 checks passed
@sbueringer
Copy link
Member

/lgtm

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants