MCPcopy Create free account
hub / github.com/devfile/devworkspace-operator / ConfigureWebhookServer

Function ConfigureWebhookServer

webhook/server/server.go:73–101  ·  view source on GitHub ↗
(mgr manager.Manager)

Source from the content-addressed store, hash-verified

71}
72
73func ConfigureWebhookServer(mgr manager.Manager) error {
74 enabled, err := infrastructure.IsWebhookConfigurationEnabled()
75
76 if err != nil {
77 log.Info("ERROR: Could not evaluate if admission webhook configurations are available", "error", err)
78 return err
79 }
80
81 if !enabled {
82 log.Info("WARN: AdmissionWebhooks are not configured at your cluster." +
83 " To make your workspaces more secure, please configure them." +
84 " Skipping setting up Webhook Server")
85 return nil
86 }
87
88 CABundle, err = os.ReadFile(WebhookServerCertDir + "/tls.crt")
89 if os.IsNotExist(err) {
90 return errors.New("CA certificate is not found. Unable to setup webhook server")
91 }
92 if err != nil {
93 return err
94 }
95
96 log.Info("Setting up webhook server")
97
98 webhookServer = mgr.GetWebhookServer()
99
100 return nil
101}
102
103// GetWebhookServer returns webhook server if it's configured, or nil otherwise
104func GetWebhookServer() webhook.Server {

Callers 1

createWebhooksFunction · 0.92

Calls 1

Tested by

no test coverage detected