diff --git a/Makefile b/Makefile index e0bb6dc..4224827 100644 --- a/Makefile +++ b/Makefile @@ -123,10 +123,11 @@ build: generate fmt vet ## Build manager binary. .PHONY: run run: export METRICS_PORT?=8080 run: export HEALTH_PORT?=8081 +run: export PPROF_PORT?=8082 run: export ENABLE_WEBHOOKS?=false run: manifests generate fmt vet ## Run a controller from your host. /bin/bash hack/clean_local_webhook.sh - go run ./main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" + go run ./main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" -pprof-bind-address ":$(PPROF_PORT)" # Extra vars which will be passed to the Docker-build @@ -357,6 +358,7 @@ SKIP_CERT ?=false .PHONY: run-with-webhook run-with-webhook: export METRICS_PORT?=8080 run-with-webhook: export HEALTH_PORT?=8081 +run-with-webhook: export PPROF_PORT?=8082 run-with-webhook: manifests generate fmt vet ## Run a controller from your host. /bin/bash hack/clean_local_webhook.sh /bin/bash hack/run_with_local_webhook.sh diff --git a/hack/run_with_local_webhook.sh b/hack/run_with_local_webhook.sh index 4ef0bec..cf76be1 100755 --- a/hack/run_with_local_webhook.sh +++ b/hack/run_with_local_webhook.sh @@ -135,4 +135,4 @@ else oc scale --replicas=0 -n openstack-operators deploy/placement-operator-controller-manager fi -go run ./main.go -metrics-bind-address ":${METRICS_PORT}" -health-probe-bind-address ":${HEALTH_PORT}" +go run ./main.go -metrics-bind-address ":${METRICS_PORT}" -health-probe-bind-address ":${HEALTH_PORT}" -pprof-bind-address ":${PPROF_PORT}" diff --git a/main.go b/main.go index b0b1646..8b22c1e 100644 --- a/main.go +++ b/main.go @@ -69,10 +69,12 @@ func main() { var metricsAddr string var enableLeaderElection bool var probeAddr string + var pprofBindAddress string var enableHTTP2 bool flag.BoolVar(&enableHTTP2, "enable-http2", enableHTTP2, "If HTTP/2 should be enabled for the metrics and webhook servers.") flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") + flag.StringVar(&pprofBindAddress, "pprof-bind-address", "", "The address the pprof endpoint binds to. Set to empty to disable pprof.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") @@ -100,6 +102,7 @@ func main() { HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, LeaderElectionID: "73d6b7ce.openstack.org", + PprofBindAddress: pprofBindAddress, WebhookServer: webhook.NewServer( webhook.Options{ Port: 9443,