helmcmd

package
v0.10.0-rc17 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package helmcmd contains small helpers for invoking the pinned helm binary.

The main job here is keeping `helmfile sync` working across helm major versions. Helm 4 turned server-side apply on by default; SSA introduces field-ownership conflicts (the apiserver synthesises a "before-first-apply" manager for any field that pre-existed the first SSA call) that helm 4 only takes over when --force-conflicts is passed. Helm 3 used client-side apply, has no SSA and rejects --force-conflicts as an unknown flag, so the flag must only be appended on helm 4+.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureRepos added in v0.10.0

func EnsureRepos(helmBinary string, repos []helmfileRepo) error

EnsureRepos registers each (name, url) pair via `helm repo add --force-update` so that a fresh host without `helm repo add` for our managed repos still gets them registered before we ask helm to update them by name. Best-effort: failures are returned for visibility but should not be treated as fatal by callers (the subsequent `helm repo update` will surface real problems).

func MajorVersion

func MajorVersion(helmBinary string) (int, error)

MajorVersion runs `<helmBinary> version --short` and returns the major version integer (3, 4, ...). Returns an error if helm cannot be invoked or the output is unparseable.

func ManagedRepoNames added in v0.10.0

func ManagedRepoNames(helmfilePath string) ([]string, error)

ManagedRepoNames returns just the repo names from a helmfile.yaml. These are the only repos this stack is responsible for keeping up to date; everything else in the user's global `helm repo list` belongs to other tools.

func ParseHelmfileRepos added in v0.10.0

func ParseHelmfileRepos(helmfilePath string) ([]helmfileRepo, error)

ParseHelmfileRepos extracts (name, url) entries from a helmfile.yaml file. Repos without both a name and a URL (e.g. OCI-only refs) are skipped — they are not added via `helm repo add` so they don't participate in the `helm repo update` path that this package guards against.

func RepoUpdateSupportsFailOnRepoUpdateFail added in v0.10.0

func RepoUpdateSupportsFailOnRepoUpdateFail(helmBinary string) bool

RepoUpdateSupportsFailOnRepoUpdateFail reports whether the current helm binary accepts `helm repo update --fail-on-repo-update-fail=false`.

Do not infer this from the major version. Some Helm 4 builds dropped the flag even though Helm 3.14+ had it, and passing an unknown flag prevents the targeted repo update from running at all.

func SyncFlagsForVersion

func SyncFlagsForVersion(helmBinary string) []string

SyncFlagsForVersion returns the extra `helmfile sync` flags needed for the detected helm version. On helm 4+ this is --sync-args=--force-conflicts so helm's SSA upgrade can take ownership of fields previously written by other managers (e.g. `kubectl apply`, the `obol model setup` patch on litellm-config.data.config.yaml, or fields recorded under the synthetic "before-first-apply" manager). On helm 3 this returns nil — helm 3 uses client-side apply and rejects --force-conflicts.

Detection failures degrade silently to nil so a missing/old helm binary doesn't block the user; the helmfile sync will still surface the real error.

func UpdateRepos added in v0.10.0

func UpdateRepos(helmBinary string, names []string) ([]byte, error)

UpdateRepos runs `helm repo update <names...>` and, when the helm binary advertises support, passes --fail-on-repo-update-fail=false so that a single dead repo doesn't abort the whole update.

Behaviour:

  • helm versions that advertise --fail-on-repo-update-fail: the flag is passed and the returned error is nil even if individual repos in `names` fail.
  • other helm versions: the flag is omitted and the error surfaces normally.

The targeted form (`helm repo update <names...>`) is important: it limits the update to repos this stack actually needs, so unrelated dead repos in the user's global helm config can't break us even on helm versions that lack the tolerant flag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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