*: update kube vendor to v1.7.4

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-08-04 13:13:19 +02:00
parent c67859731f
commit d56bf090ce
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
1032 changed files with 273965 additions and 40081 deletions

View file

@ -40,6 +40,8 @@ type Selector interface {
// Transform returns a new copy of the selector after TransformFunc has been
// applied to the entire selector, or an error if fn returns an error.
// If for a given requirement both field and value are transformed to empty
// string, the requirement is skipped.
Transform(fn TransformFunc) (Selector, error)
// Requirements converts this interface to Requirements to expose
@ -79,6 +81,9 @@ func (t *hasTerm) Transform(fn TransformFunc) (Selector, error) {
if err != nil {
return nil, err
}
if len(field) == 0 && len(value) == 0 {
return Everything(), nil
}
return &hasTerm{field, value}, nil
}
@ -115,6 +120,9 @@ func (t *notHasTerm) Transform(fn TransformFunc) (Selector, error) {
if err != nil {
return nil, err
}
if len(field) == 0 && len(value) == 0 {
return Everything(), nil
}
return &notHasTerm{field, value}, nil
}
@ -169,13 +177,15 @@ func (t andTerm) RequiresExactMatch(field string) (string, bool) {
}
func (t andTerm) Transform(fn TransformFunc) (Selector, error) {
next := make([]Selector, len([]Selector(t)))
for i, s := range []Selector(t) {
next := make([]Selector, 0, len([]Selector(t)))
for _, s := range []Selector(t) {
n, err := s.Transform(fn)
if err != nil {
return nil, err
}
next[i] = n
if !n.Empty() {
next = append(next, n)
}
}
return andTerm(next), nil
}
@ -222,7 +232,7 @@ var valueEscaper = strings.NewReplacer(
`=`, `\=`,
)
// Escapes an arbitrary literal string for use as a fieldSelector value
// EscapeValue escapes an arbitrary literal string for use as a fieldSelector value
func EscapeValue(s string) string {
return valueEscaper.Replace(s)
}
@ -245,7 +255,7 @@ func (i UnescapedRune) Error() string {
return fmt.Sprintf("invalid field selector: unescaped character in value: %v", i.r)
}
// Unescapes a fieldSelector value and returns the original literal value.
// UnescapeValue unescapes a fieldSelector value and returns the original literal value.
// May return the original string if it contains no escaped or special characters.
func UnescapeValue(s string) (string, error) {
// if there's no escaping or special characters, just return to avoid allocation
@ -307,12 +317,12 @@ func ParseSelector(selector string) (Selector, error) {
})
}
// Parses the selector and runs them through the given TransformFunc.
// ParseAndTransformSelector parses the selector and runs them through the given TransformFunc.
func ParseAndTransformSelector(selector string, fn TransformFunc) (Selector, error) {
return parseSelector(selector, fn)
}
// Function to transform selectors.
// TransformFunc transforms selectors.
type TransformFunc func(field, value string) (newField, newValue string, err error)
// splitTerms returns the comma-separated terms contained in the given fieldSelector.