phenixblue / imageswap-webhook

Image Swap Mutating Admission Webhook for Kubernetes
Apache License 2.0
154 stars 53 forks source link

Swap isn't keeping repository name #20

Closed uselessidbr closed 3 years ago

uselessidbr commented 3 years ago

Hello!

First of all i would like to thank you for your great work!

I'm trying to redirect the image pull to my private registry but whenever i set the IMAGEPREFIX imageswap cut the "repository" portion off.

Example:

Is it supposed to work like this?

Also, a suggestion if you allow me: it would be nice to rewrite the request based on the FQDN (let's suppose docker.io) to something else. I know that there's a project (https://github.com/indeedeng-alpha/harbor-container-webhook/blob/main/README.md) that supposedly does that but it only works with kubernetes 1.16+.

Rewriting unqualified images is something we can achieve by so many ways.

Thanks!

phenixblue commented 3 years ago

Yes, that is how the image swap logic works today. It will remove and swap everything up to the image:tag with the defined target. I'm planning an update that will only swap the registry portion of the image definition and keep the project/image:tag. I'll take a look at the project you linked and see if it makes sense to adopt similar logic for this project.

phenixblue commented 3 years ago

@uselessidbr I just cut the v1.4.0-prerelease that includes the new swap logic I previously mentioned. Please give it a try and let me know if that solves this problem for you.

We do keep the main "QuickStart" install reference on the README pointing at the latest stable release, so here's the reference for the prerelease:

$ kubectl apply -f https://raw.githubusercontent.com/phenixblue/imageswap-webhook/v1.4.0-prerelease/deploy/install.yaml