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

Webhook registration configuration in Kubernetes #1155

Open
suyanhj opened this issue Jan 6, 2025 · 1 comment
Open

Webhook registration configuration in Kubernetes #1155

suyanhj opened this issue Jan 6, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@suyanhj
Copy link

suyanhj commented Jan 6, 2025

Problem

I found that almost all webhooks in the source code are configured by default to be registered to Kubernetes via URL. However, after the service is deployed to the cluster, I believe it should be accessed via the service method instead. I have checked all the official documentation and GitHub examples, but I couldn’t find any related configuration option. So, I would like to ask if there are any plans to add an optional configuration to choose between URL or service for the registration method in the future?

Proposal

Add optional registration configuration for the webhook

Code

def example():
    settings.admission.server = kopf.WebhookServer(addr='0.0.0.0', port=8443, host=conf.listen_host,service=service)

    class WebhookServer(webhacks.WebhookContextManager):
        def __init__(self, *args, **kwargs):
            ...
            self.service = service

        def __call__(self, *args, **kwargs):
            ...
            if self.service:
                client_config = reviews.WebhookClientConfig(service=self.service)
            ...
            client_config = reviews.WebhookClientConfig(url=url)

Additional information

No response

@suyanhj suyanhj added the enhancement New feature or request label Jan 6, 2025
@DeepFlame-JR
Copy link

I really agree with it.

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

No branches or pull requests

2 participants