webhook

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: Apache-2.0, MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const CLUSTER_MAIN = "<MAIN>"
View Source
const CONVERTING = WebhookKind("converting")
View Source
const MUTATING = WebhookKind("mutating")
View Source
const VALIDATING = WebhookKind("validating")
View Source
const WEBHOOK_SET_PREFIX = "webhook."

Variables

This section is empty.

Functions

func NewWebhook

func NewWebhook(ext *Extension, def Definition, cluster cluster.Interface) (*webhook, error)

func Register

func Register(reg Registerable, group ...string) error

func RegisterKindHandlerProvider

func RegisterKindHandlerProvider(kind WebhookKind, p WebhookKindHandlerProvider)

func RegisterRegistrationHandler

func RegisterRegistrationHandler(r RegistrationHandler)

Types

type Configuration

type Configuration struct {
	// contains filtered or unexported fields
}

func Configure

func Configure(name string) Configuration

func (Configuration) ActivateExplicitly

func (this Configuration) ActivateExplicitly() Configuration

func (Configuration) BoolOption

func (this Configuration) BoolOption(name string, desc string) Configuration

func (Configuration) Cluster

func (this Configuration) Cluster(name string) Configuration

func (Configuration) DefaultedBoolOption

func (this Configuration) DefaultedBoolOption(name string, def bool, desc string) Configuration

func (Configuration) DefaultedDurationOption

func (this Configuration) DefaultedDurationOption(name string, def time.Duration, desc string) Configuration

func (Configuration) DefaultedIntOption

func (this Configuration) DefaultedIntOption(name string, def int, desc string) Configuration

func (Configuration) DefaultedStringArrayOption

func (this Configuration) DefaultedStringArrayOption(name string, def []string, desc string) Configuration

func (Configuration) DefaultedStringOption

func (this Configuration) DefaultedStringOption(name, def string, desc string) Configuration

func (Configuration) Definition

func (this Configuration) Definition() Definition

func (Configuration) DurationOption

func (this Configuration) DurationOption(name string, desc string) Configuration

func (Configuration) IntOption

func (this Configuration) IntOption(name string, desc string) Configuration

func (Configuration) Kind

func (this Configuration) Kind(factory HandlerFactory) Configuration

func (Configuration) MustRegister

func (this Configuration) MustRegister() Configuration

func (Configuration) MustRegisterAt

func (this Configuration) MustRegisterAt(registry RegistrationInterface) Configuration

func (Configuration) Name

func (this Configuration) Name(name string) Configuration

func (Configuration) OptionSource

func (this Configuration) OptionSource(name string, creator extension.OptionSourceCreator) Configuration

func (Configuration) OptionsByExample

func (this Configuration) OptionsByExample(name string, proto config.OptionSource) Configuration

func (Configuration) Register

func (this Configuration) Register() error

func (Configuration) RegisterAt

func (this Configuration) RegisterAt(registry RegistrationInterface) error

func (Configuration) Resource

func (this Configuration) Resource(group, kind string) Configuration

func (Configuration) Restore

func (this Configuration) Restore() Configuration

func (Configuration) Scheme

func (this Configuration) Scheme(scheme *runtime.Scheme) Configuration

func (Configuration) StringArrayOption

func (this Configuration) StringArrayOption(name string, desc string) Configuration

func (Configuration) StringOption

func (this Configuration) StringOption(name string, desc string) Configuration

func (Configuration) With

func (this Configuration) With(modifier ...ConfigurationModifier) Configuration

type ConfigurationModifier

type ConfigurationModifier func(c Configuration) Configuration

type Definition

type Definition interface {
	Name() string
	Resources() []extension.ResourceKey
	Scheme() *runtime.Scheme
	Kind() WebhookKind
	Handler() WebhookHandler
	Cluster() string
	ActivateExplicitly() bool

	ConfigOptions() map[string]OptionDefinition
	ConfigOptionSources() extension.OptionSourceDefinitions

	Definition() Definition
}

type Definitions

type Definitions interface {
	Get(name string) Definition
	Size() int
	Names() utils.StringSet
	Groups() groups.Definitions
	Registrations(names ...string) (Registrations, error)
	ExtendConfig(cfg *areacfg.Config)
}

func DefaultDefinitions

func DefaultDefinitions() Definitions

type Environment

type Environment interface {
	extension.Environment
	GetConfig() *areacfg.Config

	CreateWebhookClientConfig(msg string, def Definition, target resources.Cluster) (apiextensions.WebhookClientConfigSource, error)

	RegisterWebhookByName(name string, target cluster.Interface, client apiextensions.WebhookClientConfigSource) error
	RegisterWebhook(def Definition, target cluster.Interface, client apiextensions.WebhookClientConfigSource) error
	RegisterWebhookGroup(name string, target cluster.Interface, client apiextensions.WebhookClientConfigSource) error

	DeleteWebhookByName(name string, target cluster.Interface) error
	DeleteWebhook(def Definition, target cluster.Interface) error
}

type Extension

type Extension struct {
	extension.Environment
	// contains filtered or unexported fields
}

func NewExtension

func NewExtension(defs Definitions, cm extension.ControllerManager) (*Extension, error)

func (*Extension) CreateWebhookClientConfig

func (this *Extension) CreateWebhookClientConfig(msg string, def Definition, target resources.Cluster) (apiextensions.WebhookClientConfigSource, error)

func (*Extension) DeleteWebhook

func (this *Extension) DeleteWebhook(def Definition, target cluster.Interface) error

func (*Extension) DeleteWebhookByName

func (this *Extension) DeleteWebhookByName(name string, target cluster.Interface) error

func (*Extension) DeleteWebhookGroup

func (this *Extension) DeleteWebhookGroup(name string, target cluster.Interface) error

func (*Extension) GetConfig

func (this *Extension) GetConfig() *areacfg.Config

func (*Extension) Maintainer

func (this *Extension) Maintainer() string

func (*Extension) RegisterHandler

func (this *Extension) RegisterHandler(wh Interface) error

func (*Extension) RegisterWebhook

func (this *Extension) RegisterWebhook(def Definition, target cluster.Interface, client apiextensions.WebhookClientConfigSource) error

func (*Extension) RegisterWebhookByName

func (this *Extension) RegisterWebhookByName(name string, target cluster.Interface, client apiextensions.WebhookClientConfigSource) error

func (*Extension) RegisterWebhookGroup

func (this *Extension) RegisterWebhookGroup(name string, target cluster.Interface, client apiextensions.WebhookClientConfigSource) error

func (*Extension) RegistrationGroupName

func (this *Extension) RegistrationGroupName(name string) string

func (*Extension) RequiredClusters

func (this *Extension) RequiredClusters() (utils.StringSet, error)

func (*Extension) Setup

func (this *Extension) Setup(ctx context.Context) error

func (*Extension) Start

func (this *Extension) Start(ctx context.Context) error

type ExtensionDefinition

type ExtensionDefinition struct {
	extension.ExtensionDefinitionBase
	// contains filtered or unexported fields
}

func NewExtensionDefinition

func NewExtensionDefinition(defs Definitions) *ExtensionDefinition

func (*ExtensionDefinition) CreateExtension

func (*ExtensionDefinition) Description

func (this *ExtensionDefinition) Description() string

func (*ExtensionDefinition) ExtendConfig

func (this *ExtensionDefinition) ExtendConfig(cfg *parentcfg.Config)

func (*ExtensionDefinition) Names

func (this *ExtensionDefinition) Names() utils.StringSet

func (*ExtensionDefinition) Size

func (this *ExtensionDefinition) Size() int

func (*ExtensionDefinition) Validate

func (this *ExtensionDefinition) Validate() error

type ExtensionType

type ExtensionType struct {
	Registry
}

func NewExtensionType

func NewExtensionType() *ExtensionType

func (*ExtensionType) Definition

func (this *ExtensionType) Definition() extension.Definition

func (*ExtensionType) Name

func (this *ExtensionType) Name() string

type HandlerFactory

type HandlerFactory interface {
	CreateHandler() WebhookHandler
}

type Interface

type Interface interface {
	extension.ElementBase

	GetEnvironment() Environment
	GetDefinition() Definition
	GetCluster() cluster.Interface
	GetScheme() *runtime.Scheme
	GetKind() WebhookKind
	GetKindConfig() config.OptionSource
}

func GetWebhook

func GetWebhook(ctx context.Context) Interface

type MaintainedRegistration

type MaintainedRegistration struct {
	// contains filtered or unexported fields
}

type MaintainedRegistrations

type MaintainedRegistrations struct {
	// contains filtered or unexported fields
}

func (*MaintainedRegistrations) TriggerRegistrationUpdate

func (this *MaintainedRegistrations) TriggerRegistrationUpdate(ext *Extension)

type OptionDefinition

type OptionDefinition extension.OptionDefinition

type Registerable

type Registerable interface {
	Definition() Definition
}

type RegistrationContext

type RegistrationContext interface {
	logger.LogContext
	Maintainer() string
	Config() config.OptionSource
}

type RegistrationHandler

type RegistrationHandler interface {
	Kind() WebhookKind
	OptionSourceCreator() extension.OptionSourceCreator
	RequireDedicatedRegistrations() bool
	RegistrationNames(def Definition) []string
	RegistrationResource() runtime.Object
	CreateDeclarations(log logger.LogContext, def Definition, target cluster.Interface, client apiextensions.WebhookClientConfigSource) (WebhookDeclarations, error)
	Register(ctx RegistrationContext, labels map[string]string, cluster cluster.Interface, name string, declaration ...WebhookDeclaration) error
	Delete(log logger.LogContext, name string, def Definition, cluster cluster.Interface) error
}

func GetRegistrationHandler

func GetRegistrationHandler(kind WebhookKind) RegistrationHandler

type RegistrationHandlerBase

type RegistrationHandlerBase struct {
	// contains filtered or unexported fields
}

func NewRegistrationHandlerBase

func NewRegistrationHandlerBase(kind WebhookKind, obj runtime.Object) *RegistrationHandlerBase

func (*RegistrationHandlerBase) Kind

func (this *RegistrationHandlerBase) Kind() WebhookKind

func (*RegistrationHandlerBase) OptionSourceCreator

func (this *RegistrationHandlerBase) OptionSourceCreator() extension.OptionSourceCreator

func (*RegistrationHandlerBase) RegistrationNames

func (this *RegistrationHandlerBase) RegistrationNames(def Definition) []string

func (*RegistrationHandlerBase) RegistrationResource

func (this *RegistrationHandlerBase) RegistrationResource() runtime.Object

func (*RegistrationHandlerBase) RequireDedicatedRegistrations

func (this *RegistrationHandlerBase) RequireDedicatedRegistrations() bool

type RegistrationInterface

type RegistrationInterface interface {
	Register(reg Registerable, group ...string) error
	MustRegister(reg Registerable, group ...string) RegistrationInterface
}

func MustRegister

func MustRegister(reg Registerable, group ...string) RegistrationInterface

type RegistrationResources

type RegistrationResources map[WebhookKind]runtime.Object

func GetRegistrationResources

func GetRegistrationResources() RegistrationResources

type Registrations

type Registrations map[string]Definition

func (Registrations) Copy

func (this Registrations) Copy() Registrations

func (Registrations) Names

func (this Registrations) Names() utils.StringSet

type Registry

type Registry interface {
	RegistrationInterface
	GetDefinitions() Definitions
}

func DefaultRegistry

func DefaultRegistry() Registry

func NewRegistry

func NewRegistry() Registry

type ValidatorFunc

type ValidatorFunc func(Interface) error

func (ValidatorFunc) Validate

func (this ValidatorFunc) Validate(wh Interface) error

type WebhookConfig

type WebhookConfig struct {
	config.OptionSet
}

func NewWebhookConfig

func NewWebhookConfig(name string) *WebhookConfig

type WebhookDeclaration

type WebhookDeclaration interface {
	Kind() WebhookKind
}

type WebhookDeclarations

type WebhookDeclarations []WebhookDeclaration

type WebhookHandler

type WebhookHandler interface {
	GetKind() WebhookKind
	GetHTTPHandler(wh Interface) (http.Handler, error)

	String() string
}

type WebhookKind

type WebhookKind string

type WebhookKindHandler

type WebhookKindHandler interface {
	Register(Interface) error
}

WebhookKindHandler gets called by a webhook extension for every instance of a dedicated webhook kind it is created for by a WebhookKindHandlerProvider

type WebhookKindHandlerProvider

type WebhookKindHandlerProvider func(Environment, WebhookKind) (WebhookKindHandler, error)

WebhookKindHandlerProvider is registered for a dedicated kind and is called to create a dedicated kind handler for a dedicated kind used in a dedicated Webhook etension instance

type WebhookRegistrationGroup

type WebhookRegistrationGroup struct {
	// contains filtered or unexported fields
}

func NewWebhookRegistrationGroup

func NewWebhookRegistrationGroup(cluster cluster.Interface) *WebhookRegistrationGroup

func (*WebhookRegistrationGroup) AddDeclarations

func (this *WebhookRegistrationGroup) AddDeclarations(decls ...WebhookDeclaration)

func (*WebhookRegistrationGroup) AddRegistrations

func (this *WebhookRegistrationGroup) AddRegistrations(kind WebhookKind, names ...string)

type WebhookRegistrationGroups

type WebhookRegistrationGroups map[string]*WebhookRegistrationGroup

func (WebhookRegistrationGroups) GetOrCreateGroup

func (this WebhookRegistrationGroups) GetOrCreateGroup(cluster cluster.Interface) *WebhookRegistrationGroup

type WebhookValidator

type WebhookValidator interface {
	Validate(Interface) error
}

Directories

Path Synopsis
api
api/v1
Package v1 is the v1 version of the Conversion Review API.
Package v1 is the v1 version of the Conversion Review API.
api/v1beta1
Package v1beta1 is the v1beta1 version of the API.
Package v1beta1 is the v1beta1 version of the API.

Jump to

Keyboard shortcuts

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