pub struct Chart {
pub metadata: Metadata,
pub lock: Option<Lock>,
pub templates: Vec<File>,
pub values: Value,
pub schema_raw: Option<Vec<u8>>,
pub schema_mod_time: Option<Timestamp>,
pub files: Vec<File>,
pub mod_time: Option<Timestamp>,
pub values_raw: Option<Vec<u8>>,
pub dependencies: Vec<Chart>,
}Expand description
A chart: loaded from a directory or archive, or decoded from the chart embedded in a release
record (Go chart.Chart JSON, which Serialize and Deserialize mirror exactly).
The record does not carry values_raw or the subcharts, so those stay empty after decoding.
Fields§
§metadata: MetadataChart.yaml, validated and sanitised.
lock: Option<Lock>Chart.lock (or requirements.lock).
templates: Vec<File>The files under templates/ (partials and NOTES.txt included).
values: ValueParsed values.yaml with Helm’s YAML semantics; {} when absent (null in records of
charts without values).
schema_raw: Option<Vec<u8>>The bytes of values.schema.json. Helm parses it only when validating, so loading does
not fail on invalid JSON; see Chart::schema.
schema_mod_time: Option<Timestamp>The modification time of the schema (Go’s zero time reads as None).
files: Vec<File>Every other file, as in Helm: README, LICENSE, crds/, *.prov of subcharts, …
(v1 charts also keep requirements.yaml and requirements.lock here).
mod_time: Option<Timestamp>The modification time of the chart.
values_raw: Option<Vec<u8>>The bytes of values.yaml, comments and all (what helm show values prints). Not part
of a release record.
dependencies: Vec<Chart>Subcharts from charts/, directories and .tgz archives, loaded recursively. Helm keeps
them unexported, so a release record has none.
Implementations§
Source§impl Chart
impl Chart
Sourcepub fn digest(&self) -> String
pub fn digest(&self) -> String
A digest of the chart’s content: sha256: plus lowercase hex.
Unlike archive_digest, which hashes the bytes of one .tgz exactly as Helm does, this
is helm-rs’s own: it hashes what the loaded chart contains, so the same chart gives the
same digest as a directory and as a packaged archive, and changes whenever its content
does even if version stays the same.
It covers Chart.yaml as loaded, the lock, every template, the parsed values, the raw
schema, every other file (crds/ included, by path and bytes) and every subchart,
recursively and by name. Because values are hashed parsed, edits to values.yaml that
change only comments or whitespace do not change the digest. Modification times and
anything specific to a directory or an archive are left out, and files a directory’s
.helmignore excludes are never loaded, so they do not count either.
The input is the JSON of a private struct with sorted keys and sorted paths, with file bytes in base64. JSON strings are self-delimiting, so no two different charts produce the same input.
use helm_rs::chart::Chart;
let chart = Chart::load("tests/fixtures/chart/basic")?;
assert!(chart.digest().starts_with("sha256:"));
assert_eq!(chart.digest(), chart.digest());§Panics
Never: the canonical form always serialises.
Source§impl Chart
impl Chart
Sourcepub async fn fetch<B: Execute<Pull>>(
helm: &Helm<B>,
chart: &ChartRef,
options: &ChartPathOptions,
) -> Result<Self>
pub async fn fetch<B: Execute<Pull>>( helm: &Helm<B>, chart: &ChartRef, options: &ChartPathOptions, ) -> Result<Self>
Loads the chart chart names, wherever it lives.
A ChartRef::Path is read natively with Chart::load; no Helm process runs and
options is not used. A repository, oci:// or URL chart is downloaded with helm pull
into a private temporary directory, which is removed again on every path (an error
included), and the archive Helm wrote is loaded from there. Helm verifies the chart before
the archive is read when options.verify is set, so a chart that fails verification is
an error.
Development versions are only a version constraint: Helm’s --devel sets the version to
>0.0.0-0 when none is given (pkg/cmd/pull.go, Helm v4.3.0) and does nothing else, so
set options.version to >0.0.0-0 for them.
use helm_rs::command::{ChartPathOptions, ChartRef};
use helm_rs::{Chart, Helm};
let helm = Helm::detect().await?;
let options = ChartPathOptions::builder().version("^2.0.0").verify(true).build();
let chart = Chart::fetch(&helm, &ChartRef::Oci("oci://registry.example/charts/web".into()), &options).await?;
println!("{} {}", chart.name(), chart.metadata.version);§Errors
Whatever the backend’s pull fails with, and any error of Chart::load.
Source§impl Chart
impl Chart
Sourcepub fn load_archive(bytes: &[u8]) -> Result<Self, Error>
pub fn load_archive(bytes: &[u8]) -> Result<Self, Error>
Sourcepub fn default_values(&self) -> &Value
pub fn default_values(&self) -> &Value
The chart’s own default values (values.yaml), without any subchart or user values.
Sourcepub fn crds(&self) -> impl Iterator<Item = &File>
pub fn crds(&self) -> impl Iterator<Item = &File>
The CRD manifests of this chart: crds/ files ending in .yaml, .yml or .json.
Sourcepub fn lock_is_stale(&self) -> Option<bool>
pub fn lock_is_stale(&self) -> Option<bool>
Reports whether Chart.lock is out of date with Chart.yaml, like helm dependency build
(“the lock file (Chart.lock) is out of sync with the dependencies file”). None without a
lock. Exact only when repositories are written as URLs: Helm resolves @alias names from
its repository config before hashing.
Source§impl Chart
impl Chart
Sourcepub fn generate_schema(&self, options: &GenerateOptions) -> Result<Value>
pub fn generate_schema(&self, options: &GenerateOptions) -> Result<Value>
The values.schema.json helm-schema generates for this chart; see generate_chart.
§Errors
As generate_chart.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Chart
impl<'de> Deserialize<'de> for Chart
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Chart
Auto Trait Implementations§
impl Forget for Chart
impl Freeze for Chartwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<String>: Freeze,
PhantomData<Option<Maintainer>>: Freeze,
*const LeafNode<String, String> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, String)>>: Freeze,
PhantomData<Option<Dependency>>: Freeze,
PhantomData<File>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
PhantomData<Chart>: Freeze,
impl Move for Chart
impl RefUnwindSafe for Chart
impl Send for Chart
impl Sync for Chart
impl Unpin for Chart
impl UnsafeUnpin for Chartwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<Option<Maintainer>>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
PhantomData<Option<Dependency>>: UnsafeUnpin,
PhantomData<File>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
PhantomData<Chart>: UnsafeUnpin,
impl UnwindSafe for Chartwhere
RawVecInner: UnwindSafe,
BTreeMap<String, String>: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more