mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +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()
|
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)
|
fmt.Fprintf(&bldr, "%s: pass", res)
|
||||||
} else {
|
} else if hasMutate {
|
||||||
fmt.Fprintf(&bldr, "%s is successfully mutated", res)
|
fmt.Fprintf(&bldr, "%s is successfully mutated", res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ func GenerateEvents(engineResponses []engineapi.EngineResponse, blocked bool) []
|
||||||
// - Some/All policies skipped
|
// - Some/All policies skipped
|
||||||
// - report skipped event on resource
|
// - report skipped event on resource
|
||||||
for _, er := range engineResponses {
|
for _, er := range engineResponses {
|
||||||
if er.IsEmpty() {
|
if er.IsEmpty() || er.Resource.GetName() == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !er.IsSuccessful() {
|
if !er.IsSuccessful() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue