Skip to content

Commit 5157cb4

Browse files
Merge pull request #418 from stuggi/operator_sdk_1.41.1_pprofBindAddress
Add pprof-bind-address flag support
2 parents d8f4061 + 0bdc73b commit 5157cb4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ func main() {
8282
var webhookCertPath, webhookCertName, webhookCertKey string
8383
var enableLeaderElection bool
8484
var probeAddr string
85+
var pprofBindAddress string
86+
var webhookPort int
8587
var secureMetrics bool
8688
var enableHTTP2 bool
8789
var tlsOpts []func(*tls.Config)
@@ -100,6 +102,8 @@ func main() {
100102
"The directory that contains the metrics server certificate.")
101103
flag.StringVar(&metricsCertName, "metrics-cert-name", "tls.crt", "The name of the metrics server certificate file.")
102104
flag.StringVar(&metricsCertKey, "metrics-cert-key", "tls.key", "The name of the metrics server key file.")
105+
flag.StringVar(&pprofBindAddress, "pprof-bind-address", "", "The address the pprof endpoint binds to. Set to empty to disable pprof.")
106+
flag.IntVar(&webhookPort, "webhook-bind-address", 9443, "The port the webhook server binds to.")
103107
flag.BoolVar(&enableHTTP2, "enable-http2", false,
104108
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
105109
opts := zap.Options{
@@ -151,6 +155,7 @@ func main() {
151155
}
152156

153157
webhookServer := webhook.NewServer(webhook.Options{
158+
Port: webhookPort,
154159
TLSOpts: webhookTLSOpts,
155160
})
156161

@@ -215,6 +220,7 @@ func main() {
215220
Metrics: metricsServerOptions,
216221
WebhookServer: webhookServer,
217222
HealthProbeBindAddress: probeAddr,
223+
PprofBindAddress: pprofBindAddress,
218224
LeaderElection: enableLeaderElection,
219225
LeaderElectionID: "83821f12.openstack.org",
220226
}

0 commit comments

Comments
 (0)