mirror of
https://github.com/helmfile/helmfile.git
synced 2026-09-30 08:50:54 +02:00
fix: helmfile fetch fails for kustomization directories (#2504)
* fix: helmfile fetch fails for kustomization directories
Fixes #2503
When running `helmfile fetch` on a release that points to a local
kustomization directory (without Chart.yaml), the command failed with
"Chart.yaml is missing".
The issue was that the condition `helmfileCommand != "pull"` in
prepareChartForRelease skipped chartification for ALL cases during
fetch, including local kustomization directories that NEED chartify
to convert them to Helm charts.
Solution:
- Added `NeedsChartifyForLocalDir` field to the Chartify struct to
track when chartification is needed because the local directory
is not a Helm chart (no Chart.yaml)
- Modified the condition to skip chartification for "pull" ONLY when
it's not a local directory without Chart.yaml
This preserves the original fix (commit 1f134d93) for remote charts
with transformers while fixing local kustomization directories.
Signed-off-by: yxxhero <aiopsclub@163.com>
* test: add integration test for helmfile fetch with kustomization
Add test case for issue #2503 to verify helmfile fetch works correctly
with local kustomization directories (without Chart.yaml).
Signed-off-by: yxxhero <aiopsclub@163.com>
---------
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -107,6 +107,7 @@ ${kubectl} create namespace ${test_ns} || fail "Could not create namespace ${tes
|
||||
. ${dir}/test-cases/skip-diff-output.sh
|
||||
. ${dir}/test-cases/v1-subhelmfile-multi-bases-with-array-values.sh
|
||||
. ${dir}/test-cases/kustomized-fetch.sh
|
||||
. ${dir}/test-cases/issue-2503-kustomize-fetch.sh
|
||||
. ${dir}/test-cases/regression.sh
|
||||
. ${dir}/test-cases/secretssops.sh
|
||||
. ${dir}/test-cases/yaml-overwrite.sh
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
issue_2503_input_dir="${cases_dir}/issue-2503-kustomize-fetch/input"
|
||||
|
||||
test_start "issue-2503 helmfile fetch with kustomization directory"
|
||||
|
||||
info "Testing helmfile fetch with local kustomization directory (issue #2503)"
|
||||
|
||||
for i in $(seq 3); do
|
||||
info "Testing helmfile fetch with kustomization #$i"
|
||||
issue_2503_tmp=$(mktemp -d)
|
||||
${helmfile} -f ${issue_2503_input_dir}/helmfile.yaml fetch --output-dir ${issue_2503_tmp} || fail "\"helmfile fetch\" shouldn't fail with kustomization directory"
|
||||
rm -fr ${issue_2503_tmp}
|
||||
done
|
||||
|
||||
test_pass "issue-2503 helmfile fetch with kustomization directory"
|
||||
@@ -0,0 +1,3 @@
|
||||
releases:
|
||||
- name: test-kustomize
|
||||
chart: ./kustomize
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: test-configmap
|
||||
data:
|
||||
key: value
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- configmap.yaml
|
||||
Reference in New Issue
Block a user