Skip to content

Commit

Permalink
skip generating events on empty rule response (kyverno#5158)
Browse files Browse the repository at this point in the history
Signed-off-by: ShutingZhao <shuting@nirmata.com>

Signed-off-by: ShutingZhao <shuting@nirmata.com>
  • Loading branch information
realshuting authored Oct 27, 2022
1 parent fe7ea67 commit cf2b8da
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/webhooks/utils/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ func GenerateEvents(engineResponses []*response.EngineResponse, blocked bool) []
// - report skipped event on resource

for _, er := range engineResponses {
if er.IsEmpty() {
continue
}

if !er.IsSuccessful() {
for i, ruleResp := range er.PolicyResponse.Rules {
if ruleResp.Status == response.RuleStatusFail || ruleResp.Status == response.RuleStatusError {
Expand Down

0 comments on commit cf2b8da

Please sign in to comment.