diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 89e1608f30c..b02066cba1c 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -79,7 +79,12 @@ func main() { configMapWatcher.Watch(channeldefaulter.ConfigMapName, channelDefaulter.UpdateConfigMap) if err = configMapWatcher.Start(stopCh); err != nil { - logger.Fatalf("failed to start webhook configmap watcher: %v", err) + logger.Fatalf("failed to start webhook configmap watcher: %v", zap.Error(err)) + } + + stats, err := webhook.NewStatsReporter() + if err != nil { + logger.Fatalw("failed to initialize the stats reporter", zap.Error(err)) } options := webhook.ControllerOptions{ @@ -89,6 +94,7 @@ func main() { Port: 8443, SecretName: "eventing-webhook-certs", WebhookName: "webhook.eventing.knative.dev", + StatsReporter: stats, } controller := webhook.AdmissionController{ Client: kubeClient, diff --git a/contrib/kafka/cmd/webhook/main.go b/contrib/kafka/cmd/webhook/main.go index a63df8a956a..4f9a08ff7a7 100644 --- a/contrib/kafka/cmd/webhook/main.go +++ b/contrib/kafka/cmd/webhook/main.go @@ -68,6 +68,11 @@ func main() { configMapWatcher.Watch(logconfig.ConfigMapName(), logging.UpdateLevelFromConfigMap(logger, atomicLevel, logconfig.WebhookName())) + stats, err := webhook.NewStatsReporter() + if err != nil { + logger.Fatalw("failed to initialize the stats reporter", zap.Error(err)) + } + options := webhook.ControllerOptions{ ServiceName: logconfig.WebhookName(), DeploymentName: logconfig.WebhookName(), @@ -75,10 +80,12 @@ func main() { Port: 8443, SecretName: "messaging-webhook-certs", WebhookName: "webhook.messaging.knative.dev", + StatsReporter: stats, } controller := webhook.AdmissionController{ Client: kubeClient, Options: options, + Handlers: map[schema.GroupVersionKind]webhook.GenericCRD{ // For group messaging.knative.dev messagingv1alpha1.SchemeGroupVersion.WithKind("KafkaChannel"): &messagingv1alpha1.KafkaChannel{},