1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/pkg/engine/exceptions.go

19 lines
518 B
Go
Raw Normal View History

package engine
import (
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
"k8s.io/client-go/tools/cache"
)
// GetPolicyExceptions get all exceptions that match both the policy and the rule.
func (e *engine) GetPolicyExceptions(
policy kyvernov1.PolicyInterface,
rule string,
) ([]*kyvernov2.PolicyException, error) {
if e.exceptionSelector == nil {
return nil, nil
}
return e.exceptionSelector.Find(cache.MetaObjectToName(policy).String(), rule)
}