Skip to content

Commit

Permalink
chore: simplify getting exception name (kyverno#9916)
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly authored Mar 15, 2024
1 parent ae1ab5d commit ad62014
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pkg/engine/exceptions.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package engine

import (
"fmt"

kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
"k8s.io/apimachinery/pkg/labels"
Expand All @@ -22,10 +20,7 @@ func (e *engine) GetPolicyExceptions(
if err != nil {
return exceptions, err
}
policyName, err := cache.MetaNamespaceKeyFunc(policy)
if err != nil {
return exceptions, fmt.Errorf("failed to compute policy key: %w", err)
}
policyName := cache.MetaObjectToName(policy).String()
for _, polex := range polexs {
if polex.Contains(policyName, rule) {
exceptions = append(exceptions, *polex)
Expand Down

0 comments on commit ad62014

Please sign in to comment.