Skip to content

Commit fca57c2

Browse files
committed
[tunnel] disable health and metrics endpoints in TUI mode
1 parent 042dc2d commit fca57c2

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

pkg/cmd/tunnel/run.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,18 @@ func (t *tunnelNodeReconciler) run(ctx context.Context, tn *corev1alpha.TunnelNo
253253
return fmt.Errorf("unable to create API client: %w", err)
254254
}
255255

256+
// In TUI mode the user owns the terminal — don't bind health/metrics
257+
// listeners on default ports that may collide with other apoxy processes.
258+
metricsBindAddr := metricsAddr
259+
if useTUI {
260+
metricsBindAddr = "0"
261+
}
262+
256263
mgr, err := ctrl.NewManager(client.RESTConfig, ctrl.Options{
257264
Scheme: scheme,
258265
LeaderElection: false,
259266
Metrics: metricsserver.Options{
260-
BindAddress: metricsAddr,
267+
BindAddress: metricsBindAddr,
261268
},
262269
Cache: cache.Options{
263270
SyncPeriod: ptr.To(30 * time.Second),
@@ -288,8 +295,8 @@ func (t *tunnelNodeReconciler) run(ctx context.Context, tn *corev1alpha.TunnelNo
288295
return mgr.Start(gctx)
289296
})
290297

291-
// Start health endpoint server if configured
292-
if healthAddr != "" {
298+
// Start health endpoint server if configured (skipped in TUI mode).
299+
if healthAddr != "" && !useTUI {
293300
mux := http.NewServeMux()
294301
mux.HandleFunc("/healthz", t.healthHandler)
295302

0 commit comments

Comments
 (0)