cmd

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: May 20, 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.

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.

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