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
- type ChartVersion
- type Helm
- func (h *Helm) Available() bool
- func (h *Helm) GetValues(ctx context.Context, release, namespace, kubeContext string) (string, error)
- func (h *Helm) HasVersion(ctx context.Context, repo, chart, version string) (bool, error)
- func (h *Helm) History(ctx context.Context, release, namespace, kubeContext string) ([]Revision, error)
- func (h *Helm) ListRepos(ctx context.Context) ([]Repo, error)
- func (h *Helm) Rollback(ctx context.Context, release, namespace, kubeContext string, revision int) error
- func (h *Helm) SearchVersions(ctx context.Context, repo, chart string) ([]ChartVersion, error)
- func (h *Helm) Status(ctx context.Context, release, namespace, kubeContext string) (Release, error)
- func (h *Helm) Uninstall(ctx context.Context, release, namespace, kubeContext string, keepHistory bool) error
- func (h *Helm) UpdateRepo(ctx context.Context, repo string) error
- func (h *Helm) Upgrade(ctx context.Context, o UpgradeOptions) error
- func (h *Helm) UpgradeCaptured(ctx context.Context, o UpgradeOptions) (flowexec.Result, error)
- func (h *Helm) Version(ctx context.Context) (string, error)
- type Release
- type Repo
- type Revision
- type UpgradeOptions
Constants ¶
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 ¶
Helm wraps the helm binary.
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 ¶
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) 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 ¶
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 ¶
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 ¶
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
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.
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 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.