mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
refactor: move webhook events utils in utils package (#4545)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
3b556abe63
commit
16c2d880c8
3 changed files with 5 additions and 5 deletions
|
@ -278,7 +278,7 @@ func (h *handlers) handleMutation(logger logr.Logger, request *admissionv1.Admis
|
|||
}
|
||||
|
||||
if !isResourceDeleted(policyContext) {
|
||||
events := generateEvents(engineResponses, false, logger)
|
||||
events := webhookutils.GenerateEvents(engineResponses, false, logger)
|
||||
h.eventGen.Add(events...)
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ func (h *handlers) handleVerifyImages(logger logr.Logger, request *admissionv1.A
|
|||
failurePolicy := policyContext.Policy.GetSpec().GetFailurePolicy()
|
||||
blocked := webhookutils.BlockRequest(engineResponses, failurePolicy, logger)
|
||||
if !isResourceDeleted(policyContext) {
|
||||
events := generateEvents(engineResponses, blocked, logger)
|
||||
events := webhookutils.GenerateEvents(engineResponses, blocked, logger)
|
||||
h.eventGen.Add(events...)
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ func (v *validationHandler) handleValidation(
|
|||
|
||||
blocked := webhookutils.BlockRequest(engineResponses, failurePolicy, logger)
|
||||
if deletionTimeStamp == nil {
|
||||
events := generateEvents(engineResponses, blocked, logger)
|
||||
events := webhookutils.GenerateEvents(engineResponses, blocked, logger)
|
||||
v.eventGen.Add(events...)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package resource
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/go-logr/logr"
|
||||
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
// generateEvents generates event info for the engine responses
|
||||
func generateEvents(engineResponses []*response.EngineResponse, blocked bool, log logr.Logger) []event.Info {
|
||||
func GenerateEvents(engineResponses []*response.EngineResponse, blocked bool, log logr.Logger) []event.Info {
|
||||
var events []event.Info
|
||||
|
||||
// - Some/All policies fail or error
|
Loading…
Add table
Reference in a new issue