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

Added dynamic namespace selector for mutating webhook #51270

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

Conversation

rahtr
Copy link

@rahtr rahtr commented May 28, 2024

Please provide a description of this PR:
There are instances when users can't use the static namespace selectors. This PR makes the namespace selector as an optional input value. If it isn't provided then use the defaults.

@rahtr rahtr requested a review from a team as a code owner May 28, 2024 20:17
@istio-policy-bot istio-policy-bot added area/environments release-notes-none Indicates a PR that does not require release notes. labels May 28, 2024
@istio-policy-bot
Copy link

😊 Welcome @rahtr! This is either your first contribution to the Istio istio repo, or it's been
a while since you've been here.

You can learn more about the Istio working groups, Code of Conduct, and contribution guidelines
by referring to Contributing to Istio.

Thanks for contributing!

Courtesy of your friendly welcome wagon.

@istio-testing istio-testing added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 28, 2024
@istio-testing
Copy link
Collaborator

Hi @rahtr. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@howardjohn
Copy link
Member

Can you give more context on the use case?

These selectors are extremely finnacky, complex, and error prone. Would be good to be really sure we need it before introducing more complexity

@rahtr
Copy link
Author

rahtr commented May 28, 2024

We manage a fleet on K8s multi-tenant clusters which are exposed to our internal teams via various homegrown tools. These tools are managed by different teams and have different ways to provision namespaces. When these namespaces are provisioned, there are certain prefixes that are added to the labels/annotations which are governed by the security policies. For example, if a team wants to create a namespace foo on multi-tenant clusters which has a label with a key istio.io/rev, a prefix like infosec-istio.io/rev automatically gets added to the namespace label.

This PR would take care of such scenarios and make the mutating webhook configuration more dynamic.

@rahtr
Copy link
Author

rahtr commented Jun 4, 2024

@howardjohn , could you please review my comment above and see if this use case sounds reasonable for this fix?

Copy link
Contributor

@costinm costinm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If your use case is that you add a prefix to the label - why not just add a prefix setting, instead of the far more complicated selector ?

@rahtr
Copy link
Author

rahtr commented Jun 5, 2024

If your use case is that you add a prefix to the label - why not just add a prefix setting, instead of the far more complicated selector ?

Could you please share an example? Where do we add this prefix setting?

Copy link
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest tackling this problem outside Istio. The webhooks already cause nightmares of complexity as is, and I am not very much in favor of introducing more complexity unless we are 100% sure we require it. https://istio.io/latest/docs/setup/additional-setup/customize-installation-helm/ may be an alternative approach to solve this out of band

@rahtr
Copy link
Author

rahtr commented Jun 18, 2024

I suggest tackling this problem outside Istio. The webhooks already cause nightmares of complexity as is, and I am not very much in favor of introducing more complexity unless we are 100% sure we require it. https://istio.io/latest/docs/setup/additional-setup/customize-installation-helm/ may be an alternative approach to solve this out of band

There are many ways to tackle this outside this, however this looks like a straightforward approach.
This looks like a pretty common approach for managing selectors. For example check this webhook configuration for cert manager(https://github.com/cert-manager/cert-manager/blob/master/deploy/charts/cert-manager/templates/webhook-mutating-webhook.yaml#L17).

@howardjohn
Copy link
Member

I am aware that other projects have different offerings. However, Istio's webhooks are far more complex due to various factors (legacy decisions, namespace + pod labels, revisions) that make them far less appealing to support customization directly in the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/environments needs-ok-to-test release-notes-none Indicates a PR that does not require release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants