cmd

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 8 Imported by: 86

Documentation

Index

Constants

View Source
const (
	// ModeFlag is the name of the command line flag to specify the webhook config mode.
	ModeFlag = "webhook-config-mode"
	// URLFlag is the name of the command line flag to specify the URL that is used to register the webhooks in Kubernetes.
	URLFlag = "webhook-config-url"
	// NamespaceFlag is the name of the command line flag to specify the webhook config namespace for 'service' mode.
	NamespaceFlag = "webhook-config-namespace"
)
View Source
const DisableFlag = "disable-webhooks"

DisableFlag is the name of the command line flag to disable individual webhooks.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddToManagerConfig

type AddToManagerConfig struct {
	Server ServerConfig
	Switch SwitchConfig
	// contains filtered or unexported fields
}

AddToManagerConfig is a completed AddToManager configuration.

func (*AddToManagerConfig) AddToManager

AddToManager instantiates all webhooks of this configuration. If there are any webhooks, it creates a webhook server, registers the webhooks and adds the server to the manager. Otherwise, it is a no-op. It generates and registers the seed targeted webhooks via a Mutatingwebhookconfiguration.

type AddToManagerOptions

type AddToManagerOptions struct {
	Server ServerOptions
	Switch SwitchOptions
	// contains filtered or unexported fields
}

AddToManagerOptions are options to create an `AddToManager` function from ServerOptions and SwitchOptions.

func NewAddToManagerOptions

func NewAddToManagerOptions(serverName string, serverOpts *ServerOptions, switchOpts *SwitchOptions) *AddToManagerOptions

NewAddToManagerOptions creates new AddToManagerOptions with the given server name, server, and switch options. It is supposed to be used for webhooks which should be automatically registered in the cluster via a Mutatingwebhookconfiguration.

func (*AddToManagerOptions) AddFlags

func (c *AddToManagerOptions) AddFlags(fs *pflag.FlagSet)

AddFlags implements Option.

func (*AddToManagerOptions) Complete

func (c *AddToManagerOptions) Complete() error

Complete implements Option.

func (*AddToManagerOptions) Completed

func (c *AddToManagerOptions) Completed() *AddToManagerConfig

Completed returns the completed AddToManagerConfig. Only call this if a previous call to `Complete` succeeded.

type AddToManagerSimple added in v1.4.0

type AddToManagerSimple struct {
	Switch SwitchConfig
}

AddToManagerSimple is a completed AddToManager configuration w/o webhook registration.

func (*AddToManagerSimple) AddToManager added in v1.4.0

func (s *AddToManagerSimple) AddToManager(mgr manager.Manager) error

AddToManager makes the configured webhooks known to the given manager. The registration for these webhooks must happen separately via Validatingwebhookconfiguration or Mutatingwebhookconfiguration.

type AddToManagerSimpleOptions added in v1.4.0

type AddToManagerSimpleOptions struct {
	Switch SwitchOptions
}

AddToManagerSimpleOptions are options to create an `AddToManager` function from SwitchOptions.

func NewAddToManagerSimpleOptions added in v1.4.0

func NewAddToManagerSimpleOptions(switchOpts *SwitchOptions) *AddToManagerSimpleOptions

NewAddToManagerSimpleOptions creates new AddToManagerSimpleOptions with the given switch options. It can be used for webhooks which are required to run only without an automatic registration in the K8s cluster. Hence, Validatingwebhookconfiguration or Mutatingwebhookconfiguration must be created separately.

func (*AddToManagerSimpleOptions) AddFlags added in v1.4.0

func (o *AddToManagerSimpleOptions) AddFlags(fs *pflag.FlagSet)

AddFlags implements Option.

func (*AddToManagerSimpleOptions) Complete added in v1.4.0

func (o *AddToManagerSimpleOptions) Complete() error

Complete implements Option.

func (*AddToManagerSimpleOptions) Completed added in v1.4.0

Completed returns the completed AddToManagerSimpleOptions. Only call this if a previous call to `Complete` succeeded.

type FactoryAggregator added in v1.4.0

type FactoryAggregator []func(manager.Manager) (*extensionswebhook.Webhook, error)

FactoryAggregator aggregates various Factory functions.

func NewFactoryAggregator added in v1.4.0

func NewFactoryAggregator(m []func(manager.Manager) (*extensionswebhook.Webhook, error)) FactoryAggregator

NewFactoryAggregator creates a new FactoryAggregator and registers the given functions.

func (*FactoryAggregator) Register added in v1.4.0

Register registers the given functions in this builder.

func (*FactoryAggregator) Webhooks added in v1.4.0

Webhooks calls all factories with the given managers and returns all created webhooks. As soon as there is an error creating a webhook, the error is returned immediately.

type NameToFactory

type NameToFactory struct {
	Name string
	Func func(manager.Manager) (*extensionswebhook.Webhook, error)
}

NameToFactory binds a specific name to a webhook's factory function.

func Switch

Switch binds the given name to the given AddToManager function.

type ServerConfig

type ServerConfig struct {
	// Mode is the URl that is used to register the webhooks in Kubernetes.
	Mode string
	// URL is the URl that is used to register the webhooks in Kubernetes.
	URL string
	// Namespace is the webhook config namespace for 'service' mode.
	Namespace string
}

ServerConfig is a completed webhook server configuration.

type ServerOptions

type ServerOptions struct {
	// Mode is the URl that is used to register the webhooks in Kubernetes.
	Mode string
	// URL is the URl that is used to register the webhooks in Kubernetes.
	URL string
	// Namespace is the webhook config namespace for 'service' mode.
	Namespace string
	// contains filtered or unexported fields
}

ServerOptions are command line options that can be set for ServerConfig.

func (*ServerOptions) AddFlags

func (w *ServerOptions) AddFlags(fs *pflag.FlagSet)

AddFlags implements Flagger.AddFlags.

func (*ServerOptions) Complete

func (w *ServerOptions) Complete() error

Complete implements Completer.Complete.

func (*ServerOptions) Completed

func (w *ServerOptions) Completed() *ServerConfig

Completed returns the completed ServerConfig. Only call this if `Complete` was successful.

type SwitchConfig

type SwitchConfig struct {
	WebhooksFactory func(manager.Manager) ([]*extensionswebhook.Webhook, error)
}

SwitchConfig is the completed configuration of SwitchOptions.

type SwitchOptions

type SwitchOptions struct {
	Disabled []string
	// contains filtered or unexported fields
}

SwitchOptions are options to build an AddToManager function that filters the disabled webhooks.

func NewSwitchOptions

func NewSwitchOptions(pairs ...NameToFactory) *SwitchOptions

NewSwitchOptions creates new SwitchOptions with the given initial pairs.

func (*SwitchOptions) AddFlags

func (w *SwitchOptions) AddFlags(fs *pflag.FlagSet)

AddFlags implements Option.

func (*SwitchOptions) Complete

func (w *SwitchOptions) Complete() error

Complete implements Option.

func (*SwitchOptions) Completed

func (w *SwitchOptions) Completed() *SwitchConfig

Completed returns the completed SwitchConfig. Call this only after successfully calling `Completed`.

func (*SwitchOptions) Register

func (w *SwitchOptions) Register(pairs ...NameToFactory)

Register registers the given NameToWebhookFuncs in the options.

Jump to

Keyboard shortcuts

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