aboutsummaryrefslogtreecommitdiff
path: root/vendor/k8s.io/apimachinery/pkg/labels
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2021-08-05 12:20:04 +0000
committerGitHub <noreply@github.com>2021-08-05 12:20:04 +0000
commiteb2e99101aa8e774009b2f177fb4c4c4be54ed59 (patch)
treed1eced42fef958ccfd5aa13dbaf0455b95ac1863 /vendor/k8s.io/apimachinery/pkg/labels
parent117583c293713f2baa920c4035e820ad59fe6622 (diff)
downloadpodman-eb2e99101aa8e774009b2f177fb4c4c4be54ed59.tar.gz
podman-eb2e99101aa8e774009b2f177fb4c4c4be54ed59.tar.bz2
podman-eb2e99101aa8e774009b2f177fb4c4c4be54ed59.zip
Bump k8s.io/apimachinery from 0.21.3 to 0.22.0
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.21.3 to 0.22.0. - [Release notes](https://github.com/kubernetes/apimachinery/releases) - [Commits](https://github.com/kubernetes/apimachinery/compare/v0.21.3...v0.22.0) --- updated-dependencies: - dependency-name: k8s.io/apimachinery dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Diffstat (limited to 'vendor/k8s.io/apimachinery/pkg/labels')
-rw-r--r--vendor/k8s.io/apimachinery/pkg/labels/selector.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/labels/selector.go b/vendor/k8s.io/apimachinery/pkg/labels/selector.go
index b0865777a..9eea34579 100644
--- a/vendor/k8s.io/apimachinery/pkg/labels/selector.go
+++ b/vendor/k8s.io/apimachinery/pkg/labels/selector.go
@@ -31,12 +31,15 @@ import (
)
var (
- validRequirementOperators = []string{
+ unaryOperators = []string{
+ string(selection.Exists), string(selection.DoesNotExist),
+ }
+ binaryOperators = []string{
string(selection.In), string(selection.NotIn),
string(selection.Equals), string(selection.DoubleEquals), string(selection.NotEquals),
- string(selection.Exists), string(selection.DoesNotExist),
string(selection.GreaterThan), string(selection.LessThan),
}
+ validRequirementOperators = append(binaryOperators, unaryOperators...)
)
// Requirements is AND of all requirements.
@@ -140,7 +143,7 @@ type Requirement struct {
// NewRequirement is the constructor for a Requirement.
// If any of these rules is violated, an error is returned:
-// (1) The operator can only be In, NotIn, Equals, DoubleEquals, NotEquals, Exists, or DoesNotExist.
+// (1) The operator can only be In, NotIn, Equals, DoubleEquals, Gt, Lt, NotEquals, Exists, or DoesNotExist.
// (2) If the operator is In or NotIn, the values set must be non-empty.
// (3) If the operator is Equals, DoubleEquals, or NotEquals, the values set must contain one value.
// (4) If the operator is Exists or DoesNotExist, the value set must be empty.
@@ -364,13 +367,9 @@ func safeSort(in []string) []string {
// Add adds requirements to the selector. It copies the current selector returning a new one
func (s internalSelector) Add(reqs ...Requirement) Selector {
- var ret internalSelector
- for ix := range s {
- ret = append(ret, s[ix])
- }
- for _, r := range reqs {
- ret = append(ret, r)
- }
+ ret := make(internalSelector, 0, len(s)+len(reqs))
+ ret = append(ret, s...)
+ ret = append(ret, reqs...)
sort.Sort(ByKey(ret))
return ret
}
@@ -753,7 +752,7 @@ func (p *Parser) parseOperator() (op selection.Operator, err error) {
case NotEqualsToken:
op = selection.NotEquals
default:
- return "", fmt.Errorf("found '%s', expected: '=', '!=', '==', 'in', notin'", lit)
+ return "", fmt.Errorf("found '%s', expected: %v", lit, strings.Join(binaryOperators, ", "))
}
return op, nil
}