This is an automated email from the ASF dual-hosted git repository.

zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new bfd058d8 fix: cluster.metricsCollector invoked before assign when 
MountWebhooks (#1428)
bfd058d8 is described below

commit bfd058d87724a41861358a10d9a8ad62ae5977f9
Author: Floyd <[email protected]>
AuthorDate: Tue Nov 8 11:26:32 2022 +0800

    fix: cluster.metricsCollector invoked before assign when MountWebhooks 
(#1428)
---
 pkg/api/server.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pkg/api/server.go b/pkg/api/server.go
index 95027d8d..c0333c89 100644
--- a/pkg/api/server.go
+++ b/pkg/api/server.go
@@ -30,6 +30,7 @@ import (
        "github.com/apache/apisix-ingress-controller/pkg/apisix"
        "github.com/apache/apisix-ingress-controller/pkg/config"
        "github.com/apache/apisix-ingress-controller/pkg/log"
+       "github.com/apache/apisix-ingress-controller/pkg/metrics"
        "github.com/apache/apisix-ingress-controller/pkg/types"
 )
 
@@ -81,9 +82,10 @@ func NewServer(cfg *config.Config) (*Server, error) {
                admission := gin.New()
                admission.Use(gin.Recovery(), gin.Logger())
                apirouter.MountWebhooks(admission, &apisix.ClusterOptions{
-                       Name:     cfg.APISIX.DefaultClusterName,
-                       AdminKey: cfg.APISIX.DefaultClusterAdminKey,
-                       BaseURL:  cfg.APISIX.DefaultClusterBaseURL,
+                       Name:             cfg.APISIX.DefaultClusterName,
+                       AdminKey:         cfg.APISIX.DefaultClusterAdminKey,
+                       BaseURL:          cfg.APISIX.DefaultClusterBaseURL,
+                       MetricsCollector: metrics.NewPrometheusCollector(),
                })
 
                srv.admissionServer = &http.Server{

Reply via email to