Skip to main content

Module clustertool

Module clustertool 

Source
Expand description

Port of internal/clustertool: runs interactive external tools against the Caproni-managed cluster, with a short-lived virtual kubeconfig in their environment.

Driver injection. The Go original resolves both the configuration (config.LoadFromContext(ctx)) and the cluster manager (cluster.NewManager(cfg.Caproni.Cluster, cfg.ProfileName)) inside (*Runner).Run itself. This port instead takes an already-constructed &dyn Driver and the resolved profile name as explicit parameters, consistent with the executor-injection pattern used throughout this crate (see driver::external’s module doc comment): the caller (which already has a config::Container from config::load_from_context and a Driver from registry::new_manager) passes both in, rather than Runner reaching for ambient config/registry state itself. This is a disclosed signature change from the Go original, not a silent gap — see PORT_NOTES.md.

Stream injection. The Go Runner holds io.Reader/io.Writer fields so tests can substitute bytes.Buffers for the process’s real stdio. This port’s Runner does the same through Runner::new (real stdio, inherited by the child process directly for full interactivity) and Runner::new_captured (an in-memory stdin and captured stdout/stderr, for tests).

Structs§

Runner
Port of clustertool.Runner. The zero value is not usable; use Runner::new.
Tool
Port of clustertool.Tool.

Enums§

ClusterToolError
Port of clustertool.ErrToolNotFound and clustertool.ErrNoTerminal.

Functions§

has_controlling_terminal
Port of clustertool.hasControllingTerminal: reports whether the process can open its controlling terminal.
stable_context
Port of clustertool.stableContext: renames the cluster kubeconfig’s context to the Caproni context name, so that tools keying persistent state by context name see the same name whatever cluster driver produced the kubeconfig.