1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

fix: isolate report creation context for mutate in admission (#11304)

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
This commit is contained in:
Vishal Choudhary 2024-10-07 18:47:35 +05:30 committed by GitHub
parent 339bc1eab2
commit 53922941d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -155,11 +155,13 @@ func (v *mutationHandler) applyMutations(
events := webhookutils.GenerateEvents(engineResponses, false, cfg) events := webhookutils.GenerateEvents(engineResponses, false, cfg)
v.eventGen.Add(events...) v.eventGen.Add(events...)
if v.needsReports(request, policyContext.NewResource(), v.admissionReports) { go func() {
if err := v.createReports(ctx, policyContext.NewResource(), request, engineResponses...); err != nil { if v.needsReports(request, policyContext.NewResource(), v.admissionReports) {
v.log.Error(err, "failed to create report") if err := v.createReports(context.TODO(), policyContext.NewResource(), request, engineResponses...); err != nil {
v.log.Error(err, "failed to create report")
}
} }
} }()
logMutationResponse(patches, engineResponses, v.log) logMutationResponse(patches, engineResponses, v.log)