cmd

package
v1.110.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 16 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"
	// ServicePortFlag is the name of the command line flag to specify the service port that exposes the webhook server.
	// If not specified it will fall back to the webhook server port.
	ServicePortFlag = "webhook-config-service-port"
	// NamespaceFlag is the name of the command line flag to specify the webhook config namespace where CA bundles, services etc. of the webhook are created.
	NamespaceFlag = "webhook-config-namespace"
	// OwnerNamespaceFlag is the name of the command line flag to specify the namespace which is used as the owner reference for the webhook registration.
	OwnerNamespaceFlag = "webhook-config-owner-namespace"
)
View Source
const (
	// DisableFlag is the name of the command line flag to disable individual webhooks.
	DisableFlag = "disable-webhooks"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddToManagerConfig

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

AddToManagerConfig is a completed AddToManager configuration.

func (*AddToManagerConfig) AddToManager

func (c *AddToManagerConfig) AddToManager(ctx context.Context, mgr manager.Manager, sourceCluster cluster.Cluster) (*atomic.Value, error)

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(extensionName string, shootWebhookManagedResourceName string, shootNamespaceSelector map[string]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 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 webhook client config mode (service or url).
	Mode string
	// URL is the URL that is used to register the webhooks in Kubernetes.
	URL string
	// ServicePort is the service port that exposes the webhook server.
	ServicePort int
	// Namespace is the webhook config namespace where CA bundles, services etc. of the webhook are created.
	Namespace string
	// OwnerNamespace is the namespace which is used as the owner reference for the webhook registration.
	OwnerNamespace 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
	// ServicePort is the service port that exposes the webhook server.
	ServicePort int
	// Namespace is the webhook config namespace where CA bundles, services etc. of the webhook are created.
	Namespace string
	// OwnerNamespace is the namespace which is used as the owner reference for the webhook registration.
	OwnerNamespace 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 {
	Disabled        bool
	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