Skip to content

Commit c3c7c98

Browse files
committed
Add pprof-bind-address flag support
Add optional pprof profiling endpoint configuration via --pprof-bind-address flag, matching neutron-operator implementation. Disabled by default (empty string). Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent 3a3c9d1 commit c3c7c98

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

cmd/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ func main() {
102102
var webhookCertPath, webhookCertName, webhookCertKey string
103103
var enableLeaderElection bool
104104
var probeAddr string
105+
var pprofBindAddress string
105106
var secureMetrics bool
106107
var enableHTTP2 bool
107108
var tlsOpts []func(*tls.Config)
@@ -120,6 +121,7 @@ func main() {
120121
"The directory that contains the metrics server certificate.")
121122
flag.StringVar(&metricsCertName, "metrics-cert-name", "tls.crt", "The name of the metrics server certificate file.")
122123
flag.StringVar(&metricsCertKey, "metrics-cert-key", "tls.key", "The name of the metrics server key file.")
124+
flag.StringVar(&pprofBindAddress, "pprof-bind-address", "", "The address the pprof endpoint binds to. Set to empty to disable pprof.")
123125
flag.BoolVar(&enableHTTP2, "enable-http2", false,
124126
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
125127
opts := zap.Options{
@@ -235,6 +237,7 @@ func main() {
235237
Metrics: metricsServerOptions,
236238
WebhookServer: webhookServer,
237239
HealthProbeBindAddress: probeAddr,
240+
PprofBindAddress: pprofBindAddress,
238241
LeaderElection: enableLeaderElection,
239242
LeaderElectionID: "fa1814a2.openstack.org",
240243
}

0 commit comments

Comments
 (0)