Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,24 @@ 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
source hack/export_related_images.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)"

.PHONY: run-operator
run-operator: export METRICS_PORT?=8080
run-operator: export HEALTH_PORT?=8081
run: export PPROF_PORT?=8082
run-operator: export ENABLE_WEBHOOKS?=false
run-operator: export BASE_BINDATA?=bindata
run-operator: export OPERATOR_IMAGE_URL=${IMG}
run-operator: manifests generate fmt vet ## Run a controller from your host.
source hack/export_related_images.sh && \
source hack/export_operator_related_images.sh && \
go run ./cmd/operator/main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)"
go run ./cmd/operator/main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" -pprof-bind-address ":$(PPROF_PORT)"

.PHONY: docker-build
docker-build: ## Build docker image with the manager.
Expand Down Expand Up @@ -502,6 +504,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/run_with_local_webhook.sh

Expand Down
3 changes: 3 additions & 0 deletions cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ func main() {
var enableLeaderElection bool
var probeAddr string
var enableHTTP2 bool
var pprofAddr string
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(&pprofAddr, "pprof-bind-address", "", "The address the pprof endpoint binds to. Set to empty to disable pprof")
Comment thread
dprince marked this conversation as resolved.
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
Expand Down Expand Up @@ -93,6 +95,7 @@ func main() {
Metrics: metricsserver.Options{
BindAddress: metricsAddr,
},
PprofBindAddress: pprofAddr,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "20ca801f.openstack.org",
Expand Down
2 changes: 1 addition & 1 deletion hack/run_with_local_webhook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,4 @@ if [ -n "${CSV_NAME}" ]; then
fi

source hack/export_related_images.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}"
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
var pprofAddr 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(&pprofAddr, "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.")
Expand Down Expand Up @@ -171,6 +173,7 @@ func main() {
Metrics: metricsserver.Options{
BindAddress: metricsAddr,
},
PprofBindAddress: pprofAddr,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "40ba705e.openstack.org",
Expand Down