admission

package
v0.0.0-...-f701a6a Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceHandler

type ResourceHandler interface {
	OnCreate(obj runtime.Object) (runtime.Object, error)
	OnUpdate(oldObj, newObj runtime.Object) (runtime.Object, error)
	OnDelete(obj runtime.Object) error
}

ResourceHandler can handle admission requests that happen to a resource.

  • OnCreate is called when an object is created. If an error is returned admission is denied. Otherwise, if an object is returned, it is used to compute a patch and should be used as MutatingAdmissionWebhook.
  • OnUpdate is called when an object is updated. Note that oldObj is the existing object. If an error is returned admission is denied. Otherwise, if an object is returned, it is used to compute a patch and should be used as MutatingAdmissionWebhook.
  • OnDelete will gets the current state of object when delete request is received.

type ResourceHandlerFuncs

type ResourceHandlerFuncs struct {
	CreateFunc func(obj runtime.Object) (runtime.Object, error)
	UpdateFunc func(oldObj, newObj runtime.Object) (runtime.Object, error)
	DeleteFunc func(obj runtime.Object) error
}

ResourceHandlerFuncs is an adaptor to let you easily specify as many or as few of the notification functions as you want while still implementing ResourceHandler.

func (ResourceHandlerFuncs) OnCreate

OnCreate calls CreateFunc if it's not nil.

func (ResourceHandlerFuncs) OnDelete

func (r ResourceHandlerFuncs) OnDelete(obj runtime.Object) error

OnDelete calls DeleteFunc if it's not nil.

func (ResourceHandlerFuncs) OnUpdate

func (r ResourceHandlerFuncs) OnUpdate(oldObj, newObj runtime.Object) (runtime.Object, error)

OnUpdate calls UpdateFunc if it's not nil.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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