From a1f9de94003b6f9dd3a4cdc325cd1db12856b951 Mon Sep 17 00:00:00 2001 From: Elliot Kennedy Date: Fri, 26 Feb 2021 17:16:33 +0000 Subject: [PATCH] [#9136] - Deprecate ProcessDependencies for ProcessDependenciesWithValues, which copies the dependencies rather than mutating them. Signed-off-by: Elliot Kennedy --- pkg/action/install.go | 2 +- pkg/action/upgrade.go | 2 +- pkg/chartutil/dependencies.go | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index 4de0b64e6..70cc7d05e 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -207,7 +207,7 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release. i.cfg.Log("API Version list given outside of client only mode, this list will be ignored") } - if err := chartutil.ProcessDependencies(chrt, vals); err != nil { + if err := chartutil.ProcessDependenciesWithValues(chrt, vals); err != nil { return nil, err } diff --git a/pkg/action/upgrade.go b/pkg/action/upgrade.go index 3b3dd3f1c..9eb74e985 100644 --- a/pkg/action/upgrade.go +++ b/pkg/action/upgrade.go @@ -188,7 +188,7 @@ func (u *Upgrade) prepareUpgrade(name string, chart *chart.Chart, vals map[strin return nil, nil, err } - if err := chartutil.ProcessDependencies(chart, vals); err != nil { + if err := chartutil.ProcessDependenciesWithValues(chart, vals); err != nil { return nil, nil, err } diff --git a/pkg/chartutil/dependencies.go b/pkg/chartutil/dependencies.go index 2c26a37f9..e31b676e3 100644 --- a/pkg/chartutil/dependencies.go +++ b/pkg/chartutil/dependencies.go @@ -25,7 +25,7 @@ import ( ) // ProcessDependencies checks through this chart's dependencies, processing accordingly. -func ProcessDependencies(c *chart.Chart, vals map[string]interface{}) error { +func ProcessDependenciesWithValues(c *chart.Chart, vals map[string]interface{}) error { v, err := copystructure.Copy(vals) if err != nil { return err @@ -39,6 +39,16 @@ func ProcessDependencies(c *chart.Chart, vals map[string]interface{}) error { return process(c, valsCopy) } +// ProcessDependencies checks through this chart's dependencies, processing accordingly. +// +// Deprecated: ProcessDependencies. Use ProcessDependenciesWithValues +func ProcessDependencies(c *chart.Chart, v Values) error { + if err := processDependencyEnabled(c, v, ""); err != nil { + return err + } + return processDependencyImportValues(c, v) +} + // process processes the dependencies // // This is a helper function for ProcessDependencies.