Documentation ¶
Overview ¶
Package webhook contains utilities for building Kubernetes webhooks.
Index ¶
- type MutateFn
- type Mutator
- type MutatorOption
- type ValidateCreateFn
- type ValidateDeleteFn
- type ValidateUpdateFn
- type Validator
- func (vc *Validator) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error)
- func (vc *Validator) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error)
- func (vc *Validator) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error)
- type ValidatorOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mutator ¶
type Mutator struct {
MutationChain []MutateFn
}
Mutator satisfies CustomDefaulter interface with an ordered MutateFn list.
func NewMutator ¶
func NewMutator(opts ...MutatorOption) *Mutator
NewMutator returns a new instance of Mutator that can be used as CustomDefaulter.
type MutatorOption ¶
type MutatorOption func(*Mutator)
MutatorOption configures given Mutator.
func WithMutationFns ¶
func WithMutationFns(fns ...MutateFn) MutatorOption
WithMutationFns allows you to initiate the mutator with given list of mutator functions.
type ValidateCreateFn ¶
ValidateCreateFn is function type for creation validation.
type ValidateDeleteFn ¶
ValidateDeleteFn is function type for deletion validation.
type ValidateUpdateFn ¶
type ValidateUpdateFn func(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error)
ValidateUpdateFn is function type for update validation.
type Validator ¶
type Validator struct { CreationChain []ValidateCreateFn UpdateChain []ValidateUpdateFn DeletionChain []ValidateDeleteFn }
Validator runs the given validation chains in order.
func NewValidator ¶
func NewValidator(opts ...ValidatorOption) *Validator
NewValidator returns a new Validator with no-op defaults.
func (*Validator) ValidateCreate ¶
func (vc *Validator) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error)
ValidateCreate runs functions in creation chain in order.
type ValidatorOption ¶
type ValidatorOption func(*Validator)
ValidatorOption allows you to configure given Validator.
func WithValidateCreationFns ¶
func WithValidateCreationFns(fns ...ValidateCreateFn) ValidatorOption
WithValidateCreationFns initializes the Validator with given set of creation validation functions.
func WithValidateDeletionFns ¶
func WithValidateDeletionFns(fns ...ValidateDeleteFn) ValidatorOption
WithValidateDeletionFns initializes the Validator with given set of deletion validation functions.
func WithValidateUpdateFns ¶
func WithValidateUpdateFns(fns ...ValidateUpdateFn) ValidatorOption
WithValidateUpdateFns initializes the Validator with given set of update validation functions.