Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateInitialization ¶
ValidateInitialization will call the InitializationValidate function in each plugin if they implement the InitializationValidator interface.
Types ¶
type Factory ¶
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
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 (pc PluginChain) Mutate(ctx context.Context, request admissionv1.AdmissionRequest, obj runtime.Object) error
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 (*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)
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 (rh *RequestHandler) Mutate(ctx context.Context, admissionSpec *admissionv1.AdmissionRequest) *admissionv1.AdmissionResponse
func (*RequestHandler) Validate ¶
func (rh *RequestHandler) Validate(ctx context.Context, admissionSpec *admissionv1.AdmissionRequest) *admissionv1.AdmissionResponse
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.