Skip to content

Commit

Permalink
chore: simplify getting exception name
Browse files Browse the repository at this point in the history
Signed-off-by: Anushka Mittal <[email protected]>
  • Loading branch information
anushkamittal2001 committed Apr 16, 2024
1 parent e28c3f9 commit 31b820c
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"

"github.com/go-logr/logr"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
Expand All @@ -25,10 +23,7 @@ func findExceptions(
return nil, err
}
var result []*kyvernov2alpha1.PolicyException
policyName, err := cache.MetaNamespaceKeyFunc(policy)
if err != nil {
return nil, fmt.Errorf("failed to compute policy key: %w", err)
}
policyName := cache.MetaObjectToName(policy).String()
for _, polex := range polexs {
if polex.Contains(policyName, rule) {
result = append(result, polex)
Expand Down

0 comments on commit 31b820c

Please sign in to comment.