Skip to main content

PodMutator

No overview available.

Methods​


Handle()​

@classmethod
def Handle(
ctx: context.Context,
request: admission.Request
) - > admission.Response

Handles an admission request, applying mutations to the incoming Pod object. Callers use this to intercept and modify Pods before they are persisted in the Kubernetes API.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
requestadmission.RequestThe admission request containing the Pod object to be mutated.

Returns​

TypeDescription
admission.ResponseAn admission response indicating whether the request was allowed and any patches applied.

Register()​

@classmethod
def Register(
ctx: context.Context,
mgr: manager.Manager
) - > error

Registers the PodMutator with the controller manager, setting up necessary webhooks. Callers use this to integrate the mutator into the Kubernetes control plane.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the registration process.
mgrmanager.ManagerThe controller manager instance to which the mutator will be registered.

Returns​

TypeDescription
errorAn error if the registration fails, otherwise nil.

GetMutatePath()​

@classmethod
def GetMutatePath() - > string

Retrieves the HTTP path where the mutation webhook is exposed. Callers use this to configure the MutatingWebhookConfiguration resource.

Returns​

TypeDescription
stringThe URL path for the mutation webhook.

CreateMutationWebhookConfiguration()​

@classmethod
def CreateMutationWebhookConfiguration(
namespace: string
) - > *admissionregistrationv1.MutatingWebhookConfiguration, error

Creates a Kubernetes MutatingWebhookConfiguration object for the PodMutator. Callers use this to dynamically register the webhook with the Kubernetes API server.

Parameters​

NameTypeDescription
namespacestringThe Kubernetes namespace where the webhook service is deployed.

Returns​

TypeDescription
*admissionregistrationv1.MutatingWebhookConfiguration, errorThe created MutatingWebhookConfiguration object and an error if creation fails.