1
0
Fork 0
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:
shuting 2022-04-29 13:50:55 +08:00 committed by GitHub
parent e248308cb3
commit a45986c04d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,