Skip to main content

Module cli

Module cli 

Source
Expand description

The helm binary backend.

Cli runs the helm executable (Helm 4 only) once per command. Every run inherits the parent environment (exec credential plugins need PATH and HOME), except that all HELM_* variables are removed first; the GlobalOptions then set what Helm should see, so a run does not depend on the caller’s Helm settings. KUBECONFIG is inherited: without GlobalOptions::kubeconfig, helm resolves the cluster exactly like kubectl and kube::Client::try_default in the same process, so the two never target different clusters. The kube token travels only as HELM_KUBETOKEN, never in argv.

Cancellation: dropping the future of a read-only command kills the process. Commands that mutate a release (install, upgrade, rollback, uninstall, test) are not killed on drop and run to completion in the background, because killing an upgrade leaves the release pending-upgrade. That background task also owns the invocation’s 0600 values files, so they are deleted only after the process has exited, never while helm may still read them.

use helm_rs::{Helm, command::Version};

let helm = Helm::detect().await?.with_namespace("prod");
let version = helm.run(Version).await?;

println!("{}", version.version);

Structs§

Cli
The helm binary backend. Obtain one with Cli::detect or Cli::new, which check the version.