From 179da706fd43c880d71063b786164f9d2cc862e4 Mon Sep 17 00:00:00 2001 From: Enrico Stahn Date: Thu, 30 Sep 2021 16:31:34 +1000 Subject: [PATCH] fix: provide log record for ImageSwapPolicyExists A log was written if the image existed, now a log is generated if the image does not exist. --- pkg/webhook/image_swapper.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/webhook/image_swapper.go b/pkg/webhook/image_swapper.go index 450cfa6d..c378799f 100644 --- a/pkg/webhook/image_swapper.go +++ b/pkg/webhook/image_swapper.go @@ -241,6 +241,8 @@ func (p *ImageSwapper) Mutate(ctx context.Context, ar *kwhmodel.AdmissionReview, if p.registryClient.ImageExists(targetImage) { log.Ctx(lctx).Debug().Str("image", targetImage).Msg("set new container image") pod.Spec.Containers[i].Image = targetImage + } else { + log.Ctx(lctx).Debug().Str("image", targetImage).Msg("container image not found in target registry, not swapping") } default: panic("unknown imageSwapPolicy")