Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToGVK

ConvertToGVK converts object to the desired gvk.

Types

type Dispatcher

type Dispatcher interface {
	// Dispatch a request to the webhooks using the given webhooks. A non-nil error means the request is rejected.
	Dispatch(ctx context.Context, a *VersionedAttributes, o admission.ObjectInterfaces, hooks []*v1beta1.Webhook) error
}

Dispatcher dispatches webhook call to a list of webhooks with admission attributes as argument.

type Source

type Source interface {
	Webhooks() []v1beta1.Webhook
	HasSynced() bool
}

Source can list dynamic webhook plugins.

type VersionedAttributes

type VersionedAttributes struct {
	admission.Attributes
	VersionedOldObject runtime.Object
	VersionedObject    runtime.Object
}

VersionedAttributes is a wrapper around the original admission attributes, adding versioned variants of the object and old object.

type Webhook

type Webhook struct {
	*admission.Handler
	// contains filtered or unexported fields
}

Webhook is an abstract admission plugin with all the infrastructure to define Admit or Validate on-top.

func NewWebhook

func NewWebhook(handler *admission.Handler, configFile io.Reader, sourceFactory sourceFactory, dispatcherFactory dispatcherFactory) (*Webhook, error)

NewWebhook creates a new generic admission webhook.

func (*Webhook) Dispatch

Dispatch is called by the downstream Validate or Admit methods.

func (*Webhook) SetAuthenticationInfoResolverWrapper

func (a *Webhook) SetAuthenticationInfoResolverWrapper(wrapper webhook.AuthenticationInfoResolverWrapper)

SetAuthenticationInfoResolverWrapper sets the AuthenticationInfoResolverWrapper. TODO find a better way wire this, but keep this pull small for now.

func (*Webhook) SetExternalKubeClientSet

func (a *Webhook) SetExternalKubeClientSet(client clientset.Interface)

SetExternalKubeClientSet implements the WantsExternalKubeInformerFactory interface. It sets external ClientSet for admission plugins that need it

func (*Webhook) SetExternalKubeInformerFactory

func (a *Webhook) SetExternalKubeInformerFactory(f informers.SharedInformerFactory)

SetExternalKubeInformerFactory implements the WantsExternalKubeInformerFactory interface.

func (*Webhook) SetServiceResolver

func (a *Webhook) SetServiceResolver(sr webhook.ServiceResolver)

SetServiceResolver sets a service resolver for the webhook admission plugin. Passing a nil resolver does not have an effect, instead a default one will be used.

func (*Webhook) ShouldCallHook

func (a *Webhook) ShouldCallHook(h *v1beta1.Webhook, attr admission.Attributes) (bool, *apierrors.StatusError)

ShouldCallHook makes a decision on whether to call the webhook or not by the attribute.

func (*Webhook) ValidateInitialization

func (a *Webhook) ValidateInitialization() error

ValidateInitialization implements the InitializationValidator interface.