in reconcilers/reconciler.go [299:318]
func createMutatingWebhookConfig(ctx context.Context, clientset kubernetes.Interface, caCert []byte, isKubeSystemNamespaceBlocked bool) *error {
logger := log.MustGetLogger(ctx)
mutatingWebhookConfig, err := getMutatingWebhookConfigFromConfigmap(ctx, clientset, caCert, isKubeSystemNamespaceBlocked)
if err != nil {
logger.Errorf(ctx, "get mutating webhook config failed. error: %s", *err)
return err
}
client := clientset.AdmissionregistrationV1().MutatingWebhookConfigurations()
_, createErr := client.Create(ctx, mutatingWebhookConfig, metav1.CreateOptions{})
if createErr != nil {
logger.Errorf(ctx, "create mutating webhook configuration %s failed. error: %s", utils.WebhookConfigName(), createErr)
return &createErr
}
logger.Infof(ctx, "mutating webhook configuration %s created.", utils.WebhookConfigName())
return nil
}