Skip to content

Commit 1c5567b

Browse files
dprinceopenshift-merge-bot[bot]
authored andcommitted
Add pprof-bind-address option to main.go
Jira: OSPRH-17594
1 parent 144e0f9 commit 1c5567b

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,11 @@ build: generate fmt vet ## Build manager binary.
158158
.PHONY: run
159159
run: export METRICS_PORT?=24600
160160
run: export HEALTH_PORT?=24601
161+
run: export PPROF_PORT?=8082
161162
run: export ENABLE_WEBHOOKS?=false
162163
run: manifests generate fmt vet ## Run a controller from your host.
163164
/bin/bash hack/clean_local_webhook.sh
164-
go run ./main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)"
165+
go run ./main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" -pprof-bind-address ":$(PPROF_PORT)"
165166

166167

167168
# Extra vars which will be passed to the Docker-build
@@ -387,6 +388,7 @@ SKIP_CERT ?=false
387388
.PHONY: run-with-webhook
388389
run-with-webhook: export METRICS_PORT?=24600
389390
run-with-webhook: export HEALTH_PORT?=24601
391+
run-with-webhook: export PPROF_PORT?=8082
390392
run-with-webhook: manifests generate fmt vet ## Run a controller from your host.
391393
/bin/bash hack/clean_local_webhook.sh
392394
/bin/bash hack/run_with_local_webhook.sh

hack/run_with_local_webhook.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,4 +528,4 @@ else
528528
oc scale --replicas=0 -n openstack-operators deploy/nova-operator-controller-manager
529529
fi
530530

531-
go run ./main.go -metrics-bind-address ":${METRICS_PORT}" -health-probe-bind-address ":${HEALTH_PORT}"
531+
go run ./main.go -metrics-bind-address ":${METRICS_PORT}" -health-probe-bind-address ":${HEALTH_PORT}" -pprof-bind-address ":${PPROF_PORT}"

main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ func main() {
8080
var metricsAddr string
8181
var enableLeaderElection bool
8282
var probeAddr string
83+
var pprofBindAddress string
8384
var enableHTTP2 bool
8485
flag.BoolVar(&enableHTTP2, "enable-http2", enableHTTP2, "If HTTP/2 should be enabled for the metrics and webhook servers.")
8586
flag.StringVar(&metricsAddr, "metrics-bind-address", ":24600", "The address the metric endpoint binds to.")
8687
flag.StringVar(&probeAddr, "health-probe-bind-address", ":24601", "The address the probe endpoint binds to.")
88+
flag.StringVar(&pprofBindAddress, "pprof-bind-address", "", "The address the pprof endpoint binds to. Set to empty to disable pprof.")
8789
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
8890
"Enable leader election for controller manager. "+
8991
"Enabling this will ensure there is only one active controller manager.")
@@ -111,6 +113,7 @@ func main() {
111113
HealthProbeBindAddress: probeAddr,
112114
LeaderElection: enableLeaderElection,
113115
LeaderElectionID: "f33036c1.openstack.org",
116+
PprofBindAddress: pprofBindAddress,
114117
WebhookServer: webhook.NewServer(
115118
webhook.Options{
116119
Port: 9444,

0 commit comments

Comments
 (0)