Commit 40052d3e authored by Justin Scott's avatar Justin Scott

fix(helm): remove unnecessary values merge in processImportValues

The function chartutil.processImportValues was merging values unnecessarily and incorrectly merging --set values.

Closes #2331
parent 09d4555f
...@@ -361,22 +361,17 @@ func getParents(c *chart.Chart, out []*chart.Chart) []*chart.Chart { ...@@ -361,22 +361,17 @@ func getParents(c *chart.Chart, out []*chart.Chart) []*chart.Chart {
} }
// processImportValues merges values from child to parent based on the chart's dependencies' ImportValues field. // processImportValues merges values from child to parent based on the chart's dependencies' ImportValues field.
func processImportValues(c *chart.Chart, v *chart.Config) error { func processImportValues(c *chart.Chart) error {
reqs, err := LoadRequirements(c) reqs, err := LoadRequirements(c)
if err != nil { if err != nil {
return err return err
} }
// combine chart values and its dependencies' values // combine chart values and empty config to get Values
cvals, err := CoalesceValues(c, v) cvals, err := CoalesceValues(c, &chart.Config{})
if err != nil { if err != nil {
return err return err
} }
nv := v.GetValues() b := make(map[string]interface{}, 0)
b := make(map[string]interface{}, len(nv))
// convert values to map
for kk, vvv := range nv {
b[kk] = vvv
}
// import values from each dependency if specified in import-values // import values from each dependency if specified in import-values
for _, r := range reqs.Dependencies { for _, r := range reqs.Dependencies {
if len(r.ImportValues) > 0 { if len(r.ImportValues) > 0 {
...@@ -431,10 +426,10 @@ func processImportValues(c *chart.Chart, v *chart.Config) error { ...@@ -431,10 +426,10 @@ func processImportValues(c *chart.Chart, v *chart.Config) error {
} }
// ProcessRequirementsImportValues imports specified chart values from child to parent. // ProcessRequirementsImportValues imports specified chart values from child to parent.
func ProcessRequirementsImportValues(c *chart.Chart, v *chart.Config) error { func ProcessRequirementsImportValues(c *chart.Chart) error {
pc := getParents(c, nil) pc := getParents(c, nil)
for i := len(pc) - 1; i >= 0; i-- { for i := len(pc) - 1; i >= 0; i-- {
processImportValues(pc[i], v) processImportValues(pc[i])
} }
return nil return nil
......
...@@ -282,7 +282,7 @@ func TestProcessRequirementsImportValues(t *testing.T) { ...@@ -282,7 +282,7 @@ func TestProcessRequirementsImportValues(t *testing.T) {
} }
func verifyRequirementsImportValues(t *testing.T, c *chart.Chart, v *chart.Config, e map[string]string) { func verifyRequirementsImportValues(t *testing.T, c *chart.Chart, v *chart.Config, e map[string]string) {
err := ProcessRequirementsImportValues(c, v) err := ProcessRequirementsImportValues(c)
if err != nil { if err != nil {
t.Errorf("Error processing import values requirements %v", err) t.Errorf("Error processing import values requirements %v", err)
} }
......
...@@ -98,7 +98,7 @@ func (h *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ... ...@@ -98,7 +98,7 @@ func (h *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ...
if err != nil { if err != nil {
return nil, err return nil, err
} }
err = chartutil.ProcessRequirementsImportValues(req.Chart, req.Values) err = chartutil.ProcessRequirementsImportValues(req.Chart)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -173,7 +173,7 @@ func (h *Client) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...@@ -173,7 +173,7 @@ func (h *Client) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts
if err != nil { if err != nil {
return nil, err return nil, err
} }
err = chartutil.ProcessRequirementsImportValues(req.Chart, req.Values) err = chartutil.ProcessRequirementsImportValues(req.Chart)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment