Skip to content

Commit

Permalink
fix: cluster.metricsCollector invoked before assign when MountWebhooks (
Browse files Browse the repository at this point in the history
  • Loading branch information
zou8944 authored and tao12345666333 committed Nov 20, 2022
1 parent a288408 commit b48d465
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit b48d465

Please sign in to comment.