Skip to content

Commit 74db373

Browse files
stuggiopenshift-merge-bot[bot]
authored andcommitted
Re-add --webhook-bind-address and pprof-bind-address flag
Re-adds optional pprof profiling endpoint configuration via --pprof-bind-address flag, matching neutron-operator implementation. Disabled by default (empty string). Re-adds support for configuring the webhook server port through the --webhook-bind-address command-line flag (default: 9443). This flag was removed in the sdk update and needs to be restored to support local development and testing scenarios. Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent 1636bed commit 74db373

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cmd/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ func main() {
8181
var secureMetrics bool
8282
var enableHTTP2 bool
8383
var tlsOpts []func(*tls.Config)
84+
var pprofBindAddress string
85+
var webhookPort int
8486
flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+
8587
"Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.")
8688
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
89+
flag.StringVar(&pprofBindAddress, "pprof-bind-address", "", "The address the pprof endpoint binds to. Set to empty to disable pprof.")
90+
flag.IntVar(&webhookPort, "webhook-bind-address", 9443, "The port the webhook server binds to.")
8791
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
8892
"Enable leader election for controller manager. "+
8993
"Enabling this will ensure there is only one active controller manager.")
@@ -147,6 +151,7 @@ func main() {
147151
}
148152

149153
webhookServer := webhook.NewServer(webhook.Options{
154+
Port: webhookPort,
150155
TLSOpts: webhookTLSOpts,
151156
})
152157

@@ -213,6 +218,7 @@ func main() {
213218
HealthProbeBindAddress: probeAddr,
214219
LeaderElection: enableLeaderElection,
215220
LeaderElectionID: "5049980f.openstack.org",
221+
PprofBindAddress: pprofBindAddress,
216222
}
217223

218224
// apply common openstack operator manager options

hack/run_with_local_webhook.sh

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

296-
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}"
296+
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)