1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/cmd/cli/kubectl-kyverno/processor/exceptions.go
Mariam Fahmy 94d9bbe73f
chore: use v2 clients for policy exceptions (#10530)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2024-06-24 16:36:55 +00:00

21 lines
537 B
Go

package processor
import (
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
"k8s.io/apimachinery/pkg/labels"
)
type policyExceptionLister struct {
exceptions []*kyvernov2.PolicyException
}
func (l *policyExceptionLister) List(selector labels.Selector) ([]*kyvernov2.PolicyException, error) {
var out []*kyvernov2.PolicyException
for _, exception := range l.exceptions {
exceptionLabels := labels.Set(exception.GetLabels())
if selector.Matches(exceptionLabels) {
out = append(out, exception)
}
}
return out, nil
}