package webhook

import "k8s.io/apiserver/pkg/admission/plugin/webhook"

Index

Types

type WebhookAccessor

type WebhookAccessor interface {
	// This accessor provides the methods needed to support matching against webhook
	// predicates
	namespace.NamespaceSelectorProvider
	object.ObjectSelectorProvider

	// GetUID gets a string that uniquely identifies the webhook.
	GetUID() string

	// GetConfigurationName gets the name of the webhook configuration that owns this webhook.
	GetConfigurationName() string

	// GetRESTClient gets the webhook client
	GetRESTClient(clientManager *webhookutil.ClientManager) (*rest.RESTClient, error)

	// GetCompiledMatcher gets the compiled matcher object
	GetCompiledMatcher(compiler cel.ConditionCompiler) matchconditions.Matcher

	// GetName gets the webhook Name field. Note that the name is scoped to the webhook
	// configuration and does not provide a globally unique identity, if a unique identity is
	// needed, use GetUID.
	GetName() string
	// GetClientConfig gets the webhook ClientConfig field.
	GetClientConfig() v1.WebhookClientConfig
	// GetRules gets the webhook Rules field.
	GetRules() []v1.RuleWithOperations
	// GetFailurePolicy gets the webhook FailurePolicy field.
	GetFailurePolicy() *v1.FailurePolicyType
	// GetMatchPolicy gets the webhook MatchPolicy field.
	GetMatchPolicy() *v1.MatchPolicyType
	// GetNamespaceSelector gets the webhook NamespaceSelector field.
	GetNamespaceSelector() *metav1.LabelSelector
	// GetObjectSelector gets the webhook ObjectSelector field.
	GetObjectSelector() *metav1.LabelSelector
	// GetSideEffects gets the webhook SideEffects field.
	GetSideEffects() *v1.SideEffectClass
	// GetTimeoutSeconds gets the webhook TimeoutSeconds field.
	GetTimeoutSeconds() *int32
	// GetAdmissionReviewVersions gets the webhook AdmissionReviewVersions field.
	GetAdmissionReviewVersions() []string

	// GetMatchConditions gets the webhook match conditions field.
	GetMatchConditions() []v1.MatchCondition

	// GetMutatingWebhook if the accessor contains a MutatingWebhook, returns it and true, else returns false.
	GetMutatingWebhook() (*v1.MutatingWebhook, bool)
	// GetValidatingWebhook if the accessor contains a ValidatingWebhook, returns it and true, else returns false.
	GetValidatingWebhook() (*v1.ValidatingWebhook, bool)

	// GetType returns the type of the accessor (validate or admit)
	GetType() string
}

WebhookAccessor provides a common interface to both mutating and validating webhook types.

func NewMutatingWebhookAccessor

func NewMutatingWebhookAccessor(uid, configurationName string, h *v1.MutatingWebhook) WebhookAccessor

NewMutatingWebhookAccessor creates an accessor for a MutatingWebhook.

func NewValidatingWebhookAccessor

func NewValidatingWebhookAccessor(uid, configurationName string, h *v1.ValidatingWebhook) WebhookAccessor

NewValidatingWebhookAccessor creates an accessor for a ValidatingWebhook.

Source Files

accessors.go

Directories

PathSynopsis
pkg/admission/plugin/webhook/config
pkg/admission/plugin/webhook/config/apis
pkg/admission/plugin/webhook/config/apis/webhookadmission
pkg/admission/plugin/webhook/config/apis/webhookadmission/installPackage install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/admission/plugin/webhook/config/apis/webhookadmission/v1Package v1 is the v1 version of the API.
pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1Package v1alpha1 is the v1alpha1 version of the API.
pkg/admission/plugin/webhook/errorsPackage errors contains utilities for admission webhook specific errors
pkg/admission/plugin/webhook/generic
pkg/admission/plugin/webhook/initializer
pkg/admission/plugin/webhook/matchconditions
pkg/admission/plugin/webhook/mutatingPackage mutating delegates admission checks to dynamically configured mutating webhooks.
pkg/admission/plugin/webhook/predicates
pkg/admission/plugin/webhook/predicates/namespacePackage namespace defines the utilities that are used by the webhook plugin to decide if a webhook should be applied to an object based on its namespace.
pkg/admission/plugin/webhook/predicates/objectPackage object defines the utilities that are used by the webhook plugin to decide if a webhook should run, as long as either the old object or the new object has labels matching the webhook config's objectSelector.
pkg/admission/plugin/webhook/predicates/rules
pkg/admission/plugin/webhook/requestPackage request creates admissionReview request based on admission attributes.
pkg/admission/plugin/webhook/testcertsPackage testcerts contains generated key pairs used by the unit tests of mutating and validating webhooks.
pkg/admission/plugin/webhook/testing
pkg/admission/plugin/webhook/testing/main
pkg/admission/plugin/webhook/util
pkg/admission/plugin/webhook/validatingPackage validating makes calls to validating (i.e., non-mutating) webhooks during the admission process.
Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
13 packages
Last checked
1 hour ago

Tools for package owners.