-
Notifications
You must be signed in to change notification settings - Fork 829
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
performance improvement for list request with labelSelector #2234
Comments
I don't know whether this function should be implemented in
In our case, we implemented this by two steps.
|
cc @yy158775 Please take a look this issue. |
From my point of view,I think we can convet labelSelector to fieldSelector with a custom IndexFunc.The IndexFunc can compute the set of indexed values for an object's labels. Eg: If we want to select resourcebindings with label key "clusterpropagationpolicy.karmada.io/name" = specific value,we can construct a IndexFunc which return "key=value" pair when the "clusterpropagationpolicy.karmada.io/name" exists in object labels. Such as: If we need to select objects by other labels,we can edit the indexfunc to support. |
If no one is working on it, i can open a pr to support this issue. |
Our internal version has implemented this function. |
I think this is worth optimizing.So I look foward to seeing your version. |
/assign @likakuli |
Are you convenient to open a PR? I am ready to work on this issue with you. |
sorry, i will open a pr this weekend. or you can open a pr if you have already completed it. thx |
In my opinion, we need to fundamentally enhance the capabilities of client-go. See proposal issues: kubernetes/kubernetes#109329 app-->controller-runtime-->client-go this is fine. |
@weilaaa Are you suggesting waiting for the proposed issue in K/K? |
Yes, it may be the most appropriate way, but I can't guarantee that this proposal will be passed. At least we can wait for the conclusion of the community(K/K) on this proposal. |
What would you like to be added:
Use index to improve the performance of list request with labelSelector
Why is this needed:
LabelSelector is used in many places in
karmada-controller
to list object.controller-runtime
not setup index for label and not support to setup index for label too. So the list request cost O(n). When there are many object, it will cost too much time.controller-runtime code: https://github.com/kubernetes-sigs/controller-runtime/blob/f46919744bee01060c9084a285e049afffd38c9d/pkg/cache/internal/cache_reader.go#L115-L138
The text was updated successfully, but these errors were encountered: