Skip to main content

InitCerts

Generates a self-signed TLS certificate for the webhook and stores it in a k8s Secret.

def InitCerts(
ctx: context.Context,
kubeClient: kubernetes.Interface,
cfg: *webhookConfig.Config
) - > error

Generates a self-signed TLS certificate for the webhook and stores it in a Kubernetes Secret. This function is used to initialize the necessary security credentials for the webhook to operate securely.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for controlling cancellation and timeouts.
kubeClientkubernetes.InterfaceThe Kubernetes client interface used to interact with the Kubernetes API, specifically for creating secrets.
cfg*webhookConfig.ConfigThe webhook configuration, containing details like the service name and the name of the secret to be created.

Returns

TypeDescription
errorAn error if certificate generation or secret creation fails, otherwise nil.