Skip to content

Commit

Permalink
fix: options for the extra metrics handler of the controller manager …
Browse files Browse the repository at this point in the history
…need to be set before creating the manager
  • Loading branch information
guicassolato committed Mar 5, 2024
1 parent aa46e55 commit 74900ec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,15 @@ func setupTelemetryServices(opts telemetryOptions) {
}

func setupManager(options ctrl.Options) (ctrl.Manager, error) {
if options.Metrics.BindAddress != "0" {
options.Metrics.ExtraHandlers = map[string]http.Handler{"/server-metrics": promhttp.Handler()}
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options)
if err != nil {
return nil, err
}

if options.Metrics.BindAddress != "0" {
options.Metrics.ExtraHandlers = map[string]http.Handler{"/server-metrics": promhttp.Handler()}
}

if options.HealthProbeBindAddress != "0" {
if err := mgr.AddHealthzCheck("ping", healthz.Ping); err != nil {
return nil, err
Expand Down

0 comments on commit 74900ec

Please sign in to comment.