Documentation
¶
Index ¶
- Constants
- type AdmissionEventHandlerFn
- type IWebhookConfig
- type Metadata
- type MutatingWebhookConfig
- type MutatingWebhookResource
- type ValidatingWebhookConfig
- type ValidatingWebhookResource
- type WebhookHandler
- type WebhookManager
- func (m *WebhookManager) AddMutatingWebhook(config *MutatingWebhookConfig)
- func (m *WebhookManager) AddValidatingWebhook(config *ValidatingWebhookConfig)
- func (m *WebhookManager) Init() error
- func (m *WebhookManager) Start() error
- func (m *WebhookManager) WithAdmissionEventHandler(handler AdmissionEventHandlerFn)
- func (m *WebhookManager) WithKubeClient(kubeClient klient.Client)
- type WebhookResourceOptions
- type WebhookSettings
Constants ¶
View Source
const DefaultConfigurationId = "hooks"
DefaultConfigurationId is a ConfigurationId for ValidatingWebhookConfiguration/MutatingWebhookConfiguration without suffix.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdmissionEventHandlerFn ¶
type AdmissionEventHandlerFn func(event AdmissionEvent) (*AdmissionResponse, error)
type IWebhookConfig ¶
type MutatingWebhookConfig ¶
type MutatingWebhookConfig struct { *v1.MutatingWebhook Metadata }
func (*MutatingWebhookConfig) GetMeta ¶
func (c *MutatingWebhookConfig) GetMeta() Metadata
func (*MutatingWebhookConfig) SetClientConfig ¶
func (c *MutatingWebhookConfig) SetClientConfig(cc v1.WebhookClientConfig)
func (*MutatingWebhookConfig) SetMeta ¶
func (c *MutatingWebhookConfig) SetMeta(m Metadata)
func (*MutatingWebhookConfig) UpdateIds ¶
func (c *MutatingWebhookConfig) UpdateIds(confID, webhookID string)
type MutatingWebhookResource ¶
type MutatingWebhookResource struct {
// contains filtered or unexported fields
}
func NewMutatingWebhookResource ¶
func NewMutatingWebhookResource(opts WebhookResourceOptions) *MutatingWebhookResource
func (*MutatingWebhookResource) Get ¶
func (w *MutatingWebhookResource) Get(id string) *MutatingWebhookConfig
func (*MutatingWebhookResource) Register ¶
func (w *MutatingWebhookResource) Register() error
func (*MutatingWebhookResource) Set ¶
func (w *MutatingWebhookResource) Set(whc *MutatingWebhookConfig)
func (*MutatingWebhookResource) Unregister ¶
func (w *MutatingWebhookResource) Unregister() error
type ValidatingWebhookConfig ¶
type ValidatingWebhookConfig struct { *v1.ValidatingWebhook Metadata }
func (*ValidatingWebhookConfig) GetMeta ¶
func (c *ValidatingWebhookConfig) GetMeta() Metadata
func (*ValidatingWebhookConfig) SetClientConfig ¶
func (c *ValidatingWebhookConfig) SetClientConfig(cc v1.WebhookClientConfig)
func (*ValidatingWebhookConfig) SetMeta ¶
func (c *ValidatingWebhookConfig) SetMeta(m Metadata)
func (*ValidatingWebhookConfig) UpdateIds ¶
func (c *ValidatingWebhookConfig) UpdateIds(confID, webhookID string)
UpdateIds use confId and webhookId to set a ConfigurationId prefix and a WebhookId.
type ValidatingWebhookResource ¶
type ValidatingWebhookResource struct {
// contains filtered or unexported fields
}
func NewValidatingWebhookResource ¶
func NewValidatingWebhookResource(opts WebhookResourceOptions) *ValidatingWebhookResource
func (*ValidatingWebhookResource) Get ¶
func (w *ValidatingWebhookResource) Get(id string) *ValidatingWebhookConfig
func (*ValidatingWebhookResource) Register ¶
func (w *ValidatingWebhookResource) Register() error
func (*ValidatingWebhookResource) Set ¶
func (w *ValidatingWebhookResource) Set(whc *ValidatingWebhookConfig)
func (*ValidatingWebhookResource) Unregister ¶
func (w *ValidatingWebhookResource) Unregister() error
type WebhookHandler ¶
type WebhookHandler struct { Router chi.Router Handler AdmissionEventHandlerFn }
func NewWebhookHandler ¶
func NewWebhookHandler() *WebhookHandler
type WebhookManager ¶
type WebhookManager struct { KubeClient klient.Client Settings *WebhookSettings Namespace string DefaultConfigurationId string Server *server.WebhookServer ValidatingResources map[string]*ValidatingWebhookResource MutatingResources map[string]*MutatingWebhookResource Handler *WebhookHandler }
WebhookManager is a public interface to be used from operator.go.
No dynamic configuration for now. The steps are:
- Init manager
- Call AddWebhook for every binding in hooks
- Start() to run server and create ValidatingWebhookConfiguration/MutatingWebhookConfiguration
func NewWebhookManager ¶
func NewWebhookManager() *WebhookManager
func (*WebhookManager) AddMutatingWebhook ¶
func (m *WebhookManager) AddMutatingWebhook(config *MutatingWebhookConfig)
func (*WebhookManager) AddValidatingWebhook ¶
func (m *WebhookManager) AddValidatingWebhook(config *ValidatingWebhookConfig)
func (*WebhookManager) Start ¶
func (m *WebhookManager) Start() error
func (*WebhookManager) WithAdmissionEventHandler ¶
func (m *WebhookManager) WithAdmissionEventHandler(handler AdmissionEventHandlerFn)
func (*WebhookManager) WithKubeClient ¶
func (m *WebhookManager) WithKubeClient(kubeClient klient.Client)
type WebhookResourceOptions ¶
Click to show internal directories.
Click to hide internal directories.