mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-05 15:37:19 +00:00
Set policy kind to generate events in the webhook (#3726)
* remove mutateExisting field Signed-off-by: ShutingZhao <shuting@nirmata.com> * update policy controller to create UR for generate Signed-off-by: ShutingZhao <shuting@nirmata.com> * remove debug log Signed-off-by: ShutingZhao <shuting@nirmata.com> * - Update api docs - Ignore e2e tests cleanup failure Signed-off-by: ShutingZhao <shuting@nirmata.com> * Add back index to helm template Signed-off-by: ShutingZhao <shuting@nirmata.com> * Set policy kind to generate events in the webhook Signed-off-by: ShutingZhao <shuting@nirmata.com>
This commit is contained in:
parent
e248308cb3
commit
a45986c04d
1 changed files with 7 additions and 2 deletions
|
@ -22,6 +22,11 @@ func generateEvents(engineResponses []*response.EngineResponse, blocked bool, lo
|
|||
// - report success event on resource
|
||||
|
||||
for _, er := range engineResponses {
|
||||
pKind := "ClusterPolicy"
|
||||
if er.Policy.IsNamespaced() {
|
||||
pKind = "Policy"
|
||||
}
|
||||
|
||||
if !er.IsSuccessful() {
|
||||
|
||||
// Rules that failed
|
||||
|
@ -31,7 +36,7 @@ func generateEvents(engineResponses []*response.EngineResponse, blocked bool, lo
|
|||
// Event on the policy
|
||||
pe := event.NewEvent(
|
||||
log,
|
||||
er.Policy.GetKind(),
|
||||
pKind,
|
||||
kyvernov1.SchemeGroupVersion.String(),
|
||||
er.PolicyResponse.Policy.Namespace,
|
||||
er.PolicyResponse.Policy.Name,
|
||||
|
@ -69,7 +74,7 @@ func generateEvents(engineResponses []*response.EngineResponse, blocked bool, lo
|
|||
// Event on the policy
|
||||
e := event.NewEvent(
|
||||
log,
|
||||
er.Policy.GetKind(),
|
||||
pKind,
|
||||
kyvernov1.SchemeGroupVersion.String(),
|
||||
er.PolicyResponse.Policy.Namespace,
|
||||
er.PolicyResponse.Policy.Name,
|
||||
|
|
Loading…
Add table
Reference in a new issue