Skip to main content

Module run

Module run 

Source
Expand description

caproni run: run reloaders in edit mode until interrupted.

Port of Go’s cmd/run package.

runRun’s setup pipeline (repository cloning, cluster DNS domain resolution) and its concurrent core (runAndWait: one goroutine per reloader, signal handling) are both ported for real below. The concurrent core uses [tokio::task::JoinSet] for structured concurrency – see execute_reloaders_concurrently’s doc comment for the full design and what’s intentionally out of scope (the TUI, mirror deployment-copy orchestration). See PORT_NOTES.md’s “fifth pass” entry for the complete rationale.

Structs§

ReloaderConfig
RunArgs

Enums§

RunError
Port of run.ErrNoEditModeReloaders/run.ErrRepositoryNotDefined.

Functions§

build_reloader_run_fn
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.
collect_mirror_namespaces
Port of collectMirrorNamespaces: the deduplicated set of target namespaces from all mirror reloaders, in first-seen order.
collect_reloader_errors
Port of collectReloaderErrors: filters out cancellation errors (expected during graceful shutdown) and returns any real failures.
execute_reloaders_concurrently
Port of runAndWait’s concurrent core: launches every edit-mode reloader’s run_one concurrently, waits for all of them to finish (whether they succeed, fail, or a shutdown signal arrives first), and collects any real failures.
find_edit_mode_reloaders
Port of findEditModeReloaders: returns every reloader with edit_mode: true.
has_repository_active_reloader
Port of hasRepositoryActiveReloader: whether any edit-mode reloader uses the given repository.
reloader_names
Port of reloaderNames: the sorted names of a reloader map, for deterministic logging.
run
run_run
Port of run.runRun: loads the configuration, finds edit_mode reloaders, clones their repositories, resolves the cluster’s DNS domain, fetches its kubeconfig, runs edit_mode_start lifecycle hooks, launches every reloader concurrently via execute_reloaders_concurrently, then runs edit_mode_stop lifecycle hooks.

Type Aliases§

ReloaderFuture
A single reloader’s execution, as an owned, boxed future. Production implementations wrap a blocking call (mirror/skaffold’s run) in [tokio::task::spawn_blocking]; test doubles can be a plain async block.
ReloaderRunFn
Runs one reloader by name, returning its outcome. Mirrors Go’s runReloader/runWithHooks folded into a single injected function, the same DI pattern up/ca/deploy/run’s setup pipeline already use for their KubectlFactory/Connector/git::Backend parameters.
RunOneBuilder
Builds the ReloaderRunFn run_run hands to execute_reloaders_concurrently, given the resolved configuration, cluster kubeconfig, and (if the log-filter TUI is active) the tracing::Dispatch each reloader task should log through for the duration of its own work. Injected (rather than hard-coded inside run_run) so tests can substitute a fake, instantly-resolving ReloaderRunFn without a live cluster, real mirrord/skaffold binaries, or real subprocess execution – exactly like every other injected seam in this crate (see the module doc comment).