diff --git a/pkg/chartutil/requirements.go b/pkg/chartutil/requirements.go index 53e28e788..c421b3dd6 100644 --- a/pkg/chartutil/requirements.go +++ b/pkg/chartutil/requirements.go @@ -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 diff --git a/pkg/chartutil/requirements_test.go b/pkg/chartutil/requirements_test.go index c92c9f052..b5dbe35dc 100644 --- a/pkg/chartutil/requirements_test.go +++ b/pkg/chartutil/requirements_test.go @@ -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) }