mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
e8381db778
* Update Kubernetes to v1.21.0 * Update to golang v1.16.2 * Update dependent modules to track with upstream * Switch to upstream flannel * Track changes to upstream cloud-controller-manager and FeatureGates Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
65 lines
1001 B
Go
65 lines
1001 B
Go
// Copyright 2019 The Kubernetes Authors.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package sets
|
|
|
|
type String map[string]interface{}
|
|
|
|
func (s String) Len() int {
|
|
return len(s)
|
|
}
|
|
|
|
func (s String) List() []string {
|
|
var val []string
|
|
for k := range s {
|
|
val = append(val, k)
|
|
}
|
|
return val
|
|
}
|
|
|
|
func (s String) Has(val string) bool {
|
|
_, found := s[val]
|
|
return found
|
|
}
|
|
|
|
func (s String) Insert(vals ...string) {
|
|
for _, val := range vals {
|
|
s[val] = nil
|
|
}
|
|
}
|
|
|
|
func (s String) Difference(s2 String) String {
|
|
s3 := String{}
|
|
for k := range s {
|
|
if _, found := s2[k]; !found {
|
|
s3.Insert(k)
|
|
}
|
|
}
|
|
return s3
|
|
}
|
|
|
|
func (s String) SymmetricDifference(s2 String) String {
|
|
s3 := String{}
|
|
for k := range s {
|
|
if _, found := s2[k]; !found {
|
|
s3.Insert(k)
|
|
}
|
|
}
|
|
for k := range s2 {
|
|
if _, found := s[k]; !found {
|
|
s3.Insert(k)
|
|
}
|
|
}
|
|
return s3
|
|
}
|
|
|
|
func (s String) Intersection(s2 String) String {
|
|
s3 := String{}
|
|
for k := range s {
|
|
if _, found := s2[k]; found {
|
|
s3.Insert(k)
|
|
}
|
|
}
|
|
return s3
|
|
}
|