summaryrefslogtreecommitdiff
path: root/vendor/k8s.io/apimachinery/pkg/labels/selector.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-03-26 18:26:55 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-27 18:09:12 +0000
commitaf64e10400f8533a0c48ecdf5ab9b7fbf329e14e (patch)
tree59160e3841b440dd35189c724bbb4375a7be173b /vendor/k8s.io/apimachinery/pkg/labels/selector.go
parent26d7e3c7b85e28c4e42998c90fdcc14079f13eef (diff)
downloadpodman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.tar.gz
podman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.tar.bz2
podman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.zip
Vendor in lots of kubernetes stuff to shrink image size
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #554 Approved by: mheon
Diffstat (limited to 'vendor/k8s.io/apimachinery/pkg/labels/selector.go')
-rw-r--r--vendor/k8s.io/apimachinery/pkg/labels/selector.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/labels/selector.go b/vendor/k8s.io/apimachinery/pkg/labels/selector.go
index 50b41f99d..b301b4284 100644
--- a/vendor/k8s.io/apimachinery/pkg/labels/selector.go
+++ b/vendor/k8s.io/apimachinery/pkg/labels/selector.go
@@ -51,6 +51,9 @@ type Selector interface {
// If there are querying parameters, it will return converted requirements and selectable=true.
// If this selector doesn't want to select anything, it will return selectable=false.
Requirements() (requirements Requirements, selectable bool)
+
+ // Make a deep copy of the selector.
+ DeepCopySelector() Selector
}
// Everything returns a selector that matches all labels.
@@ -65,6 +68,7 @@ func (n nothingSelector) Empty() bool { return false }
func (n nothingSelector) String() string { return "" }
func (n nothingSelector) Add(_ ...Requirement) Selector { return n }
func (n nothingSelector) Requirements() (Requirements, bool) { return nil, false }
+func (n nothingSelector) DeepCopySelector() Selector { return n }
// Nothing returns a selector that matches no labels
func Nothing() Selector {
@@ -78,6 +82,21 @@ func NewSelector() Selector {
type internalSelector []Requirement
+func (s internalSelector) DeepCopy() internalSelector {
+ if s == nil {
+ return nil
+ }
+ result := make([]Requirement, len(s))
+ for i := range s {
+ s[i].DeepCopyInto(&result[i])
+ }
+ return result
+}
+
+func (s internalSelector) DeepCopySelector() Selector {
+ return s.DeepCopy()
+}
+
// ByKey sorts requirements by key to obtain deterministic parser
type ByKey []Requirement
@@ -91,6 +110,7 @@ func (a ByKey) Less(i, j int) bool { return a[i].key < a[j].key }
// The zero value of Requirement is invalid.
// Requirement implements both set based match and exact match
// Requirement should be initialized via NewRequirement constructor for creating a valid Requirement.
+// +k8s:deepcopy-gen=true
type Requirement struct {
key string
operator selection.Operator
@@ -530,7 +550,7 @@ func (p *Parser) lookahead(context ParserContext) (Token, string) {
return tok, lit
}
-// consume returns current token and string. Increments the the position
+// consume returns current token and string. Increments the position
func (p *Parser) consume(context ParserContext) (Token, string) {
p.position++
tok, lit := p.scannedItems[p.position-1].tok, p.scannedItems[p.position-1].literal