Skip to content

Commit 97e417b

Browse files
fix: cluster.metricsCollector invoked before assign when MountWebhooks (#1428) (#1469)
1 parent a288408 commit 97e417b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

pkg/api/server.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/apache/apisix-ingress-controller/pkg/apisix"
3131
"github.com/apache/apisix-ingress-controller/pkg/config"
3232
"github.com/apache/apisix-ingress-controller/pkg/log"
33+
"github.com/apache/apisix-ingress-controller/pkg/metrics"
3334
"github.com/apache/apisix-ingress-controller/pkg/types"
3435
)
3536

@@ -81,9 +82,10 @@ func NewServer(cfg *config.Config) (*Server, error) {
8182
admission := gin.New()
8283
admission.Use(gin.Recovery(), gin.Logger())
8384
apirouter.MountWebhooks(admission, &apisix.ClusterOptions{
84-
Name: cfg.APISIX.DefaultClusterName,
85-
AdminKey: cfg.APISIX.DefaultClusterAdminKey,
86-
BaseURL: cfg.APISIX.DefaultClusterBaseURL,
85+
Name: cfg.APISIX.DefaultClusterName,
86+
AdminKey: cfg.APISIX.DefaultClusterAdminKey,
87+
BaseURL: cfg.APISIX.DefaultClusterBaseURL,
88+
MetricsCollector: metrics.NewPrometheusCollector(),
8789
})
8890

8991
srv.admissionServer = &http.Server{

0 commit comments

Comments
 (0)