Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add accept-images parameter to whitelist images #424

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vdombrovski
Copy link

This PR adds a new parameter called --accept-images, which behaves much like the --ignore-images parameter, except it provides a way to specify a whitelist of image regexes to rewrite. This check is done after ignore-images, so one can still specify a blacklist.

Use case:

  • We want to cache public images from certain repos to optimize traffic and performance, without exposing private images. We understand that KEP 2535 will solve this issue in term, but it will only enter alpha stage in v1.32
  • The current --ignore-images parameter doesn't do it for us, because Golang's regexp engine doesn't support negative lookaheads (meaning we can't make a whitelist out of this blacklist)
  • We have added the --accept-images parameter, which, when it's not empty, will only rewrite images that match regexes (also integrated into the Helm chart)

Example usage (Helm values file):

controllers:
  webhook:
    acceptedImages:
    - "^gcr\\.io/.*"
    - "^ghcr\\.io/.*"
    - "^docker\\.io/.*"
    - "^registry\\.k8s\\.io.*"

This will cache only images coming from known public repos (provided image names are prefixed with the repo, but that's a compromise we are willing to accept).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant