Skip to content
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

Removing dead code in labels package and changing LabelSelector type #5769

Merged
merged 1 commit into from
Mar 23, 2015

Conversation

sdminonne
Copy link
Contributor

Main modification of this PR: LabelSelector type is changed to be a type []Requirement instead of struct { Requirements: []Requirement } necessary to handle the nil selector.

Removed the andTerm hasTerm struct no more used. As suggested by @nikhiljindal #5171 (comment)

Other removed code:

  1. OneTermEqualSelector and RequiresExactMatch simply not used for labels
  2. ParseSelector not used anymore
  3. Added a TODO: SelectorFromSet does not return and error in case non valid (key/value) pair are added. This part will be handled during the API modification of Generalize label selectors #341 as discussed here Generalize label selectors #341 (comment).

@nikhiljindal nikhiljindal self-assigned this Mar 22, 2015
@smarterclayton
Copy link
Contributor

@sdminonne please see #5771 and the change smarterclayton@1c350cb that is part of #5763

@smarterclayton
Copy link
Contributor

We use RequiresExactMatch in OpenShift - what's the replacement for ParseSelector

@smarterclayton
Copy link
Contributor

Nm on RequiresExactMatch - that's in fields. It's fine to remove from labels.

@sdminonne
Copy link
Contributor Author

@smarterclayton working on this. labels.Parse replaces labels.ParseSelector.

@sdminonne sdminonne changed the title Removing dead code in labels package and chaning LabelSelector type Removing dead code in labels package and changing LabelSelector type Mar 23, 2015
@nikhiljindal
Copy link
Contributor

Thanks a lot for deleting all the dead code.
Can you please clarify why do we need to handle the nil selector. Why were we not required to handle it earlier?
I see nothing in this PR that would have caused that.

@smarterclayton
Copy link
Contributor

It's convenient to deal with the nil, although it can be confusing that nil LabelSelector and nil Selector do different things. We do need to treat nil Selector special in services.

@sdminonne
Copy link
Contributor Author

@nikhiljindal I didn't test it but when I saw this https://github.com/GoogleCloudPlatform/kubernetes/blob/master/pkg/service/endpoints_controller.go#L54 I start to think that we would handle nil label selector. At the moment the service.spec.selector is still a map but we may want to move to a selector.

@smarterclayton thanks for this. Would you prefer to have LabelSelector defined as a slice of Selector(s)?

@nikhiljindal
Copy link
Contributor

ok. Fine with handling nil LabelSelector if its easy to deal with.
Thanks, merging.

nikhiljindal added a commit that referenced this pull request Mar 23, 2015
Removing dead code in labels package and changing LabelSelector type
@nikhiljindal nikhiljindal merged commit 5c71e2b into kubernetes:master Mar 23, 2015
@sdminonne
Copy link
Contributor Author

@nikhiljindal thanks.
I'll follow up with @smarterclayton on nil behavior of LabelSelector vs Selector.

@sdminonne sdminonne deleted the cleaning_labels branch March 23, 2015 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants