-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
Handle selectors correctly in VersionedParams(). #17836
Merged
wojtek-t
merged 1 commit into
kubernetes:master
from
wojtek-t:support_selectors_in_versioned_params
Dec 1, 2015
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I see. Perhaps we need to fix the converter or make something into a pointer so we can tell the difference between unspecified and deliberately set to ""? I don't think we make a distinction in query parameters, but we do for the label selectors in e.g. service objects-- unset means nothing and set-but-empty means everything. So this may be important to get right, or at least expand the comment?
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.
The issue here is that in golang there is no way to differ "" and unspecified string.
I will expand this comment.
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.
Right, and this may not be a big deal-- but you'd probably have to fix this a level up by making unversioned.ListOptions distinguish between unset selector and set-but-empty (by making it a pointer, if necessary).
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.
Can we do it in a separate PR?
This PR is not introducing any regression.
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.
Sure, that's fine.
On Mon, Nov 30, 2015 at 11:52 AM, Wojciech Tyczynski <
notifications@github.com> wrote:
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.
ListOPtions should be versioned is my argument. Seeing this code, seeing
the field transformation code, it's basically versioning. The API for that
object has to be stable, which is the whole point of what we had "internal"
objects before. The rest of the path is wire transformation - saying that
there is no wire transformation for ListOptions is silly. Creating a
different way of handling list options from all the other options is
basically creating an extra code path, not removing a code path.
On Wed, Dec 9, 2015 at 11:13 AM, Wojciech Tyczynski <
notifications@github.com> wrote:
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.
I'm not saying that we shouldn't get back to versioned ListOptions.
What I'm saying is that we already had exactly the same code in Request::LabelSelector() and Request::FieldSelector before. So this code wasn't created - it was move from one place to the other.
That said - I agree it shouldn't be here. We should basically move "fieldmappig" to some more generic places (conversion-related) and once this is done, we can also move this code there.
So in my opinion, cleaning up this code is unrelated to getting back to ListOptions...
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.
So in other words - we should definitely clean this up, even before getting back to versioned ListOptions - because those are orthogonal problems.
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 they are orthogonal, but related in the sense of location.
There should be conversion functions for field selectors that know how to
target the field selectors. The hard problem is that the type of the field
selector is a dynamic input, not a static input. We may need to support
conversion options to Convert that define additional metadata that allows
the field selector conversion to target base on the input metadata
(essentially an object reference). One scheme is not guaranteed to hold
all conversions either - so there's an inside out problem here we may have
to solve in the future.
On Wed, Dec 9, 2015 at 12:00 PM, Wojciech Tyczynski <
notifications@github.com> wrote:
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.
I agree with the first part.
If that's the case, we will need to change this code too, because currently we only have one convertor here.
Sorry - I probably don't see some consequence that you can see, so I'm trying to understand them (also note that I'm not opting for not changing it back to versioned - I'm just trying to understand what it would give us now...)