mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-29 02:45:06 +00:00
fix: skip creating event for an empty resource name (#7810)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
This commit is contained in:
parent
5577eb8708
commit
8c2335fe55
2 changed files with 6 additions and 3 deletions
|
@ -60,9 +60,12 @@ func NewPolicyAppliedEvent(source Source, engineResponse engineapi.EngineRespons
|
|||
}
|
||||
|
||||
hasValidate := engineResponse.Policy().GetSpec().HasValidate()
|
||||
if hasValidate {
|
||||
hasVerifyImages := engineResponse.Policy().GetSpec().HasVerifyImages()
|
||||
hasMutate := engineResponse.Policy().GetSpec().HasMutate()
|
||||
|
||||
if hasValidate || hasVerifyImages {
|
||||
fmt.Fprintf(&bldr, "%s: pass", res)
|
||||
} else {
|
||||
} else if hasMutate {
|
||||
fmt.Fprintf(&bldr, "%s is successfully mutated", res)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ func GenerateEvents(engineResponses []engineapi.EngineResponse, blocked bool) []
|
|||
// - Some/All policies skipped
|
||||
// - report skipped event on resource
|
||||
for _, er := range engineResponses {
|
||||
if er.IsEmpty() {
|
||||
if er.IsEmpty() || er.Resource.GetName() == "" {
|
||||
continue
|
||||
}
|
||||
if !er.IsSuccessful() {
|
||||
|
|
Loading…
Add table
Reference in a new issue