mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
7a1d4374c6
* refactor: move client out of policy context Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix test Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
17 lines
712 B
Go
17 lines
712 B
Go
package api
|
|
|
|
import (
|
|
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
|
|
"k8s.io/apimachinery/pkg/labels"
|
|
)
|
|
|
|
// NamespacedResourceSelector is an abstract interface used to list namespaced resources given a label selector
|
|
// Any implementation might exist, cache based, file based, client based etc...
|
|
type NamespacedResourceSelector[T any] interface {
|
|
// List selects resources based on label selector.
|
|
// Objects returned here must be treated as read-only.
|
|
List(selector labels.Selector) (ret []T, err error)
|
|
}
|
|
|
|
// PolicyExceptionSelector is an abstract interface used to resolve poliicy exceptions
|
|
type PolicyExceptionSelector = NamespacedResourceSelector[*kyvernov2alpha1.PolicyException]
|