Admission Controller Path
savemuri opened this issue · comments
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?