Documentation ¶
Index ¶
- Constants
- func DetectConfigurationAndWebhook(path string) (configurationID string, webhookID string)
- type ValidatingEventHandlerFn
- type ValidatingWebhookConfig
- type WebhookHandler
- type WebhookManager
- type WebhookResource
- func (w *WebhookResource) AddWebhook(config *ValidatingWebhookConfig)
- func (w *WebhookResource) CreateConfiguration() error
- func (w *WebhookResource) CreateOrUpdateConfiguration(conf *v1.ValidatingWebhookConfiguration) error
- func (w *WebhookResource) CreateWebhookPath(webhook *ValidatingWebhookConfig) *string
- func (w *WebhookResource) DeleteConfiguration() error
- func (w *WebhookResource) UpdateConfiguration() error
- type WebhookSettings
Constants ¶
View Source
const DefaultConfigurationId = "hooks"
DefaultConfigurationId is a ConfigurationId for ValidatingWebhookConfiguration without suffix.
Variables ¶
This section is empty.
Functions ¶
func DetectConfigurationAndWebhook ¶
DetectConfigurationAndWebhook extracts configurationID and a webhookID from the url path.
Types ¶
type ValidatingEventHandlerFn ¶
type ValidatingEventHandlerFn func(event ValidatingEvent) (*ValidatingResponse, error)
type ValidatingWebhookConfig ¶
type ValidatingWebhookConfig struct { *v1.ValidatingWebhook Metadata struct { Name string WebhookId string ConfigurationId string // A suffix to create different ValidatingWebhookConfiguration resources. DebugName string LogLabels map[string]string MetricLabels map[string]string } }
ValidatingWebhookConfig
func (*ValidatingWebhookConfig) UpdateIds ¶
func (c *ValidatingWebhookConfig) UpdateIds(confID, webhookID string)
UpdateIds use confId and webhookId to set a ConfigurationId prefix and a WebhookId.
type WebhookHandler ¶
type WebhookHandler struct { Manager *WebhookManager Router chi.Router }
func NewWebhookHandler ¶
func NewWebhookHandler() *WebhookHandler
func (*WebhookHandler) HandleReviewRequest ¶
func (h *WebhookHandler) HandleReviewRequest(path string, body []byte) (*v1.AdmissionReview, error)
func (*WebhookHandler) ServeReviewRequest ¶
func (h *WebhookHandler) ServeReviewRequest(w http.ResponseWriter, r *http.Request)
type WebhookManager ¶
type WebhookManager struct { KubeClient klient.Client ValidatingEventHandlerFn ValidatingEventHandlerFn Settings *WebhookSettings Namespace string DefaultConfigurationId string Server *server.WebhookServer Resources map[string]*WebhookResource 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
func NewWebhookManager ¶
func NewWebhookManager() *WebhookManager
func (*WebhookManager) AddWebhook ¶
func (m *WebhookManager) AddWebhook(config *ValidatingWebhookConfig)
func (*WebhookManager) Start ¶
func (m *WebhookManager) Start() error
func (*WebhookManager) WithKubeClient ¶
func (m *WebhookManager) WithKubeClient(kubeClient klient.Client)
func (*WebhookManager) WithValidatingEventHandler ¶
func (m *WebhookManager) WithValidatingEventHandler(handler ValidatingEventHandlerFn)
type WebhookResource ¶
type WebhookResource struct { KubeClient klient.Client Webhooks map[string]*ValidatingWebhookConfig Namespace string ConfigurationName string ServiceName string CABundle []byte }
func NewWebhookResource ¶
func NewWebhookResource() *WebhookResource
func (*WebhookResource) AddWebhook ¶
func (w *WebhookResource) AddWebhook(config *ValidatingWebhookConfig)
func (*WebhookResource) CreateConfiguration ¶
func (w *WebhookResource) CreateConfiguration() error
func (*WebhookResource) CreateOrUpdateConfiguration ¶
func (w *WebhookResource) CreateOrUpdateConfiguration(conf *v1.ValidatingWebhookConfiguration) error
func (*WebhookResource) CreateWebhookPath ¶
func (w *WebhookResource) CreateWebhookPath(webhook *ValidatingWebhookConfig) *string
func (*WebhookResource) DeleteConfiguration ¶
func (w *WebhookResource) DeleteConfiguration() error
func (*WebhookResource) UpdateConfiguration ¶
func (w *WebhookResource) UpdateConfiguration() error
Click to show internal directories.
Click to hide internal directories.