mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-21 00:33:35 +02:00
* fix #1095 Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -76,12 +76,13 @@ ${kubectl} create namespace ${test_ns} || fail "Could not create namespace ${tes
|
||||
|
||||
# TEST CASES----------------------------------------------------------------------------------------------------------
|
||||
|
||||
. ${dir}/test-cases/happypath.sh
|
||||
. ${dir}/test-cases/chartify-with-non-chart-dir.sh
|
||||
. ${dir}/test-cases/diff-args.sh
|
||||
. ${dir}/test-cases/helmfile-double-fetch.sh
|
||||
. ${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/happypath.sh
|
||||
. ${dir}/test-cases/regression.sh
|
||||
. ${dir}/test-cases/secretssops.sh
|
||||
. ${dir}/test-cases/yaml-overwrite.sh
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
cli-overwrite-environment-values_input_dir="${cases_dir}/cli-overwrite-environment-values/input"
|
||||
cli-overwrite-environment-values_output_dir="${cases_dir}/cli-overwrite-environment-values/output"
|
||||
cli_overwrite_environment_values_input_dir="${cases_dir}/cli-overwrite-environment-values/input"
|
||||
cli_overwrite_environment_values_output_dir="${cases_dir}/cli-overwrite-environment-values/output"
|
||||
|
||||
cli_overwrite_environment_values_tmp=$(mktemp -d)
|
||||
cli_overwrite_environment_values_reverse=${cli_overwrite_environment_values_tmp}/cli.environment.override.build.yaml
|
||||
@@ -8,21 +8,21 @@ case_title="cli overwrite environment values"
|
||||
|
||||
if [[ ${HELMFILE_V1MODE} = true ]]; then
|
||||
test_start "$case_title for v1"
|
||||
info "Comparing ${case_title} for v1 output ${cli_overwrite_environment_values_reverse} with ${cli-overwrite-environment-values_output_dir}/overwritten.yaml"
|
||||
info "Comparing ${case_title} for v1 output ${cli_overwrite_environment_values_reverse} with ${cli_overwrite_environment_values_output_dir}/overwritten.yaml"
|
||||
for i in $(seq 10); do
|
||||
info "Comparing build/cli-overwrite-environment-values #$i"
|
||||
${helmfile} -f ${cli-overwrite-environment-values_input_dir}/input_v1.yaml.gotmpl template --state-values-set ns=test3 > ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" shouldn't fail"
|
||||
diff -u ${cli-overwrite-environment-values_output_dir}/output_v1.yaml ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" should be consistent"
|
||||
${helmfile} -f ${cli_overwrite_environment_values_input_dir}/input_v1.yaml.gotmpl template --state-values-set ns=test3 > ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" shouldn't fail"
|
||||
diff -u ${cli_overwrite_environment_values_output_dir}/output_v1.yaml ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" should be consistent"
|
||||
echo code=$?
|
||||
done
|
||||
test_pass "cli overwrite environment values for v1"
|
||||
else
|
||||
test_start "${case_title}"
|
||||
info "Comparing ${case_title} output ${cli_overwrite_environment_values_reverse} with ${cli-overwrite-environment-values_output_dir}/overwritten.yaml"
|
||||
info "Comparing ${case_title} output ${cli_overwrite_environment_values_reverse} with ${cli_overwrite_environment_values_output_dir}/overwritten.yaml"
|
||||
for i in $(seq 10); do
|
||||
info "Comparing build/cli-overwrite-environment-values #$i"
|
||||
${helmfile} -f ${cli-overwrite-environment-values_input_dir}/input_v1.yaml.gotmpl template --state-values-set ns=test3 > ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" shouldn't fail"
|
||||
diff -u ${cli-overwrite-environment-values_output_dir}/output_v1.yaml ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" should be consistent"
|
||||
${helmfile} -f ${cli_overwrite_environment_values_input_dir}/input_v1.yaml.gotmpl template --state-values-set ns=test3 > ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" shouldn't fail"
|
||||
diff -u ${cli_overwrite_environment_values_output_dir}/output_v1.yaml ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" should be consistent"
|
||||
echo code=$?
|
||||
done
|
||||
test_pass "${case_title}"
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
chartifyTempDir: environment_overwrite_values
|
||||
helmfileArgs:
|
||||
- template
|
||||
- --state-values-set
|
||||
- ns=test3
|
||||
@@ -0,0 +1,28 @@
|
||||
diff_args_input_dir="${cases_dir}/diff-args/input"
|
||||
diff_args_output_dir="${cases_dir}/diff-args/output"
|
||||
|
||||
diff_args_tmp=$(mktemp -d)
|
||||
diff_args_reverse=${diff_args_tmp}/diff.args.build.yaml
|
||||
|
||||
case_title="diff args"
|
||||
diff_out_file=${diff_args_output_dir}/diff
|
||||
apply_out_file=${diff_args_output_dir}/apply
|
||||
if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then
|
||||
apply_out_file=${diff_args_output_dir}/apply-live
|
||||
diff_out_file=${diff_args_output_dir}/diff-live
|
||||
fi
|
||||
|
||||
test_start "$case_title"
|
||||
info "Comparing ${case_title} diff for output ${diff_args_reverse} with ${diff_out_file}"
|
||||
for i in $(seq 10); do
|
||||
info "Comparing diff-args diff log #$i"
|
||||
${helmfile} -f ${diff_args_input_dir}/helmfile.yaml diff > ${diff_args_reverse} || fail "\"helmfile diff\" shouldn't fail"
|
||||
diff -u ${diff_out_file} ${diff_args_reverse} || fail "\"helmfile diff\" should be consistent"
|
||||
echo code=$?
|
||||
done
|
||||
info "Comparing ${case_title} apply for output ${diff_args_reverse} with ${apply_out_file}"
|
||||
${helmfile} -f ${diff_args_input_dir}/helmfile.yaml apply | grep -vE "^(LAST DEPLOYED|installed)" > ${diff_args_reverse} || fail "\"helmfile apply\" shouldn't fail"
|
||||
diff -u ${apply_out_file} ${diff_args_reverse} || fail "\"helmfile apply\" should be consistent"
|
||||
echo "clean up diff args resources"
|
||||
${helmfile} -f ${diff_args_input_dir}/helmfile.yaml destroy || fail "\"helmfile destroy\" shouldn't fail"
|
||||
test_pass "$case_title"
|
||||
@@ -0,0 +1,10 @@
|
||||
helmDefaults:
|
||||
diffArgs:
|
||||
- "--three-way-merge"
|
||||
releases:
|
||||
- name: uninstalled
|
||||
chart: ../../../charts/httpbin
|
||||
installed: false
|
||||
- name: installed
|
||||
chart: ../../../charts/httpbin
|
||||
installed: true
|
||||
@@ -0,0 +1,77 @@
|
||||
Comparing release=installed, chart=../../../charts/httpbin
|
||||
********************
|
||||
|
||||
Release was not present in Helm. Diff will show entire contents as new.
|
||||
|
||||
********************
|
||||
helmfile-tests, installed-httpbin, Deployment (apps) has been added:
|
||||
-
|
||||
+ apiVersion: apps/v1
|
||||
+ kind: Deployment
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ chart: httpbin-0.1.0
|
||||
+ heritage: Helm
|
||||
+ release: installed
|
||||
+ name: installed-httpbin
|
||||
+ namespace: helmfile-tests
|
||||
+ spec:
|
||||
+ replicas: 1
|
||||
+ selector:
|
||||
+ matchLabels:
|
||||
+ app: httpbin
|
||||
+ strategy: {}
|
||||
+ template:
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ release: installed
|
||||
+ spec:
|
||||
+ containers:
|
||||
+ - image: docker.io/citizenstig/httpbin:latest
|
||||
+ imagePullPolicy: IfNotPresent
|
||||
+ livenessProbe:
|
||||
+ httpGet:
|
||||
+ path: /
|
||||
+ port: 8000
|
||||
+ name: httpbin
|
||||
+ ports:
|
||||
+ - containerPort: 8000
|
||||
+ readinessProbe:
|
||||
+ httpGet:
|
||||
+ path: /
|
||||
+ port: 8000
|
||||
+ resources: {}
|
||||
+ status: {}
|
||||
helmfile-tests, installed-httpbin, Service (v1) has been added:
|
||||
-
|
||||
+ apiVersion: v1
|
||||
+ kind: Service
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ chart: httpbin-0.1.0
|
||||
+ heritage: Helm
|
||||
+ release: installed
|
||||
+ name: installed-httpbin
|
||||
+ namespace: helmfile-tests
|
||||
+ spec:
|
||||
+ ports:
|
||||
+ - name: httpbin
|
||||
+ port: 8000
|
||||
+ protocol: TCP
|
||||
+ targetPort: 8000
|
||||
+ selector:
|
||||
+ app: httpbin
|
||||
+ release: installed
|
||||
+ type: LoadBalancer
|
||||
|
||||
Release "installed" does not exist. Installing it now.
|
||||
NAME: installed
|
||||
NAMESPACE: helmfile-tests
|
||||
STATUS: deployed
|
||||
REVISION: 1
|
||||
TEST SUITE: None
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
********************
|
||||
|
||||
Release was not present in Helm. Diff will show entire contents as new.
|
||||
|
||||
********************
|
||||
helmfile-tests, installed-httpbin, Deployment (apps) has been added:
|
||||
-
|
||||
+ apiVersion: apps/v1
|
||||
+ kind: Deployment
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ chart: httpbin-0.1.0
|
||||
+ heritage: Helm
|
||||
+ release: installed
|
||||
+ name: installed-httpbin
|
||||
+ namespace: helmfile-tests
|
||||
+ spec:
|
||||
+ replicas: 1
|
||||
+ selector:
|
||||
+ matchLabels:
|
||||
+ app: httpbin
|
||||
+ strategy: {}
|
||||
+ template:
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ release: installed
|
||||
+ spec:
|
||||
+ containers:
|
||||
+ - image: docker.io/citizenstig/httpbin:latest
|
||||
+ imagePullPolicy: IfNotPresent
|
||||
+ livenessProbe:
|
||||
+ httpGet:
|
||||
+ path: /
|
||||
+ port: 8000
|
||||
+ name: httpbin
|
||||
+ ports:
|
||||
+ - containerPort: 8000
|
||||
+ readinessProbe:
|
||||
+ httpGet:
|
||||
+ path: /
|
||||
+ port: 8000
|
||||
+ resources: {}
|
||||
+ status: {}
|
||||
helmfile-tests, installed-httpbin, Service (v1) has been added:
|
||||
-
|
||||
+ apiVersion: v1
|
||||
+ kind: Service
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ chart: httpbin-0.1.0
|
||||
+ heritage: Helm
|
||||
+ release: installed
|
||||
+ name: installed-httpbin
|
||||
+ namespace: helmfile-tests
|
||||
+ spec:
|
||||
+ ports:
|
||||
+ - name: httpbin
|
||||
+ port: 8000
|
||||
+ protocol: TCP
|
||||
+ targetPort: 8000
|
||||
+ selector:
|
||||
+ app: httpbin
|
||||
+ release: installed
|
||||
+ type: LoadBalancer
|
||||
Error: identified at least one change, exiting with non-zero exit code (detailed-exitcode parameter enabled)
|
||||
Error: plugin "diff" exited with error
|
||||
Comparing release=installed, chart=../../../charts/httpbin
|
||||
Release "installed" does not exist. Installing it now.
|
||||
NAME: installed
|
||||
NAMESPACE: helmfile-tests
|
||||
STATUS: deployed
|
||||
REVISION: 1
|
||||
TEST SUITE: None
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
Comparing release=installed, chart=../../../charts/httpbin
|
||||
********************
|
||||
|
||||
Release was not present in Helm. Diff will show entire contents as new.
|
||||
|
||||
********************
|
||||
helmfile-tests, installed-httpbin, Deployment (apps) has been added:
|
||||
-
|
||||
+ apiVersion: apps/v1
|
||||
+ kind: Deployment
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ chart: httpbin-0.1.0
|
||||
+ heritage: Helm
|
||||
+ release: installed
|
||||
+ name: installed-httpbin
|
||||
+ namespace: helmfile-tests
|
||||
+ spec:
|
||||
+ replicas: 1
|
||||
+ selector:
|
||||
+ matchLabels:
|
||||
+ app: httpbin
|
||||
+ strategy: {}
|
||||
+ template:
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ release: installed
|
||||
+ spec:
|
||||
+ containers:
|
||||
+ - image: docker.io/citizenstig/httpbin:latest
|
||||
+ imagePullPolicy: IfNotPresent
|
||||
+ livenessProbe:
|
||||
+ httpGet:
|
||||
+ path: /
|
||||
+ port: 8000
|
||||
+ name: httpbin
|
||||
+ ports:
|
||||
+ - containerPort: 8000
|
||||
+ readinessProbe:
|
||||
+ httpGet:
|
||||
+ path: /
|
||||
+ port: 8000
|
||||
+ resources: {}
|
||||
+ status: {}
|
||||
helmfile-tests, installed-httpbin, Service (v1) has been added:
|
||||
-
|
||||
+ apiVersion: v1
|
||||
+ kind: Service
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ chart: httpbin-0.1.0
|
||||
+ heritage: Helm
|
||||
+ release: installed
|
||||
+ name: installed-httpbin
|
||||
+ namespace: helmfile-tests
|
||||
+ spec:
|
||||
+ ports:
|
||||
+ - name: httpbin
|
||||
+ port: 8000
|
||||
+ protocol: TCP
|
||||
+ targetPort: 8000
|
||||
+ selector:
|
||||
+ app: httpbin
|
||||
+ release: installed
|
||||
+ type: LoadBalancer
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
********************
|
||||
|
||||
Release was not present in Helm. Diff will show entire contents as new.
|
||||
|
||||
********************
|
||||
helmfile-tests, installed-httpbin, Deployment (apps) has been added:
|
||||
-
|
||||
+ apiVersion: apps/v1
|
||||
+ kind: Deployment
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ chart: httpbin-0.1.0
|
||||
+ heritage: Helm
|
||||
+ release: installed
|
||||
+ name: installed-httpbin
|
||||
+ namespace: helmfile-tests
|
||||
+ spec:
|
||||
+ replicas: 1
|
||||
+ selector:
|
||||
+ matchLabels:
|
||||
+ app: httpbin
|
||||
+ strategy: {}
|
||||
+ template:
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ release: installed
|
||||
+ spec:
|
||||
+ containers:
|
||||
+ - image: docker.io/citizenstig/httpbin:latest
|
||||
+ imagePullPolicy: IfNotPresent
|
||||
+ livenessProbe:
|
||||
+ httpGet:
|
||||
+ path: /
|
||||
+ port: 8000
|
||||
+ name: httpbin
|
||||
+ ports:
|
||||
+ - containerPort: 8000
|
||||
+ readinessProbe:
|
||||
+ httpGet:
|
||||
+ path: /
|
||||
+ port: 8000
|
||||
+ resources: {}
|
||||
+ status: {}
|
||||
helmfile-tests, installed-httpbin, Service (v1) has been added:
|
||||
-
|
||||
+ apiVersion: v1
|
||||
+ kind: Service
|
||||
+ metadata:
|
||||
+ labels:
|
||||
+ app: httpbin
|
||||
+ chart: httpbin-0.1.0
|
||||
+ heritage: Helm
|
||||
+ release: installed
|
||||
+ name: installed-httpbin
|
||||
+ namespace: helmfile-tests
|
||||
+ spec:
|
||||
+ ports:
|
||||
+ - name: httpbin
|
||||
+ port: 8000
|
||||
+ protocol: TCP
|
||||
+ targetPort: 8000
|
||||
+ selector:
|
||||
+ app: httpbin
|
||||
+ release: installed
|
||||
+ type: LoadBalancer
|
||||
Comparing release=installed, chart=../../../charts/httpbin
|
||||
@@ -0,0 +1 @@
|
||||
https://github.com/helmfile/helmfile/issues/1095
|
||||
Reference in New Issue
Block a user