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) PrepareChart(ctx context.Context, hr *manifest.HelmRelease, input *RenderOptions) (pending func(context.Context) (source.PreparedFetch, error), resultErr error)
- func (c *Client) PreviousRender(ctx context.Context, hr *manifest.HelmRelease, hrValues map[string]any, ...) (iter.Seq2[manifest.NamedResource, manifest.DiscoveryRecord], bool)
- 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 RenderAdmission
- type RenderError
- type RenderOptions
- 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, inputs []values.Result, cache *values.Cache, ) (*manifest.HelmRelease, error)
Prepare MUST preserve authored dependencies for accepted-history identity.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client renders HelmReleases. Construct with NewClient.
func NewClient ¶
NewClient callers MUST keep the cache and fetcher open until all client operations finish.
func (*Client) PrepareChart ¶
func (c *Client) PrepareChart( ctx context.Context, hr *manifest.HelmRelease, input *RenderOptions, ) (pending func(context.Context) (source.PreparedFetch, error), resultErr error)
PrepareChart MUST leave transport and cleanup ownership with the acquisition continuation.
func (*Client) PreviousRender ¶
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) StaleValuePaths ¶
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 controls upstream Helm CRD generation.
SkipCRDs bool `json:"SkipCRDs"`
// SkipTests excludes templates that are helm test hooks.
SkipTests bool `json:"SkipTests"`
// SkipKinds MUST hold the complete, sorted, unique emission policy, including CRDs.
// Callers keep it immutable and keep SkipCRDs consistent with its CRD membership.
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.
type Preparation ¶
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.
func (*Preparation) AcceptChartDependency ¶
func (p *Preparation) AcceptChartDependency(ctx context.Context, artifact *store.SourceArtifact) error
AcceptChartDependency consumes the artifact before the acquisition owner closes its handle.
func (*Preparation) Matches ¶
func (p *Preparation) Matches(client *Client, declaration *manifest.HelmRelease, request *RenderOptions) bool
Matches MUST NOT grant publication authority or validate current source bytes.
type RenderAdmission ¶
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 RenderError ¶
type RenderError struct {
Err error
}
RenderError MUST wrap only engine failures after input preparation.
func (*RenderError) Error ¶
func (e *RenderError) Error() string
func (*RenderError) Unwrap ¶
func (e *RenderError) Unwrap() error
type RenderOptions ¶
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:"-"`
Omitted []manifest.NamedResource `json:"Omitted"`
Admit func(RenderAdmission) (bool, error) `json:"Admit"`
}
RenderOptions supplies one render's captured sources and template settings.
type Sources ¶
type Sources struct {
// contains filtered or unexported fields
}
Sources resolves chart declarations and content from one operation's inputs.
func NewSources ¶
func NewSources(reader sourceReader, index *manifest.DiscoveryIndex) Sources
NewSources requires that the index MUST remain immutable throughout the operation.
func (Sources) Declaration ¶
func (s Sources) Declaration(id manifest.NamedResource) manifest.BaseManifest
Declaration returns the captured chart-source declaration.
func (Sources) LocalSourceArtifact ¶
func (s Sources) LocalSourceArtifact(id manifest.NamedResource, read store.ArtifactRead) *store.SourceArtifact
LocalSourceArtifact returns the selected source content.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package chartinput enumerates regular files under Helm's input policies.
|
Package chartinput enumerates regular files under Helm's input policies. |
|
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. |