GoogleCloudPlatform/kubernetes — pull request #360 by meirf (2014-07-06 15:54:40+00:00)
Title: Issue 341: generalize label selectors

As discussed in issue https://github.com/GoogleCloudPlatform/kubernetes/issues/341, current allowable selectors (in string format) include:
(1) "x=foo" or "x!=foo" meaning label x equals/does not equal foo

This change adds:
(2) "x=*" meaning label x equals any value
(3a) "x=<>" or "x!=<>" meaning label x equals/does not equal foo
(3b) "x=<>" or "x!=<>" or any number of '$' separated values meaning label x is in/not in the set {foo, bar}
(Absent from this is "x!=*" since the case of a label not existing was not requested in the issue.)

The downside of this implementation is that there are now more special characters that users should avoid. The way the code is written however can limit this downside. Namely, string constants for these special characters are written in one place and can be easily changed. Intuitively, the more non-traditional the string constants are, the less likely it will be that a user will have difficulty including certain label values.

This fix requires the following additional rules:
1. If a user does not wish to indicate a set, the label's value should not start with `SetPref` and end in `SetSuff`
2. If a user does wish to indicate a set, the set's values should not include `SetSep`