Skip to content

Commit 8f090b5

Browse files
stuggiopenshift-merge-bot[bot]
authored andcommitted
Re-add --pprof-bind-address and --webhook-bind-address flags
Re-adds the pprof endpoint flag (default: disabled) and webhook port flag (default: 9443) that were previously removed. These flags are required for local development scenarios and avoiding port conflicts when running multiple operators. Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent 5c47a41 commit 8f090b5

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

cmd/main.go

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

152156
webhookServer := webhook.NewServer(webhook.Options{
157+
Port: webhookPort,
153158
TLSOpts: webhookTLSOpts,
154159
})
155160

@@ -214,6 +219,7 @@ func main() {
214219
Metrics: metricsServerOptions,
215220
WebhookServer: webhookServer,
216221
HealthProbeBindAddress: probeAddr,
222+
PprofBindAddress: pprofBindAddress,
217223
LeaderElection: enableLeaderElection,
218224
LeaderElectionID: "f33036c1.openstack.org",
219225
}

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}" -pprof-bind-address ":${PPROF_PORT}" -webhook-bind-address "${WEBHOOK_PORT}"
531+
go run ./cmd/main.go -metrics-bind-address ":${METRICS_PORT}" -health-probe-bind-address ":${HEALTH_PORT}" -pprof-bind-address ":${PPROF_PORT}" -webhook-bind-address "${WEBHOOK_PORT}"

0 commit comments

Comments
 (0)