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

docs: image filtering #441

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

docs: image filtering #441

wants to merge 1 commit into from

Conversation

paullaffitte
Copy link
Contributor

What do you think @zifeo? Is it clearer?

closes #440

@zifeo
Copy link

zifeo commented Nov 22, 2024

@paullaffitte Thanks for the documentation. I understand the order is similar to:

  1. all pod matches by the objectSelector or all pods if the selector is empty
  2. the image list is filtered with the ignored images regex
  3. only the image matched the accepted images regex are kept

In practice, I want to only cache docker.io images, I should use the following:

    ignoredNamespaces: []
    ignoredImages:
      - ".+"
    acceptedImages: 
      - "^docker\\.io/.*"
    objectSelector:
      matchExpressions: []

Is that correct?

@paullaffitte
Copy link
Contributor Author

Almost, with the current ignoredImages setting you ignore all images.

@zifeo
Copy link

zifeo commented Nov 27, 2024

@paullaffitte Indeed, thanks. How would you configure to only cache docker.io ones? In my understanding this needs currently explicit denial of the other patterns or namespace.

@paullaffitte
Copy link
Contributor Author

humm.. maybe I should add an example to the doc. I feel like it is not that easy to explain even though it is not very complicated. Something like:


Given a list of images and a image filtering configuration:

  • docker.io/library/nginx:stable-alpine
  • docker.io/library/nginx:1.27
  • nixery.dev/curl/kubectl
controllers:
  webhook:
    ignoredImages:
      - "^.+:[\\w-]*alpine[\\w-]*$"
    acceptedImages: 
      - "^docker\\.io/.*"

Performing the "ignore" step will remove the matching docker.io/library/nginx:stable-alpine image. And performing the accept step will remove the not matching nixery.dev/curl/kubectl image. Leaving us with only the docker.io/library/nginx:1.27 image.

In the case of an empty acceptedImages, all images are accepted. In the case of an empty ignoredImages, none is ignored.

@zifeo
Copy link

zifeo commented Nov 29, 2024

@paullaffitte Your explanation are clear. Can you precise how objectSelector.matchExpressions enter the mix?

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.

Document the precedence of image selectors
2 participants