Skip to content

Commit

Permalink
fix(controller): don't set original-image annotation when image is no…
Browse files Browse the repository at this point in the history
…t rewritten
  • Loading branch information
paullaffitte committed Nov 7, 2024
1 parent 5e9563c commit 827f908
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/core/v1/pod_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ func (a *ImageRewriter) handleContainer(pod *corev1.Pod, container *corev1.Conta
} // ignore rewriting invalid images
}

pod.Annotations[annotationKey] = image

if !rewriteImage {
return RewrittenImage{
Original: container.Image,
NotRewrittenBecause: "pod doesn't allow to rewrite its images",
}
}

pod.Annotations[annotationKey] = image

sanitizedRegistryName := strings.ReplaceAll(sourceRef.Context().RegistryStr(), ":", "-")
image = strings.ReplaceAll(image, sourceRef.Context().RegistryStr(), sanitizedRegistryName)

Expand Down

0 comments on commit 827f908

Please sign in to comment.