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

Admission Controller Path #1101

Open
savemuri opened this issue Feb 2, 2024 · 0 comments
Open

Admission Controller Path #1101

savemuri opened this issue Feb 2, 2024 · 0 comments
Labels
question Further information is requested

Comments

@savemuri
Copy link

savemuri commented Feb 2, 2024

Keywords

mutating, webhook, validating

Problem

I have a simple mutate handler defined as below

file.py

import logging
import os

import kopf

logger = logging.getLogger(__name__)

@kopf.on.mutate("notebooks")
def mutate(spec, patch: kopf.Patch, **_,):
      ....

@kopf.on.startup()
def config(settings: kopf.OperatorSettings, **_):
    settings.execution.max_workers = 20
    settings.networking.connect_timeout = 10
    settings.networking.request_timeout = 60
    CERT_ROOT = os.environ.get("CERT_ROOT", "/etc/webhook/certs/")
    CERT_FILE = os.environ.get("CERT_FILE")
    KEY_FILE = os.environ.get("KEY_FILE")
    logger.info(f"Using cert file: {CERT_ROOT + CERT_FILE}")
    logger.info(f"Using key file: {CERT_ROOT + KEY_FILE}")
    settings.admission.server = kopf.WebhookServer(
        certfile=CERT_ROOT + CERT_FILE,
        pkeyfile=CERT_ROOT + KEY_FILE,
        port=int(os.environ.get("LISTEN_PORT", 8443)),
    )

I am able to run it with kopf run file.py. However I am not sure how the webhook can be invoked. Which path should I be configuring in MutatingWebhookConfiguration to invoke the handler?

@savemuri savemuri added the question Further information is requested label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant