// Upgrade upgrades a release. Code ported from:
// https://github.com/helm/helm/blob/v3.4.2/cmd/helm/upgrade.go
Upgrade upgrades a release.
// Upgrade upgrades a release . Code ported from : // https : // github . com / helm / helm / blob / v3 . 4 . 2 / cmd / helm / upgrade . go
func Upgrade(params UpgradeParameters) (storage.Release, error) {
	settings := cli.New()
	actionConfig, err := helmInit(settings, params.Namespace)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	client := action.NewUpgrade(actionConfig)
	client.Timeout = helmTimeout
	client.Namespace = params.Namespace
	chartPath, err := client.ChartPathOptions.LocateChart(params.Path, settings)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	valueOpts := &values.Options{
		ValueFiles: params.Values,
		Values:     params.Set,
	}
	vals, err := valueOpts.MergeValues(getter.All(settings))
	if err != nil {
		return nil, trace.Wrap(err)
	}
	chartRequested, err := loader.Load(chartPath)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	if req := chartRequested.Metadata.Dependencies; req != nil {
		if err := action.CheckDependencies(chartRequested, req); err != nil {
			return nil, trace.Wrap(err)
		}
	}
	if chartRequested.Metadata.Deprecated {
		logrus.WithField("chart", chartRequested.Metadata.Name).
			Warn("This chart is deprecated.")
	}
	response, err := client.Run(params.Release, chartRequested, vals)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	rel, err := storage.NewRelease(response)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	return rel, nil
}
func Upgrade ( params UpgradeParameters ) ( storage . Release , error ) { settings := cli . New ( ) actionConfig , err := helmInit ( settings , params . Namespace ) if err != nil { return nil , trace . Wrap ( err ) } client := action . NewUpgrade ( actionConfig ) client . Timeout = helmTimeout client . Namespace = params . Namespace chartPath , err := client . ChartPathOptions . LocateChart ( params . Path , settings ) if err != nil { return nil , trace . Wrap ( err ) } valueOpts := & values . Options { ValueFiles : params . Values , Values : params . Set , } vals , err := valueOpts . MergeValues ( getter . All ( settings ) ) if err != nil { return nil , trace . Wrap ( err ) } chartRequested , err := loader . Load ( chartPath ) if err != nil { return nil , trace . Wrap ( err ) } if req := chartRequested . Metadata . Dependencies ; req != nil { if err := action . CheckDependencies ( chartRequested , req ) ; err != nil { return nil , trace . Wrap ( err ) } } if chartRequested . Metadata . Deprecated { logrus . WithField ( " " , chartRequested . Metadata . Name ) . Warn ( " " ) } response , err := client . Run ( params . Release , chartRequested , vals ) if err != nil { return nil , trace . Wrap ( err ) } rel , err := storage . NewRelease ( response ) if err != nil { return nil , trace . Wrap ( err ) } return rel , nil }
Upgrade upgrades a release.
Upgrade upgrades a release .