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

plaffitt
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?

@plaffitt
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.

@plaffitt
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 explanations are clear. Can you precise how objectSelector.matchExpressions enter the mix? Support for negating in the regex would also be beneficial, currently not supported.

@plaffitt
Copy link
Contributor Author

plaffitt commented Dec 3, 2024

From the documentation:

  • Finally, kuik will only work on pods matching a specific selector. By default, the selector is empty, which means "match all the pods". The selector can be set with the Helm value controllers.webhook.objectSelector.matchExpressions.

This logic isn't implemented by the kuik controllers or webhook directly, but through Kubernetes' standard webhook object selectors. In other words, these parameters end up in the MutatingWebhookConfiguration template to filter which pods get presented to kuik's webhook.

Why do you want to negate in the regex? You already can already do it by using either ignoredImages or acceptedImages.

@zifeo
Copy link

zifeo commented Dec 3, 2024

@plaffitt Sorted out what was bugging me, the accept image feature is only available since the last helm release and the lack of coherence messed with my global understanding. This should be enough to complete my doc request.

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