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>
31 lines
526 B
Go
31 lines
526 B
Go
// Copyright 2020 The Kubernetes Authors.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package resource
|
|
|
|
import "sigs.k8s.io/kustomize/api/resid"
|
|
|
|
type IdSet struct {
|
|
ids map[resid.ResId]bool
|
|
}
|
|
|
|
func MakeIdSet(slice []*Resource) *IdSet {
|
|
set := make(map[resid.ResId]bool)
|
|
for _, r := range slice {
|
|
id := r.CurId()
|
|
if _, ok := set[id]; !ok {
|
|
set[id] = true
|
|
}
|
|
}
|
|
return &IdSet{ids: set}
|
|
}
|
|
|
|
func (s IdSet) Contains(id resid.ResId) bool {
|
|
_, ok := s.ids[id]
|
|
return ok
|
|
}
|
|
|
|
func (s IdSet) Size() int {
|
|
return len(s.ids)
|
|
}
|