webhook

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextGetAdmissionRequest

func ContextGetAdmissionRequest(ctx context.Context) *admission.Request

func ContextWithAdmissionRequest

func ContextWithAdmissionRequest(ctx context.Context, req admission.Request) context.Context

func MutatingWebhookForMutator

func MutatingWebhookForMutator(mutator Mutator) *admission.Webhook

MutatingWebhookForMutator creates a new mutating Webhook.

func ValidatingWebhookForValidator

func ValidatingWebhookForValidator(validator Validator) *admission.Webhook

ValidatingWebhookForValidator creates a new validating Webhook.

Types

type Mutator

type Mutator interface {
	// Prototype returns a prototype of Object for this admission request.
	Prototype(req admission.Request) (runtime.Object, error)

	// MutateCreate handles Object creation and returns the object after mutation and error if any.
	MutateCreate(ctx context.Context, obj runtime.Object) (runtime.Object, error)
	// MutateUpdate handles Object update and returns the object after mutation and error if any.
	MutateUpdate(ctx context.Context, obj runtime.Object, oldObj runtime.Object) (runtime.Object, error)
}

Mutator defines interface for a mutation webHook

type Validator

type Validator interface {
	// Prototype returns a prototype of Object for this admission request.
	Prototype(req admission.Request) (runtime.Object, error)

	// ValidateCreate handles Object creation and returns error if any.
	ValidateCreate(ctx context.Context, obj runtime.Object) error
	// ValidateUpdate handles Object update and returns error if any.
	ValidateUpdate(ctx context.Context, obj runtime.Object, oldObj runtime.Object) error
	// ValidateDelete handles Object deletion and returns error if any.
	ValidateDelete(ctx context.Context, obj runtime.Object) error
}

Validator defines interface for a validation webHook

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL