(mgr manager.Manager)
| 71 | } |
| 72 | |
| 73 | func 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 |
| 104 | func GetWebhookServer() webhook.Server { |
no test coverage detected