helm-rs 0.1.0

Typed Rust API for Helm 4: swappable backends, native chart, values and release reading
Documentation

helm-rs

A typed Rust API for Helm 4.

helm-rs drives Helm and never reimplements its engine. Anything Helm defines by a file format or data is read natively in Rust:

  • charts (directories and archives), .helmignore and digests;
  • values schemas, with validation;
  • release records, including reading them straight from the cluster;
  • rendered manifests and repository indexes;
  • Helm-compatible version constraints.

Anything defined by Helm's behaviour goes through a backend: rendering, coalescing values, dependencies, hooks, and install, upgrade and wait.

use helm_rs::command::{ChartRef, Install, ReleaseName};
use helm_rs::{Helm, Values};

#[tokio::main]
async fn main() -> helm_rs::Result<()> {
    let helm = Helm::detect().await?.with_namespace("prod");
    let install = Install::builder(
        ReleaseName::Named("web".to_owned()),
        ChartRef::Repo("charts/web".to_owned()),
    )
    .values(Values::new().set("replicas", 3))
    .create_namespace(true)
    .label("team", "web")
    .build();
    let release = helm.run(install).await?;

    println!("{}", release.name);

    Ok(())
}

Features

Feature What it adds
cli (default) Cli, the backend that runs the helm binary (Helm 4.0 or newer)
mock Mock, a scriptable backend for testing code built on helm-rs
kube Native reads that need a cluster: release storage and typed manifest objects
schema-remote-refs Resolve http(s):// and file:// $refs in values schemas, as Helm does

The backend is a type parameter of Helm<B>, so the choice is made at compile time. A command a backend does not support is a compile error, not a runtime one.

Coverage

Every command and flag of the Helm 4.3 CLI that a program can drive is a typed command (completion and help are excluded). docs/cli-coverage.md tracks each flag.

Secrets never reach the command line:

  • the kube token travels in HELM_KUBETOKEN;
  • registry and repository passwords go through stdin or a private 0600 temporary config;
  • values given from Rust are written to 0600 temporary files.

Tests

cargo nextest run --all-features runs the pure tests. The tests that need the real helm binary, an OCI registry or a kind cluster are ignored by default; tests/README.md says how to run them.

License

Licensed under either of Apache License, Version 2.0 or MIT license, at your option.

Releasing

master always holds the latest stable release. Each release is prepared on a release/<version> branch, such as release/0.1.0, which collects the work for that version.

  • Pre-release: run the Release workflow from the Actions tab on the release branch with a version such as 0.1.0-rc.1. It commits the version and changelog to the branch and publishes that version to crates.io at once, with a v0.1.0-rc.1 tag and a GitHub pre-release.
  • Stable: run the workflow on the release branch with the stable version, such as 0.1.0. It commits the version and changelog only. Merging the branch into master (rebase or squash) publishes it and creates the tag and the GitHub release.

CI's version check keeps pre-release versions off master, and holds a release branch back until its stable version is set. .github/workflows/release.yaml lists the secrets the workflow needs.