admission

package
v1.14.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateInitialization

func ValidateInitialization(plugin Interface) error

ValidateInitialization will call the InitializationValidate function in each plugin if they implement the InitializationValidator interface.

Types

type Factory

type Factory func() (Interface, error)

Factory constructs an admission plugin. This may be used in future to provide an `io.Reader` to the plugin to be used for loading plugin specific configuration.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(ops ...admissionv1.Operation) *Handler

func (Handler) Handles

func (h Handler) Handles(operation admissionv1.Operation) bool

type InitializationValidator

type InitializationValidator interface {
	ValidateInitialization() error
}

InitializationValidator holds ValidateInitialization functions, which are responsible for validation of initialized shared resources and should be implemented on admission plugins

type Interface

type Interface interface {
	Handles(admissionv1.Operation) bool
}

Interface is the base admission interface

type MutationInterface

type MutationInterface interface {
	Interface

	Mutate(ctx context.Context, request admissionv1.AdmissionRequest, obj runtime.Object) (err error)
}

MutationInterface defines an admission handler that validates requests. It may not perform any kind of mutation.

type PluginChain

type PluginChain []Interface

func (PluginChain) Handles

func (pc PluginChain) Handles(operation admissionv1.Operation) bool

func (PluginChain) Mutate

func (PluginChain) Validate

func (pc PluginChain) Validate(ctx context.Context, request admissionv1.AdmissionRequest, oldObj, obj runtime.Object) ([]string, error)

type PluginInitializer

type PluginInitializer interface {
	Initialize(plugin Interface)
}

PluginInitializer is used for initialization of shareable resources between admission plugins. After initialization the resources have to be set separately

type Plugins

type Plugins struct {
	// contains filtered or unexported fields
}

Plugins manages initialising, registering and executing admission plugins for both validation and mutation.

func NewPlugins

func NewPlugins(scheme *runtime.Scheme) *Plugins

func (*Plugins) InitPlugin

func (ps *Plugins) InitPlugin(name string, pluginInitializer PluginInitializer) (Interface, error)

func (*Plugins) NewFromPlugins

func (ps *Plugins) NewFromPlugins(names []string, pluginInitializer PluginInitializer) (Interface, error)

func (*Plugins) Register

func (ps *Plugins) Register(name string, factory Factory)

type RequestHandler

type RequestHandler struct {
	// contains filtered or unexported fields
}

RequestHandler is an implementation of the webhook's request handling that invokes a validating and/or mutating admission plugin (or chain of plugins).

All runtime.Objects passed to the mutation and validation handlers will be in their internal versions to make handling multiple API versions easier.

During mutation, objects will be decoded using the scheme provided during the NewRequestHandler call. This scheme will also be used to invoke defaulting functions when the object is decoded. This means that all resources passed to mutating admission plugins will have default values applied before converting them into the internal version.

func NewRequestHandler

func NewRequestHandler(scheme *runtime.Scheme, validator ValidationInterface, mutator MutationInterface) *RequestHandler

NewRequestHandler will construct a new request handler using the given scheme for conversion & defaulting. Either validator or mutator can be nil, and if so no action will be taken.

func (*RequestHandler) Mutate

func (*RequestHandler) Validate

Validate will decode the Object (and OldObject, if set) in the AdmissionRequest into the internal API version. It will then invoke the validation handler to build a list of warning messages and any errors generated during the admission chain.

type ValidationInterface

type ValidationInterface interface {
	Interface

	Validate(ctx context.Context, request admissionv1.AdmissionRequest, oldObj, obj runtime.Object) (warnings []string, err error)
}

ValidationInterface defines an admission handler that validates requests. It may not perform any kind of mutation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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