-
Notifications
You must be signed in to change notification settings - Fork 39.4k
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
Move ResourceQuota admission to k8s.io/apiserver lib #93537
Move ResourceQuota admission to k8s.io/apiserver lib #93537
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. |
Welcome @timuthy! |
Hi @timuthy. Thanks for your PR. I'm waiting for a kubernetes 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. |
fd2f272
to
4b8e4f8
Compare
4b8e4f8
to
a804727
Compare
a804727
to
90b6b0e
Compare
limitations under the License. | ||
*/ | ||
|
||
package resourcequota |
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.
is this file moved from other place? it shows as an add here, which makes it hard to see the diff
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.
This file was indeed added because previously, the LRU lookup was tested in /kubernetes/plugin/pkg/admission/resourcequota/admission_test.go but due to the move out and the inaccessibility of the struct quotaAccessor
, I added the LRU lookup test case to this new test file.
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.
in the admission_test.go, the test case is TestAdmitPodInNamespaceWithoutQuota? what about adding the access to quotaAccessor just for the testing purpose? then you may keep the test case there, instead of adding a new one here.
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. so this is testing the cache hit case, probably better to add a cache miss case too.
staging/src/k8s.io/apiserver/pkg/admission/plugin/resourcequota/admission_test.go
Show resolved
Hide resolved
it's fine to move to staging. trying to understand how is the library going to be used? in a standalone extension apiserver? |
Yes, in an extension apiserver. You can have a look at this RP if you are interested in more details. After the move out, this PR can only refer to common parts in |
4c5c237
to
7b638fc
Compare
/retest |
staging/src/k8s.io/apiserver/pkg/admission/plugin/resourcequota/admission_test.go
Show resolved
Hide resolved
limitations under the License. | ||
*/ | ||
|
||
package resourcequota |
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.
in the admission_test.go, the test case is TestAdmitPodInNamespaceWithoutQuota? what about adding the access to quotaAccessor just for the testing purpose? then you may keep the test case there, instead of adding a new one here.
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. that makes sense.
I think one other way to do it is to add a method SetExternalLookupCache (similar to the method SetExternalKubeClientSet, or SetExternalKubeInformerFactory). But i think it's fine to test the lookupCache separately (as you currently do).
limitations under the License. | ||
*/ | ||
|
||
package resourcequota |
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. so this is testing the cache hit case, probably better to add a cache miss case too.
thanks for the pr. /lgtm |
/retest |
78c4ae4
to
cc0b86f
Compare
Changes were needed for rebasing. |
/lgtm |
/milestone v1.20 |
@yliaog: You must be a member of the kubernetes/milestone-maintainers GitHub team to set the milestone. If you believe you should be able to issue the /milestone command, please contact your and have them propose you as an additional delegate for this responsibility. 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. |
@yliaog thanks for you review. Do you have an idea how we can proceed with this PR? |
/assign @lavalamp |
/approve Deferring to @yliaog :) |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lavalamp, timuthy 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 |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This PR moves the generic parts of the ResourceQuota admission plugin to
/staging/src/k8s.io/apiserver
, so that Extension API server can use the admission plugin without the necessity of having a dependency tok8s.io/kubernetes
. It follows the same principle which is already in place for the webhook admission plugin and is a consequent enhancement of enabling custom or extended resource, tackled by #72384.Special notes for your reviewer:
plugin/pkg/admission/resourcequota/admission_test.go
remains as it contains core related test cases, only generic parts were moved tostaging/src/k8s.io/apiserver/pkg/admission/plugin/resourcequota/admission_test.go
.staging/src/k8s.io/apiserver/pkg/admission/plugin/resourcequota/resource_access_test.go
was added to cover the LRUCacheLookup use case.Does this PR introduce a user-facing change?: