TL;DR
| |
And in CI, pinned versions of all three pieces (helm, helmfile, helm-diff): half of helmfile’s odd errors are combinations nobody tested together.
The errors and what fixes them
| Message | Cause | Fix |
|---|---|---|
helmfile diff says nothing changed, but the cluster does not match the chart | helm-diff compares the last release’s manifest with the new one, not the live state; a manual kubectl edit never shows up | HELM_DIFF_THREE_WAY_MERGE=true (or --three-way-merge in helm-diff) |
| The diff is full of quoting, key order and indentation changes | Different Helm or chart versions serialize differently | HELM_DIFF_NORMALIZE_MANIFESTS=true |
key "image" already set in map while rendering values | The old YAML library rejects duplicate keys and some anchors in values | HELMFILE_GOCCY_GOYAML=true on helmfile 0.x; helmfile 1.x already uses that library |
Body is too long (maximum is 65536 characters) or the job takes forever on the first install | A fresh install’s diff is the whole chart, and the PR comment or the log cannot hold it | --skip-diff-on-install |
Error: failed to authorize: … 403 Forbidden pulling a chart from oci://ghcr.io/… | Helm older than 3.8 with experimental OCI support, or no helm registry login | Upgrade helm; helm registry login ghcr.io if the registry is private |
Error: validation: more than one dependency with name or alias | helm and helmfile out of step (helm 3.15 needed helmfile ≥ 0.164; helm 3.13 went with 0.158) | Upgrade helmfile alongside helm; on 1.x it no longer happens |
| The diff has no color in CI | helm-diff detects there is no TTY | HELM_DIFF_COLOR=true |
Adopting resources that already exist
The typical case: someone installed ArgoCD (or whatever) with kubectl apply -f, and now you want a helmfile release to manage it. Helm refuses to install over resources that are not its own (rendered manifests contain a resource that already exists … invalid ownership metadata). Since Helm 3.2 it is enough to mark them as Helm’s before installing:
| |
Only mark what the chart is going to render: a labeled resource the chart does not include is harmless, but one the chart renders under another name ends up duplicated.
helmfile 1.x and Helm 4
Coming from 0.x, this is what changes when you upgrade:
- A
helmfile.yamlwith Go templates must be calledhelmfile.yaml.gotmpl; a plain.yamlis no longer rendered. environments:andreleases:go in separate parts split by---within the same file.helmfile deleteis gone (it isdestroy), so ishelmfile charts, and--argsis removed.HELMFILE_SKIP_INSECURE_TEMPLATE_FUNCTIONSbecomesHELMFILE_DISABLE_INSECURE_FEATURES.- helmfile 1.x works with Helm 3 and Helm 4. With Helm 4, install helm-diff with
helm plugin install https://github.com/databus23/helm-diff --verify=false(Helm 4 verifies plugin provenance and helm-diff does not publish it).
Traps
applywith no prior diff in CI:helmfile applyalready diffs and only applies when there are changes;syncalways applies. In pipelines,diffon the PR andapplyon main.installed: falseuninstalls the release on the nextapply; handy to retire things through Git, dangerous if copied from another environment.- Secrets in
values: helmfile leaves them in the release manifest (Helm’s Secret in the namespace); usehelm-secretswith SOPS or external references. --skip-diff-on-installis not--skip-diff: it only skips the diff for releases that do not exist yet. Upgrades still show their diff.- Three binaries, three versions:
helm version,helmfile versionandhelm plugin listas the first pipeline step, pinned by tag in the CI image.
References: helm-diff, helmfile and the towards 1.0 proposal.
See also
- k3s: import images without a registry — when the release depends on an image that lives in no registry.