mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
94d9bbe73f
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
18 lines
518 B
Go
18 lines
518 B
Go
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)
|
|
}
|