Merge pull request #10271 from stuartdrennan/lint-values-dependencies

fix(helm): process  dependencies import-values
pull/10325/head
Martin Hickey 3 years ago committed by GitHub
commit 1278306509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

@ -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

@ -0,0 +1,6 @@
apiVersion: v2
name: subchart
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"

@ -0,0 +1,2 @@
metadata:
name: {{ .Values.subchart.name | lower }}

@ -0,0 +1,2 @@
metadata:
name: {{ .Values.subchart.name | lower }}
Loading…
Cancel
Save