From c27e7c61caabc3c3b2e7af30308ebdb73dfc4940 Mon Sep 17 00:00:00 2001 From: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com> Date: Thu, 20 Mar 2025 08:04:55 -0300 Subject: [PATCH] Add flag to allow usage of pprof in operator-controller (disabled by default) as it is available for catalogd --- cmd/operator-controller/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/operator-controller/main.go b/cmd/operator-controller/main.go index 56949ffd7..80ab0e4e6 100644 --- a/cmd/operator-controller/main.go +++ b/cmd/operator-controller/main.go @@ -83,6 +83,7 @@ var ( type config struct { metricsAddr string + pprofAddr string certFile string keyFile string enableLeaderElection bool @@ -131,6 +132,7 @@ func init() { //create flagset, the collection of flags for this command flags := operatorControllerCmd.Flags() flags.StringVar(&cfg.metricsAddr, "metrics-bind-address", "", "The address for the metrics endpoint. Requires tls-cert and tls-key. (Default: ':8443')") + flags.StringVar(&cfg.pprofAddr, "pprof-bind-address", "0", "The address the pprof endpoint binds to. an empty string or 0 disables pprof") flags.StringVar(&cfg.probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flags.StringVar(&cfg.catalogdCasDir, "catalogd-cas-dir", "", "The directory of TLS certificate authorities to use for verifying HTTPS connections to the Catalogd web service.") flags.StringVar(&cfg.pullCasDir, "pull-cas-dir", "", "The directory of TLS certificate authorities to use for verifying HTTPS connections to image registries.") @@ -265,6 +267,7 @@ func run() error { mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ Scheme: scheme.Scheme, Metrics: metricsServerOptions, + PprofBindAddress: cfg.pprofAddr, HealthProbeBindAddress: cfg.probeAddr, LeaderElection: cfg.enableLeaderElection, LeaderElectionID: "9c4404e7.operatorframework.io",