helmx

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package helmx wraps the helm CLI: chart index queries, upgrades, and the release introspection that `flow cluster status` and `history` render.

Index

Constants

View Source
const StatusDeployed = "deployed"

StatusDeployed is helm's status for a release whose last operation succeeded. Every other status — failed, pending-upgrade, uninstalling — means the release needs explaining.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartVersion

type ChartVersion struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	AppVersion  string `json:"app_version"`
	Description string `json:"description"`
}

ChartVersion is one row from `helm search repo --versions`.

type Helm

type Helm struct {
	Runner flowexec.Runner
	Bin    string
}

Helm wraps the helm binary.

func New

func New(r flowexec.Runner) *Helm

New returns a Helm for the helm binary.

func (*Helm) Available

func (h *Helm) Available() bool

Available reports whether helm is on PATH.

func (*Helm) GetValues

func (h *Helm) GetValues(ctx context.Context, release, namespace, kubeContext string) (string, error)

GetValues returns the values actually deployed for a release.

func (*Helm) HasVersion

func (h *Helm) HasVersion(ctx context.Context, repo, chart, version string) (bool, error)

HasVersion reports whether a specific version is present in the index.

func (*Helm) History

func (h *Helm) History(ctx context.Context, release, namespace, kubeContext string) ([]Revision, error)

History returns the release's revision history, newest last.

func (*Helm) ListRepos

func (h *Helm) ListRepos(ctx context.Context) ([]Repo, error)

ListRepos returns the configured chart repositories.

func (*Helm) Rollback

func (h *Helm) Rollback(ctx context.Context, release, namespace, kubeContext string, revision int) error

Rollback reverts a release to a previous revision. Revision 0 means the immediately previous one, which is helm's own default.

func (*Helm) SearchVersions

func (h *Helm) SearchVersions(ctx context.Context, repo, chart string) ([]ChartVersion, error)

SearchVersions lists every published version of a chart, including pre-releases: the alpha chart versions CI publishes are all pre-releases, so --devel is mandatory here.

func (*Helm) Status

func (h *Helm) Status(ctx context.Context, release, namespace, kubeContext string) (Release, error)

Status returns the deployed release's summary.

It reads `helm get metadata`, not `helm status`. Status once carried the chart under a nested chart.metadata object, but that was helm 3: helm 4 emits only name, namespace, version, info, config and manifest, so every chart and app version flow read from it came back empty. get metadata is the command built for this question — it answers in one call, and it keeps the chart name and its version apart rather than in helm's joined "<name>-<version>" rendering, which cannot be split back (both halves may contain hyphens).

The floor this sets is helm 3.10, where get metadata landed.

func (*Helm) Uninstall

func (h *Helm) Uninstall(ctx context.Context, release, namespace, kubeContext string, keepHistory bool) error

Uninstall removes a release.

func (*Helm) UpdateRepo

func (h *Helm) UpdateRepo(ctx context.Context, repo string) error

UpdateRepo refreshes one chart repository's index.

func (*Helm) Upgrade

func (h *Helm) Upgrade(ctx context.Context, o UpgradeOptions) error

Upgrade runs helm upgrade, streaming helm's output straight to the terminal so the user sees progress and errors as helm produces them.

func (*Helm) UpgradeCaptured added in v0.4.0

func (h *Helm) UpgradeCaptured(ctx context.Context, o UpgradeOptions) (flowexec.Result, error)

UpgradeCaptured runs the same upgrade with helm's output captured instead of streamed, so the caller can drive a spinner while helm works. The Result is returned even on failure: ExitError carries only the first line of stderr, and a helm failure is rarely one line.

func (*Helm) Version

func (h *Helm) Version(ctx context.Context) (string, error)

Version returns helm's version string.

type Release

type Release struct {
	Name         string    `json:"name"`
	Namespace    string    `json:"namespace"`
	Revision     int       `json:"revision"`
	Status       string    `json:"status"`
	LastDeployed time.Time `json:"last_deployed"`
	ChartName    string    `json:"chart_name"`
	ChartVersion string    `json:"chart_version"`
	AppVersion   string    `json:"app_version"`
	// Description is helm's outcome message for the current revision, and is
	// only fetched for a release that is not deployed: see fillDescription.
	Description string `json:"description,omitempty"`
}

Release is the deployed release's identity and state.

type Repo

type Repo struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

Repo is one entry from `helm repo list`.

type Revision

type Revision struct {
	Revision    int       `json:"revision"`
	Updated     time.Time `json:"updated"`
	Status      string    `json:"status"`
	Chart       string    `json:"chart"`
	AppVersion  string    `json:"app_version"`
	Description string    `json:"description"`
}

Revision is one row of `helm history`.

type UpgradeOptions

type UpgradeOptions struct {
	Release     string
	Chart       string
	Namespace   string
	Version     string
	KubeContext string
	ValuesFiles []string
	SetValues   []string
	ExtraArgs   []string
	Install     bool
	Wait        bool
	Atomic      bool
	CreateNS    bool
	Timeout     string
	DryRun      bool
}

UpgradeOptions describes a `helm upgrade` invocation.

func (UpgradeOptions) CommandLine

func (o UpgradeOptions) CommandLine(bin string) string

CommandLine renders the upgrade as a copy-pasteable shell command.

func (UpgradeOptions) UpgradeArgs

func (o UpgradeOptions) UpgradeArgs() []string

UpgradeArgs renders the full argv. It is exported so the command can print the exact invocation before running it — the printed line and the executed command can then never disagree.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL