phenixblue / imageswap-webhook

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

Add logic to handle maps for library level images #42

Closed phenixblue closed 3 years ago

phenixblue commented 3 years ago

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind bug /kind cleanup /kind deprecation /kind design /kind documentation

/kind feature

/kind release

What this PR does / why we need it:

This adds logic to process maps for library level images differently from images nested under a specific project/organization.

EXAMPLE:

docker.io:harbor.example.com
docker.io-library:harbor.example.com/library

This would be the output for the library vs. non-library images:

nginx:latest ->harbor.example.com/library/nginx:latest

tmobile/magtape:latest -> harbor.example.com/tmobile/magtape:latest

This is applicable for use cases such as the Harbor projects image pull-through cache

Which issue(s) this PR fixes:

Fixes #41

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

- Adds new syntax for map files to denote a map specific for library level images (ie. nginx:latest) in a particular registry 

Additional documentation e.g., usage docs, etc.: