mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
fix(helm): process dependencies import-values
When running helm lint, import-values for dependencies are ignored, also added test for linting chart with import-values Closes #9658 Signed-off-by: Stuart Drennan <stuart.drennan@gmail.com>
This commit is contained in:
parent
83791fe7c2
commit
1931b0702d
8 changed files with 47 additions and 0 deletions
|
|
@ -35,6 +35,7 @@ const badChartDir = "rules/testdata/badchartfile"
|
|||
const badValuesFileDir = "rules/testdata/badvaluesfile"
|
||||
const badYamlFileDir = "rules/testdata/albatross"
|
||||
const goodChartDir = "rules/testdata/goodone"
|
||||
const subChartValuesDir = "rules/testdata/withsubchart"
|
||||
|
||||
func TestBadChart(t *testing.T) {
|
||||
m := All(badChartDir, values, namespace, strict).Messages
|
||||
|
|
@ -144,3 +145,15 @@ func TestHelmCreateChart(t *testing.T) {
|
|||
t.Errorf("Unexpected lint error: %s", msg)
|
||||
}
|
||||
}
|
||||
|
||||
// lint ignores import-values
|
||||
// See https://github.com/helm/helm/issues/9658
|
||||
func TestSubChartValuesChart(t *testing.T) {
|
||||
m := All(subChartValuesDir, values, namespace, strict).Messages
|
||||
if len(m) != 0 {
|
||||
t.Error("All returned linter messages when it shouldn't have")
|
||||
for i, msg := range m {
|
||||
t.Logf("Message %d: %s", i, msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,12 @@ func Templates(linter *support.Linter, values map[string]interface{}, namespace
|
|||
Namespace: namespace,
|
||||
}
|
||||
|
||||
// lint ignores import-values
|
||||
// See https://github.com/helm/helm/issues/9658
|
||||
if err := chartutil.ProcessDependencies(chart, values); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
cvals, err := chartutil.CoalesceValues(chart, values)
|
||||
if err != nil {
|
||||
return
|
||||
|
|
|
|||
16
pkg/lint/rules/testdata/withsubchart/Chart.yaml
vendored
Normal file
16
pkg/lint/rules/testdata/withsubchart/Chart.yaml
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
apiVersion: v2
|
||||
name: withsubchart
|
||||
description: A Helm chart for Kubernetes
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.16.0"
|
||||
icon: http://riverrun.io
|
||||
|
||||
dependencies:
|
||||
- name: subchart
|
||||
version: 0.1.16
|
||||
repository: "file://../subchart"
|
||||
import-values:
|
||||
- child: subchart
|
||||
parent: subchart
|
||||
|
||||
6
pkg/lint/rules/testdata/withsubchart/charts/subchart/Chart.yaml
vendored
Normal file
6
pkg/lint/rules/testdata/withsubchart/charts/subchart/Chart.yaml
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
apiVersion: v2
|
||||
name: subchart
|
||||
description: A Helm chart for Kubernetes
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.16.0"
|
||||
2
pkg/lint/rules/testdata/withsubchart/charts/subchart/templates/subchart.yaml
vendored
Normal file
2
pkg/lint/rules/testdata/withsubchart/charts/subchart/templates/subchart.yaml
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
metadata:
|
||||
name: {{ .Values.subchart.name | lower }}
|
||||
2
pkg/lint/rules/testdata/withsubchart/charts/subchart/values.yaml
vendored
Normal file
2
pkg/lint/rules/testdata/withsubchart/charts/subchart/values.yaml
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
subchart:
|
||||
name: subchart
|
||||
2
pkg/lint/rules/testdata/withsubchart/templates/mainchart.yaml
vendored
Normal file
2
pkg/lint/rules/testdata/withsubchart/templates/mainchart.yaml
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
metadata:
|
||||
name: {{ .Values.subchart.name | lower }}
|
||||
0
pkg/lint/rules/testdata/withsubchart/values.yaml
vendored
Normal file
0
pkg/lint/rules/testdata/withsubchart/values.yaml
vendored
Normal file
Loading…
Reference in a new issue