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 committed Nov 8, 2022
1 parent 38b12fb commit bfd058d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/api/server.go
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 bfd058d

Please sign in to comment.