fix (pkg/chartutil): correctly parse input values for ProcessRequirementsEnabled

Fixes a bug where tags and conditions specified in values.yaml were not being respeceted, causing incorrect loading of subcharts.

Closes #2139
pull/2220/head
Justin Scott 8 years ago
parent 6d5b3bbb21
commit 8c720ee2c2

@ -236,10 +236,15 @@ func ProcessRequirementsEnabled(c *chart.Chart, v *chart.Config) error {
if err != nil {
return err
}
// convert our values back into config
yvals, err := cvals.YAML()
if err != nil {
return err
}
cc := chart.Config{Raw: yvals}
// flag dependencies as enabled/disabled
ProcessRequirementsTags(reqs, cvals)
ProcessRequirementsConditions(reqs, cvals)
// make a map of charts to remove
rm := map[string]bool{}
for _, r := range reqs.Dependencies {
@ -259,7 +264,7 @@ func ProcessRequirementsEnabled(c *chart.Chart, v *chart.Config) error {
}
// recursively call self to process sub dependencies
for _, t := range cd {
err := ProcessRequirementsEnabled(t, v)
err := ProcessRequirementsEnabled(t, &cc)
// if its not just missing requirements file, return error
if nerr, ok := err.(ErrNoRequirementsFile); !ok && err != nil {
return nerr

@ -74,15 +74,16 @@ func TestRequirementsTagsEnabledL1(t *testing.T) {
verifyRequirementsEnabled(t, c, v, e)
}
func TestRequirementsTagsDisabledL2(t *testing.T) {
c, err := Load("testdata/subpop")
if err != nil {
t.Fatalf("Failed to load testdata: %s", err)
}
// tags disabling only children
// tags disabling only children, children still enabled since tag front-end=true in values.yaml
v := &chart.Config{Raw: "tags:\n subcharta: false\n\n subchartb: false\n"}
// expected charts including duplicates in alphanumeric order
e := []string{"parentchart", "subchart1"}
e := []string{"parentchart", "subchart1", "subcharta", "subchartb"}
verifyRequirementsEnabled(t, c, v, e)
}
@ -115,10 +116,10 @@ func TestRequirementsConditionsEnabledL1Both(t *testing.T) {
if err != nil {
t.Fatalf("Failed to load testdata: %s", err)
}
// conditions enabling the parent charts, effectively enabling children
// conditions enabling the parent charts, but back-end (b, c) is still disabled via values.yaml
v := &chart.Config{Raw: "subchart1:\n enabled: true\nsubchart2:\n enabled: true\n"}
// expected charts including duplicates in alphanumeric order
e := []string{"parentchart", "subchart1", "subchart2", "subcharta", "subchartb", "subchartb", "subchartc"}
e := []string{"parentchart", "subchart1", "subchart2", "subcharta", "subchartb"}
verifyRequirementsEnabled(t, c, v, e)
}

Loading…
Cancel
Save