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
support namespace indexer for namespaced resources like pods #121906
support namespace indexer for namespaced resources like pods #121906
Conversation
|
Welcome @ahutsunshine! |
Hi @ahutsunshine. 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. |
If we need to add a feature gate, kep is a good place to start, but before we do that, I want to know if we really need it |
@HirazawaUi We do a benchmark and see perfect performance to improve latency&cpu&memory. I proposal this because listing the pods across various namespaces significantly impacts CPU and memory resources and causes the incidents in our production. You can check more #120778 and we can discuss the feature/enhancements. |
Thank you for your PR. Please sign the CLA to proceed further, thanks. |
The namespace indexer only adds to some in-tree resources. Could this work for custom resources as well? |
Also, pinging for CLA. |
@wojtek-t @halfcrazy pls go ahead to review |
0eacdd6
to
421519d
Compare
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.
Just one minor nit - other than that LGTM.
staging/src/k8s.io/apiserver/pkg/storage/selection_predicate.go
Outdated
Show resolved
Hide resolved
LGTM - please squash the commits and I will approve. |
fix comments optimize code small optimization for the namespace scope check
4f6ac82
to
d8bd150
Compare
Really appreciate your review and recommendations. Squash the commits and commit. |
/lgtm |
LGTM label has been added. Git tree hash: 11fb4d30b8ef149f79fa967d27afae67d3d92284
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahutsunshine, wojtek-t 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 |
@halfcrazy @caesarxuchao @deads2k Feel free to review the PR if necessary. @wojtek-t gives LGTM and approval. |
/lgtm |
@halfcrazy: changing LGTM is restricted to collaborators 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. |
/milestone v1.29 |
@ahutsunshine: 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 Milestone Maintainers Team 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. |
No - we're very deep in code freeze (right before release) and this shouldn't go to 1.29. |
/priority important-longterm |
Considering this adds in a feature gate to control the behaviour, its probably worth adding a release note since we aren't going down the KEP route. |
@@ -975,6 +975,12 @@ const ( | |||
// will not graduate or be enabled by default in future Kubernetes | |||
// releases. | |||
UserNamespacesPodSecurityStandards featuregate.Feature = "UserNamespacesPodSecurityStandards" | |||
|
|||
// owner: @ahutsunshine | |||
// beta: v1.29 |
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 is probably a mistake since the PR ended up going in after code freeze for 1.29 was lifted (i.e. in the 1.30 release)?
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.
@MadhavJivrajani Thanks for your reminding. Yeah, it's a mistake. Shall we file a PR to fix 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.
Yes please do! Thank you!
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.
PR: #122732 to fix version typo
What type of PR is this?
/kind feature
What this PR does / why we need it:
In our cluster, the number of some resources like pods are very large(10w+). When listing a namespace resources like pods from apiserver cache, the apiserver process will firstly get all the resources in all the namespaces and then filter the resources by namespace predicate even it's a very small request. It's heavy for filtering namespaced resource even the resource number in the namespace is very small with many client requests. It consumes lots of cpu & memory that's not expected.
Which issue(s) this PR fixes:
feature support and discussion: #120778