Documentation ¶
Index ¶
Constants ¶
const ( // PortFlag is the name of the command line flag to specify the webhook server port. PortFlag = "webhook-server-port" // CertDirFlag is the name of the command line flag to specify the directory that contains the webhook server key and certificate. CertDirFlag = "webhook-server-cert-dir" // ModeFlag is the name of the command line flag to specify the webhook config mode, either 'service' or 'url'. ModeFlag = "webhook-config-mode" // NameFlag is the name of the command line flag to specify the webhook config name. NameFlag = "webhook-config-name" // NamespaceFlag is the name of the command line flag to specify the webhook config namespace for 'service' mode. NamespaceFlag = "webhook-config-namespace" // ServiceSelectorsFlag is the name of the command line flag to specify the webhook config service selectors as JSON for 'service' mode. ServiceSelectorsFlag = "webhook-config-service-selectors" // HostFlag is the name of the command line flag to specify the webhook config host for 'url' mode. HostFlag = "webhook-config-host" // DisableFlag is the name of the command line flag to disable individual webhooks. DisableFlag = "disable-webhooks" )
const ( ServiceMode = "service" URLMode = "url" )
Webhook config modes
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 ¶
func (c *AddToManagerConfig) AddToManager(mgr manager.Manager) 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.
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
Compoleted returns the completed AddToManagerConfig. Only call this if a previous call to `Complete` succeeded.
type NameToFactory ¶
NameToFactory binds a specific name to a webhook's factory function.
type ServerConfig ¶
type ServerConfig struct { // Port is the webhook server port. Port int32 // CertDir is the directory that contains the webhook server key and certificate. CertDir string // BootstrapOptions contains the options for bootstrapping the webhook server. BootstrapOptions *webhook.BootstrapOptions }
ServerConfig is a completed webhook server configuration.
func (*ServerConfig) Options ¶
func (w *ServerConfig) Options() webhook.ServerOptions
Options returns the webhook.ServerOptions of this ServerConfig.
type ServerOptions ¶
type ServerOptions struct { // Port is the webhook server port. Port int32 // CertDir is the directory that contains the webhook server key and certificate. CertDir string // Mode is the webhook config mode, either 'service' or 'url' Mode string // Name is the webhook config name. Name string // Namespace is the webhook config namespace for 'service' mode. Namespace string // ServiceSelectors is the webhook config service selectors as JSON for 'service' mode. ServiceSelectors string // Host is the webhook config host for 'url' mode. Host 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 ¶
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.