pub fn build_reloader_run_fn(
executor: Arc<dyn CommandRunner + Send + Sync>,
caproni_cfg: &CaproniConfig,
static_vars: &HashMap<String, String>,
kubeconfig: &str,
tui_dispatch: Option<Dispatch>,
) -> ReloaderRunFnExpand description
Production ReloaderRunFn: dispatches to the concrete mirror/
skaffold reloader manager for reloader_config.reloader_type,
running it (via [tokio::task::spawn_blocking], since both
managers’ run blocks synchronously until their subprocess exits)
against a fresh kubectl::Client built from the cluster’s
kubeconfig.
Not ported (see PORT_NOTES.md’s “fifth pass” entry): precondition
checks (reloader.Manager.CheckPreconditions) and mirror
deployment-copy preparation/cleanup
(mirror.Manager.{PrepareFromReloaderConfigs, CleanupCopyDeployments,CleanupStaleMirrordAgents}). Neither is part
of the concurrent execution engine this pass was scoped to port;
each is a self-contained follow-up.
The log filter TUI (logfilter.NewTUI) is now wired, in
run_run: a xianyun_executor::logfilter::Tui runs its
interactive event loop on a dedicated OS thread (it blocks on
terminal I/O, so it can’t run on an async executor’s worker thread)
for the lifetime of execute_reloaders_concurrently, and is
told to quit once that finishes – mirroring Go’s tui.Quit()
deferred at the end of runRun. Each reloader’s own output is also
now routed through it, via tui_dispatch below.
tui_dispatch, when Some (the log-filter TUI is active), is
installed as the tracing default for the duration of this
reloader’s spawn_blocking work via
tracing::dispatcher::with_default – scoped to that one worker
thread, not process-wide. This is the Rust equivalent of Go’s
setupTUI swapping slog.Default() for the whole process:
tracing::dispatcher::set_global_default can only succeed once per
process (see hooks::resolve_logging_config’s doc comment), so
routing run’s reloader output through the TUI for run’s lifetime
only – while every other command keeps logging on the dispatcher
commands::dispatch already installed – has to be a scoped
override per task rather than a second global swap. Go’s reloaders
log via the ambient slog package-level functions with no awareness
of the swap; this port’s reloader code (mirror/skaffold managers,
run_single_reloader) is unchanged for the same reason – it logs
via plain tracing::info!/tracing::debug! macros, which resolve to
whatever dispatcher is active on the calling thread.