Skip to content

Commit 18d6c7c

Browse files
dprinceopenshift-merge-bot[bot]
authored andcommitted
Add pprof-bind-address option to main.go
Jira: OSPRH-17594
1 parent 97fc682 commit 18d6c7c

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
@@ -157,9 +157,10 @@ build: generate fmt vet ## Build manager binary.
157157
.PHONY: run
158158
run: export METRICS_PORT?=24604
159159
run: export HEALTH_PORT?=24605
160+
run: export PPROF_PORT?=8082
160161
run: export ENABLE_WEBHOOKS?=false
161162
run: manifests generate fmt vet ## Run a controller from your host.
162-
go run ./main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)"
163+
go run ./main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" -pprof-bind-address ":$(PPROF_PORT)"
163164

164165

165166
# Extra vars which will be passed to the Docker-build
@@ -471,6 +472,7 @@ SKIP_CERT ?=false
471472
.PHONY: run-with-webhook
472473
run-with-webhook: export METRICS_PORT?=33080
473474
run-with-webhook: export HEALTH_PORT?=33081
475+
run-with-webhook: export PPROF_PORT?=8082
474476
run-with-webhook: export RELATED_IMAGE_WATCHER_API_IMAGE_URL_DEFAULT=${WATCHER_API_CI_IMAGE}
475477
run-with-webhook: export RELATED_IMAGE_WATCHER_DECISION_ENGINE_IMAGE_URL_DEFAULT=${WATCHER_DECISION_ENGINE_CI_IMAGE}
476478
run-with-webhook: export RELATED_IMAGE_WATCHER_APPLIER_IMAGE_URL_DEFAULT=${WATCHER_APPLIER_CI_IMAGE}

hack/run_with_local_webhook.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,4 @@ if [ -n "${CSV_NAME}" ]; then
292292
oc patch "${CSV_NAME}" -n openstack-operators --type=json -p="[{'op': 'replace', 'path': '/spec/webhookdefinitions', 'value': []}]"
293293
fi
294294

295-
go run ./main.go -metrics-bind-address ":${METRICS_PORT}" -health-probe-bind-address ":${HEALTH_PORT}"
295+
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
@@ -72,10 +72,12 @@ func main() {
7272
var metricsAddr string
7373
var enableLeaderElection bool
7474
var probeAddr string
75+
var pprofBindAddress string
7576
var secureMetrics bool
7677
var enableHTTP2 bool
7778
flag.StringVar(&metricsAddr, "metrics-bind-address", ":33080", "The address the metric endpoint binds to.")
7879
flag.StringVar(&probeAddr, "health-probe-bind-address", ":33081", "The address the probe endpoint binds to.")
80+
flag.StringVar(&pprofBindAddress, "pprof-bind-address", "", "The address the pprof endpoint binds to. Set to empty to disable pprof.")
7981
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
8082
"Enable leader election for controller manager. "+
8183
"Enabling this will ensure there is only one active controller manager.")
@@ -122,6 +124,7 @@ func main() {
122124
HealthProbeBindAddress: probeAddr,
123125
LeaderElection: enableLeaderElection,
124126
LeaderElectionID: "5049980f.openstack.org",
127+
PprofBindAddress: pprofBindAddress,
125128
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
126129
// when the Manager ends. This requires the binary to immediately end when the
127130
// Manager is stopped, otherwise, this setting is unsafe. Setting this significantly

0 commit comments

Comments
 (0)