From 695e9b116df2c1d9fb7f503d8c423c89fe9a9d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Mon, 20 Feb 2023 11:06:46 +0100 Subject: [PATCH] fix: dump admission response (#6349) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- pkg/webhooks/handlers/dump.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/webhooks/handlers/dump.go b/pkg/webhooks/handlers/dump.go index 9bbdd11067..b16e06510d 100644 --- a/pkg/webhooks/handlers/dump.go +++ b/pkg/webhooks/handlers/dump.go @@ -54,7 +54,10 @@ func dumpPayload( if err != nil { logger.Error(err, "Failed to extract resources") } else { - logger.Info("Logging admission request and response payload ", "AdmissionRequest", reqPayload, "AdmissionResponse", response) + if response != nil { + logger = logger.WithValues("AdmissionResponse", *response) + } + logger.Info("Logging admission request and response payload ", "AdmissionRequest", reqPayload) } }