mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-03-04 02:30:23 +00:00
20 lines
437 B
Go
20 lines
437 B
Go
package utils
|
|
|
|
import (
|
|
"sigs.k8s.io/controller-runtime/pkg/builder"
|
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
|
)
|
|
|
|
func NamesMatchingPredicate(names ...string) builder.Predicates {
|
|
return builder.WithPredicates(predicate.NewPredicateFuncs(func(object client.Object) bool {
|
|
for _, name := range names {
|
|
if object.GetName() == name {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}))
|
|
}
|