generic

package
v1.13.11 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: Apache-2.0, Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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, 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

func (a *Webhook) Dispatch(attr admission.Attributes) error

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) SetScheme

func (a *Webhook) SetScheme(scheme *runtime.Scheme)

SetScheme sets a serializer(NegotiatedSerializer) which is derived from the scheme

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.

Jump to

Keyboard shortcuts

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