* fix: add --force-update flag for Helm 4 to prevent stale repository indexes Fixes #2337 Problem: Helmfile with Helm v4 doesn't update repository indexes when adding repos, leading to stale indexes and errors like: "chart matching version not found in example index. (try 'helm repo update')" This happens because Helm 4 changed behavior compared to Helm 3: - Helm 3: Always downloads index when running "helm repo add", even if repo exists - Helm 4: Skips downloading index if repo already exists with same config (see: https://github.com/helm/helm/blob/v4.0.4/pkg/cmd/repo_add.go#L200) Without --force-update, helmfile only works initially because Helm 4 downloads index on fresh repo setup, but subsequent "helmfile repos" commands result in stale indexes. Root Cause: The code only added --force-update for Helm 3.3.2+, but not for Helm 4, since it was believed to be default behavior in Helm 4. However, Helm 4 requires explicit --force-update flag to update indexes for existing repos. Solution: Add --force-update flag for Helm 4 in AddRepo function to ensure repository indexes are updated even when repository already exists. Refactoring: Simplified the conditional logic from nested if statements to a single readable condition using existing IsVersionAtLeast() helper: if !helm.options.DisableForceUpdate && (helm.IsHelm4() || helm.IsVersionAtLeast("3.3.2")) { args = append(args, "--force-update") } Changes: - pkg/helmexec/exec.go: Add --force-update for Helm 4 - pkg/helmexec/exec_test.go: Update test expectations for both Helm 3.3.2+ and Helm 4 - AGENTS.md: Add development guide for the repository Testing: - All helmexec package tests pass - Verified build succeeds - Tested against Helm 3.2.0 (no force-update) - Tested against Helm 3.3.2+ (with force-update) - Tested against Helm 4.0.1 (with force-update) Signed-off-by: opencode <opencode@users.noreply.github.com> Signed-off-by: yxxhero <aiopsclub@163.com> * test: update expected output for Helm 4 repo add message Update integration test expectations to match Helm 4 behavior with --force-update flag. When --force-update is used, Helm 4 now outputs "has been added to your repositories" instead of "already exists with the same configuration, skipping", because it forcibly updates the repository index. Related to #2337 Signed-off-by: opencode <opencode@users.noreply.github.com> Signed-off-by: yxxhero <aiopsclub@163.com> --------- Signed-off-by: opencode <opencode@users.noreply.github.com> Signed-off-by: yxxhero <aiopsclub@163.com> |
||
|---|---|---|
| .github | ||
| cmd | ||
| docs | ||
| examples | ||
| hack | ||
| logo | ||
| pkg | ||
| test | ||
| .dockerignore | ||
| .editorconfig | ||
| .gitignore | ||
| .golangci.yaml | ||
| .goreleaser.yml | ||
| .readthedocs.yaml | ||
| AGENTS.md | ||
| CODEOWNERS | ||
| CONTRIBUTING.md | ||
| Dockerfile | ||
| Dockerfile.debian-stable-slim | ||
| Dockerfile.ubuntu | ||
| LICENSE | ||
| Makefile | ||
| README-zh_CN.md | ||
| README.md | ||
| SECURITY.md | ||
| USERS.md | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| mkdocs.yml | ||
README.md
English | 简体中文
About
Helmfile is a declarative spec for deploying helm charts. It lets you...
- Keep a directory of chart value files and maintain changes in version control.
- Apply CI/CD to configuration changes.
- Periodically sync to avoid skew in environments.
To avoid upgrades for each iteration of helm, the helmfile executable delegates to helm - as a result, the following must be installed
Highlights
Declarative: Write, version-control, apply the desired state file for visibility and reproducibility.
Modules: Modularize common patterns of your infrastructure, distribute it via Git, S3, etc. to be reused across the entire company (See #648)
Versatility: Manage your cluster consisting of charts, kustomizations, and directories of Kubernetes resources, turning everything to Helm releases (See #673)
Patch: JSON/Strategic-Merge Patch Kubernetes resources before helm-installing, without forking upstream charts (See #673)
Status
May 2025 Update
- Helmfile v1.0 and v1.1 has been released. We recommend upgrading directly to v1.1 if you are still using v0.x.
- If you haven't already upgraded, please go over this v1 proposal here to see a small list of breaking changes.
Installation
1: Binary Installation
download one of releases
2: Package Manager
- Archlinux: install via
pacman -S helmfile - openSUSE: install via
zypper in helmfileassuming you are on Tumbleweed; if you are on Leap you must add the kubic repo for your distribution version once before that command, e.g.zypper ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Leap_\$releasever kubic - Windows (using scoop):
scoop install helmfile - macOS (using homebrew):
brew install helmfile - Linux/macOS/Windows (using mise):
mise use -g helmfile@latest
3: Container
For more details, see run as a container
Make sure to run
helmfile initonce after installation. Helmfile uses the helm-diff plugin.
Getting Started
Let's start with a simple helmfile and gradually improve it to fit your use-case!
Suppose the helmfile.yaml representing the desired state of your helm releases looks like:
repositories:
- name: prometheus-community
url: https://prometheus-community.github.io/helm-charts
releases:
- name: prom-norbac-ubuntu
namespace: prometheus
chart: prometheus-community/prometheus
set:
- name: rbac.create
value: false
Sync your Kubernetes cluster state to the desired one by running:
helmfile apply
Congratulations! You now have your first Prometheus deployment running inside your cluster.
Iterate on the helmfile.yaml by referencing:
More complex examples
See: multi-env-helmfile
Docs
Please read complete documentation
Contributing
Welcome to contribute together to make helmfile better: contributing doc
Attribution
We use:
- semtag for automated semver tagging. I greatly appreciate the author(pnikosis)'s effort on creating it and their kindness to share it!
Users
Helmfile has been used by many users in production:
For more users, please see: Users