Documentation
¶
Overview ¶
Package helm runs the helm CLI and renders charts with helm template.
Index ¶
Constants ¶
const Binary = "helm"
Binary is the helm executable Run looks up on PATH.
Variables ¶
This section is empty.
Functions ¶
func ChartVersion ¶
ChartVersion decodes OCI tag build metadata for Helm's semantic-version inputs. It preserves the leading v and build identity; pins and provenance retain the tag.
func RenderChart ¶
func RenderChart(ctx context.Context, input ChartInput) ([]byte, error)
RenderChart returns the YAML helm template renders for input. It fails as Run does, and with ErrCodeInvalidRequest when input.Chart is empty.
func Run ¶
func Run(ctx context.Context, timeout time.Duration, outputLimit int64, args ...string) ([]byte, error)
Run runs helm with args, stopping after timeout or when ctx ends, and returns its stdout. On failure it also returns the stdout written so far, with an error that has code
- ErrCodeInvalidRequest when args is empty
- ErrCodeInternal when stdout exceeds outputLimit bytes
- ErrCodeTimeout or ErrCodeCanceled when timeout or ctx ends first
- ErrCodeInternal otherwise, with helm's "Error:" line in the message and the last defaults.HelmStderrLimit bytes of stderr in its context
Types ¶
type CLIRenderer ¶
type CLIRenderer struct{}
CLIRenderer implements Renderer by shelling out to the helm CLI binary.
func (*CLIRenderer) Render ¶
func (r *CLIRenderer) Render(ctx context.Context, input ChartInput) ([]byte, error)
Render delegates to RenderChart after verifying the helm binary is available on PATH.
type ChartInput ¶
type ChartInput struct {
// Name is the release name suffix (rendered as "release-<Name>").
Name string
// Chart is the chart name (e.g., "gpu-operator").
Chart string
// Repository is the chart repository URL (oci:// or https://).
Repository string
// Version is the pinned chart version.
Version string
// Namespace is the target Kubernetes namespace.
Namespace string
// ValuesPath is a path to a values.yaml file on disk. Empty means skip.
ValuesPath string
// Values are inline values piped to helm on stdin. When both ValuesPath
// and Values are set, both are passed via separate --values flags (Helm
// merges them, with Values winning).
Values map[string]any
// KubeVersion is passed to --kube-version. When empty,
// defaults.MirrorDefaultKubeVersion is used.
KubeVersion string
// APIVersions is passed as --api-versions entries. When nil,
// defaults.MirrorExtraAPIVersions is used.
APIVersions []string
// IncludeCRDs is passed to --include-crds.
IncludeCRDs bool
}
ChartInput carries the parameters for a single helm template invocation.
type Renderer ¶
type Renderer interface {
Render(ctx context.Context, input ChartInput) ([]byte, error)
}
Renderer renders a Helm chart to YAML bytes. The default implementation (CLIRenderer) shells out to `helm template`; tests inject a mock that returns canned YAML without requiring the helm binary on PATH.