{"modulePath":"github.com/flant/shell-operator","version":"v1.0.0-rc.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package validating_webhook\n\n## Constants\n\n```go\nconst DefaultConfigurationId = \"hooks\"\n```\nDefaultConfigurationId is a ConfigurationId for ValidatingWebhookConfiguration without suffix.\n\n## Functions\n\n```go\nfunc DetectConfigurationAndWebhook(path string) (configurationId string, webhookId string)\n```\n\n## Types\n\n```go\ntype ValidatingEventHandlerFn func(event ValidatingEvent) (*ValidatingResponse, error)\n```\n\n```go\ntype ValidatingWebhookConfig struct {\n\t*v1.ValidatingWebhook\n\tMetadata struct {\n\t\tName            string\n\t\tWebhookId       string\n\t\tConfigurationId string // A suffix to create different ValidatingWebhookConfiguration resources.\n\t\tDebugName       string\n\t\tLogLabels       map[string]string\n\t\tMetricLabels    map[string]string\n\t}\n}\n```\nValidatingWebhookConfig\n\n```go\nfunc (c *ValidatingWebhookConfig) UpdateIds(confId, webhookId string)\n```\nUpdateIds use confId and webhookId to set a ConfigurationId prefix and a WebhookId.\n\n```go\ntype WebhookHandler struct {\n\tManager *WebhookManager\n\tRouter  chi.Router\n}\n```\n\n```go\nfunc NewWebhookHandler() *WebhookHandler\n```\n\n```go\nfunc (h *WebhookHandler) HandleReviewRequest(path string, body []byte) (*v1.AdmissionReview, error)\n```\n\n```go\nfunc (h *WebhookHandler) ServeReviewRequest(w http.ResponseWriter, r *http.Request)\n```\n\n```go\ntype WebhookManager struct {\n\tKubeClient kube.KubernetesClient\n\n\tValidatingEventHandlerFn ValidatingEventHandlerFn\n\n\tNamespace         string\n\tConfigurationName string\n\tServiceName       string\n\n\tCABundle               []byte\n\tDefaultConfigurationId string\n\n\tServer    *WebhookServer\n\tResources map[string]*WebhookResource\n\tHandler   *WebhookHandler\n}\n```\nWebhookManager is a public interface to be used from operator.go.\n\nNo dynamic configuration for now. The steps are:\n\n  - Init manager\n  - Call AddWEbhook for every binding in hooks\n  - Start() to run server and create ValidatingWebhookConfiguration\n\n```go\nfunc NewWebhookManager() *WebhookManager\n```\n\n```go\nfunc (m *WebhookManager) AddWebhook(config *ValidatingWebhookConfig)\n```\n\n```go\nfunc (m *WebhookManager) Init() error\n```\nInit creates dependencies\n\n```go\nfunc (m *WebhookManager) Start() error\n```\n\n```go\nfunc (m *WebhookManager) WithKubeClient(kubeClient kube.KubernetesClient)\n```\n\n```go\nfunc (m *WebhookManager) WithValidatingEventHandler(handler ValidatingEventHandlerFn)\n```\n\n```go\ntype WebhookResource struct {\n\tKubeClient        kube.KubernetesClient\n\tWebhooks          map[string]*ValidatingWebhookConfig\n\tNamespace         string\n\tConfigurationName string\n\tServiceName       string\n\tCABundle          []byte\n}\n```\n\n```go\nfunc NewWebhookResource() *WebhookResource\n```\n\n```go\nfunc (w *WebhookResource) AddWebhook(config *ValidatingWebhookConfig)\n```\n\n```go\nfunc (w *WebhookResource) CreateConfiguration() error\n```\n\n```go\nfunc (w *WebhookResource) CreateOrUpdateConfiguration(conf *v1.ValidatingWebhookConfiguration) error\n```\n\n```go\nfunc (w *WebhookResource) CreateWebhookPath(webhook *ValidatingWebhookConfig) *string\n```\n\n```go\nfunc (w *WebhookResource) DeleteConfiguration() error\n```\n\n```go\nfunc (w *WebhookResource) UpdateConfiguration() error\n```\n\n```go\ntype WebhookServer struct {\n\tRouter chi.Router\n}\n```\n\n```go\nfunc (s *WebhookServer) Start() error\n```\nStartWebhookServer starts https server to listen for AdmissionReview requests from cluster\n\n","path":"github.com/flant/shell-operator/pkg/validating_webhook","name":"validating_webhook","synopsis":"","isRedistributable":true}
