You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by zh...@apache.org on 2022/11/21 02:40:30 UTC

[apisix-ingress-controller] branch v1.5.0 updated: fix: cluster.metricsCollector invoked before assign when MountWebhooks (#1428) (#1469)

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

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


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

commit 97e417b8d9c66df655c0e9a6d0c7f9ebbce63757
Author: Jintao Zhang <zh...@gmail.com>
AuthorDate: Mon Nov 21 10:40:26 2022 +0800

    fix: cluster.metricsCollector invoked before assign when MountWebhooks (#1428) (#1469)
---
 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{