-
Notifications
You must be signed in to change notification settings - Fork 39.5k
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
Generic field selectors #1362
Comments
#1297 includes a discussion of how labels and fields could conflict if overlapping and other concerns that field names have that labels don't |
A few alternatives:
The last option (3) would make field selection more convenient than label selection, which I don't think we want to encourage. (2) would be the most flexible, both for users (all fields would be available) and in terms of the implementation (we could choose what to index). (1) would pollute the label space, IMO. (0) is a good starting point. :-) But assuming we needed to do something, I prefer (2). We shouldn't necessarily support fields in label selectors of replication controllers or services, however. That said, I wouldn't want to introduce types and comparisons into label selectors. Also, @smarterclayton makes a good point about fields having values that would be problematic to express in a label selector. Perhaps we could get away with not supporting such complex selector syntax -- field values could be arbitrary, but you just couldn't use the selector mechanism to search for funky values. |
Is this about selecting or projecting? For projecting, this appears to be called "partial responses" in the context of REST. This article discusses 3 already in use by google, facebook, twitter and linkedin: I think we should support this. For Selecting, I agree with Brian that we should start with having clients do this (option 0). I think mixing user-applied labels with all JSON properties is dangerous in that it dilutes the significance of labels. |
I agree with @erictune that we need to do partial responses. I do not think field selectors should share a common syntax with label selectors, and they should remain separate arguments to the desired operation. I would be more interested in knowing what types of queries we are attempting to satisfy via a field selector as sets of specific use cases before introducing a general purpose solution as there may be better ways of getting the same information. Field selectors to me are more like what I would want to do with SQL style queries, while labels are more like picking in a tag cloud. As a result, field selectors should be type aware, and support more complex operations like BETWEEN for date types for example. |
Partial responses / projecting is #1459. Let's just discuss selection filtering here. |
Agree with what Derek said, particularly about field selection having typed data and more general expressions. Labels will eventually be set and selected in a GUI. That GUI may have autocompletion or auto-populated check-boxes for labels. For that to work, there should be preferably < 100s of distinct label key-values. Also, usage and monitoring statistics may be automatically grouped and accumulated by labels. This requires limited value count for each key. |
Note that this needs a general solution to #2518. |
Copying @erictune's text from #2602: Suggest adding
|
Another use case for efficient lookup by field: lookup of pods (and probably nodes and services) by IP. |
Should we just open an issue to discuss this? It seems like the key dependency, unless folks see anything else. How does it work right now? There seems to be a way to tell what fields are not supported, e.g. it barked at me with |
@errordeveloper -- I think sig-api-machinery is well aware that not all fields are selectable. if there are additional fields that you want to expose on pod as selectable, you can modify: https://github.com/kubernetes/kubernetes/blob/master/pkg/registry/core/pod/strategy.go#L163 along with the use case. |
Is it the plan to make this extensible for TPRs? |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
/remove-lifecycle stale |
@errordeveloper hello, I want to know this schedule about field selectors. I have a issue about getting pod or pod list via
I try to change the fieldSelector parameter to
In fact , the result is incorrect and I have the pod named infras-https-redirector-1813593808 |
@stanxing I don't know how to answer your question, but perhaps you could try a different channel, e.g. #sig-apimachinery on Slack or #office-hours. |
@stanxing Probably it's not well documented, but the supported fields contains 2 parts:
|
@errordeveloper Thank you for your reply! |
@anfernee Thank you for the explanation. I viewed the code above, but I found that it didn't support pass |
Using a field selector to look up a single object in a list is extremely inefficient today. We'd likely need a way to build indexes before supporting that query pattern across all objects (especially across namespaces) |
@liggitt ok, I understood. This is a problem indeed. Thank you very much. |
Hi, @liggitt, are there any progress updated at this issue? |
No, this is not being worked on currently |
Yeah this is mostly an explicit anti-goal at the moment. I'll update the OP. |
…erry-pick-1351-to-release-4.10 [release-4.10] OCPBUGS-1266: UPSTREAM: <carry>: Remove reserved CPUs from default set
We need a general policy for listing based on object's fields. Something quick 'n dirty has been implemented for pods to allow for scheduling, but no implementation exists for other resource types, and it's not clear that we want to do this (as opposed to making synthetic labels or something).
EDIT, May 2019: It remains incredibly inefficient in our system to select objects this way, O(N); we can't even consider this until we have a technical solution (e.g., indexes). Additionally, it's very tricky to make an API with exactly the right amount of expressiveness. For these reasons, this is actually mostly an anti-goal at the moment.
The text was updated successfully, but these errors were encountered: