(ctx context.Context)
| 69 | } |
| 70 | |
| 71 | func (w *ValidatingWebhookResource) Register(ctx context.Context) error { |
| 72 | configuration := &v1.ValidatingWebhookConfiguration{ |
| 73 | Webhooks: []v1.ValidatingWebhook{}, |
| 74 | } |
| 75 | configuration.Name = w.opts.ConfigurationName |
| 76 | |
| 77 | for _, webhook := range w.hooks { |
| 78 | equivalent := v1.Equivalent |
| 79 | webhook.MatchPolicy = &equivalent |
| 80 | webhook.AdmissionReviewVersions = []string{"v1", "v1beta1"} |
| 81 | webhook.ClientConfig = v1.WebhookClientConfig{ |
| 82 | Service: &v1.ServiceReference{ |
| 83 | Namespace: w.opts.Namespace, |
| 84 | Name: w.opts.ServiceName, |
| 85 | Path: createWebhookPath(IWebhookConfig(webhook)), |
| 86 | }, |
| 87 | CABundle: w.opts.CABundle, |
| 88 | } |
| 89 | |
| 90 | w.logger.Info("Add path to config", |
| 91 | slog.String(pkg.LogKeyPath, *webhook.ClientConfig.Service.Path), |
| 92 | slog.String(pkg.LogKeyConfigurationName, w.opts.ConfigurationName)) |
| 93 | |
| 94 | configuration.Webhooks = append(configuration.Webhooks, *webhook.ValidatingWebhook) |
| 95 | } |
| 96 | |
| 97 | return w.submit(ctx, configuration) |
| 98 | } |
| 99 | |
| 100 | func (w *ValidatingWebhookResource) Unregister() error { |
| 101 | return w.opts.KubeClient.AdmissionregistrationV1().ValidatingWebhookConfigurations(). |
nothing calls this directly
no test coverage detected