Documentation
¶
Overview ¶
Package helm wraps helm.sh/helm/v4 to render HelmReleases without shelling out to the `helm` binary.
The exported surface:
- Client.Template renders a HelmRelease to a YAML stream (the equivalent of `helm template --dry-run --client-only`).
- NewSources binds each operation to its captured source declarations and artifacts.
- Client.Template receives those sources through RenderOptions.
Index ¶
- Variables
- func Prepare(hr *manifest.HelmRelease, ...) (*manifest.HelmRelease, error)
- type Client
- func (c *Client) PreviousRender(ctx context.Context, hr *manifest.HelmRelease, hrValues map[string]any, ...) (iter.Seq2[manifest.NamedResource, manifest.DiscoveryRecord], bool)
- func (c *Client) RecordRender(ctx context.Context, acceptance RenderAcceptance) error
- func (c *Client) StaleValuePaths(ctx context.Context, hr *manifest.HelmRelease, values map[string]any, ...) []string
- func (c *Client) Template(ctx context.Context, hr *manifest.HelmRelease, hrValues map[string]any, ...) ([]manifest.DocOccurrence, *manifest.RenderReceipt, error)
- func (c *Client) ValuesCache() *values.Cache
- type Options
- type Preparation
- type RenderAcceptance
- type RenderAdmission
- type RenderOptions
- type SecretGetter
- type Sources
Constants ¶
This section is empty.
Variables ¶
var BundledKubeVersion = sync.OnceValue(func() string { return detectBundledKubeVersion(debug.ReadBuildInfo()) })
BundledKubeVersion returns the Kubernetes version from the k8s.io/api build dependency, or Helm's default when detection fails.
Functions ¶
func Prepare ¶
func Prepare( hr *manifest.HelmRelease, lookup func(manifest.NamedResource) manifest.BaseManifest, provider values.Provider, cache *values.Cache, ) (*manifest.HelmRelease, error)
Prepare clones a HelmRelease, resolves its chartRef and expands its values.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client renders HelmReleases. Construct with NewClient.
func NewClient ¶
NewClient constructs a Client borrowing the supplied nonnil cache owner. The caller MUST keep the owner open until all Client operations finish.
func (*Client) PreviousRender ¶ added in v0.7.3
func (c *Client) PreviousRender( ctx context.Context, hr *manifest.HelmRelease, hrValues map[string]any, input RenderOptions, ) (iter.Seq2[manifest.NamedResource, manifest.DiscoveryRecord], bool)
PreviousRender returns complete accepted history without running an action or acquiring a chart.
func (*Client) RecordRender ¶ added in v0.7.3
func (c *Client) RecordRender(ctx context.Context, acceptance RenderAcceptance) error
RecordRender persists a receipt only with a complete accepted inventory.
func (*Client) StaleValuePaths ¶ added in v0.4.6
func (c *Client) StaleValuePaths( ctx context.Context, hr *manifest.HelmRelease, values map[string]any, input *RenderOptions, ) []string
StaleValuePaths returns the top-level release-value keys a HelmRelease supplies that NO chart template references — the #744 signal that an override has gone stale (a key renamed/removed when the chart was upgraded silently does nothing) or was never consumed.
It measures actual consumption, not schema shape: it scans every template in the chart and its (sub)charts for a `.Values.<key>` reference (dotted, or a quoted "<key>" for index/pluck/hasKey/dig forms). A key referenced nowhere is reported. This is what a values.schema.json can't tell us — real charts ship incomplete, open schemas that permit (but never consume) extra keys, so a dead key like a renamed override passes schema validation untouched.
Top-level only, and deliberately conservative to avoid false positives:
- Keys addressed to a subchart (a dependency name/alias) or Helm's shared "global" are always treated as used — the subchart consumes them.
- Keys gating a dependency are always treated as used: the top-level segment of the root chart's dependencies[].condition paths, and "tags" when any dependency in the tree declares tags — Helm's dependency evaluation consumes them without any template naming them (#930).
- If the chart accesses `.Values` opaquely — ranges/dumps the whole map (toYaml .Values), binds it to a variable, or indexes it with a non-literal key — we can't statically prove any key unused, so we report NOTHING.
Schema-independent and advisory only: fail-open (nil) on a load error or a chart with no templates. The controller surfaces the result as a manifest.Warning; this function never logs or fails a render.
func (*Client) Template ¶
func (c *Client) Template( ctx context.Context, hr *manifest.HelmRelease, hrValues map[string]any, input RenderOptions, ) ([]manifest.DocOccurrence, *manifest.RenderReceipt, error)
Template renders a HelmRelease and returns independently owned documents. The immutable receipt may be persisted after complete accepted publication. When input.Preparation is non-nil, hrValues and all reachable maps and slices MUST remain immutable until that preparation and every transferred owner retire. Callers MUST replace values or retire their preparation before mutation.
func (*Client) ValuesCache ¶
ValuesCache returns the Client's shared valuesFrom parse cache.
type Options ¶
type Options struct {
// DisableChartDigestTracking preserves direct OCI chart versions when true.
// False enables tracking. Revision validation and full source cache identity
// apply in every mode.
DisableChartDigestTracking bool `json:"DisableChartDigestTracking"`
// SkipCRDs excludes CRDs from the rendered output.
SkipCRDs bool `json:"SkipCRDs"`
// SkipTests excludes templates that are helm test hooks.
SkipTests bool `json:"SkipTests"`
// SkipKinds is an arbitrary list of kinds to drop.
SkipKinds []string `json:"SkipKinds"`
// KubeVersion overrides Capabilities.KubeVersion (.Capabilities.KubeVersion).
KubeVersion string `json:"KubeVersion"`
// APIVersions overrides Capabilities.APIVersions
// (.Capabilities.APIVersions). Comma-separated.
APIVersions string `json:"APIVersions"`
// EnableDNS enables DNS lookups during templating.
EnableDNS bool `json:"EnableDNS"`
}
Options collects the helm template flags flate supports.
func (Options) SkipResourceKinds ¶
SkipResourceKinds returns the union of canonical and user-specified kinds to drop from rendered output.
type Preparation ¶ added in v0.7.3
type Preparation struct {
// contains filtered or unexported fields
}
Preparation MUST stay with one logical renderer owner until transfer or retirement. Retained input graphs MUST stay immutable for the full ownership lifetime. Take transfers that lifetime to its destination; clearing the source does not end it.
func (*Preparation) Retire ¶ added in v0.7.3
func (p *Preparation) Retire()
Retire MUST follow the final consumer and clears retained input references.
func (*Preparation) Take ¶ added in v0.7.3
func (p *Preparation) Take( previous *Preparation, client *Client, declaration *manifest.HelmRelease, request *RenderOptions, ) bool
Take MUST NOT move a live capture or grant publication authority.
type RenderAcceptance ¶ added in v0.7.3
type RenderAcceptance struct {
Work *manifest.RenderWork
Owner manifest.NamedResource `json:"Owner"`
Receipt *manifest.RenderReceipt `json:"Receipt"`
Records iter.Seq2[manifest.NamedResource, manifest.DiscoveryRecord] `json:"Records"`
Sources []manifest.SourceEvidence `json:"Sources"`
}
RenderAcceptance binds an accepted inventory to its source paths.
type RenderAdmission ¶ added in v0.7.3
type RenderAdmission struct {
Possible bool
Accepted bool
Key string
Documents []manifest.DocOccurrence
Receipt *manifest.RenderReceipt
}
RenderAdmission carries accepted cache evidence bound to the current request.
type RenderOptions ¶ added in v0.7.3
type RenderOptions struct {
Options
// Preparation borrows immutable values across calls. Retire all owners before mutation.
Preparation *Preparation `json:"-"`
// Work borrows stage counters from this render execution.
Work *manifest.RenderWork `json:"-"`
Sources Sources `json:"Sources"`
// PreparationTasks gates history decoding outside a task body.
// Callers already holding a task slot MUST leave it nil.
PreparationTasks *task.Service `json:"-"`
// DependencySubstitutions binds emitted dependency projection to accepted history.
DependencySubstitutions values.DependencySubstitutions `json:"DependencySubstitutions"`
Admit func(RenderAdmission) (bool, error) `json:"Admit"`
}
RenderOptions supplies one render's captured sources and template settings.
type SecretGetter ¶
type SecretGetter = source.SecretGetter
SecretGetter is the same shape as source.SecretGetter; aliased so the helm Client and the source Fetchers consume one canonical type. The orchestrator wires the same closure into both.
type Sources ¶ added in v0.7.3
type Sources struct {
// contains filtered or unexported fields
}
Sources resolves chart declarations and content from one operation's inputs.
func NewSources ¶ added in v0.7.3
func NewSources(reader sourceReader) Sources
NewSources binds chart resolution to the supplied captured or completed inputs.
func (Sources) Declaration ¶ added in v0.7.3
func (s Sources) Declaration(id manifest.NamedResource) manifest.BaseManifest
Declaration returns the captured chart-source declaration.
func (Sources) LocalSourceArtifact ¶ added in v0.7.3
func (s Sources) LocalSourceArtifact(id manifest.NamedResource, read store.ArtifactRead) *store.SourceArtifact
LocalSourceArtifact returns the selected source content.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package deterministic provides drop-in replacements for the nondeterministic functions Helm exposes to chart templates through sprig — the time-, crypto/rand-, and math/rand-backed ones (now, randAlphaNum, shuffle, genCA, …) — so flate renders byte-identically run to run.
|
Package deterministic provides drop-in replacements for the nondeterministic functions Helm exposes to chart templates through sprig — the time-, crypto/rand-, and math/rand-backed ones (now, randAlphaNum, shuffle, genCA, …) — so flate renders byte-identically run to run. |