From 6afad6bb610e5717caa908abc60695033f65d6a2 Mon Sep 17 00:00:00 2001 From: Dmitry Chepurovskiy Date: Sat, 8 Jan 2022 21:41:21 +0300 Subject: [PATCH] Added upgrade --install labels argument support Signed-off-by: Dmitry Chepurovskiy Signed-off-by: Dmitry Chepurovskiy --- cmd/helm/upgrade.go | 2 ++ pkg/action/upgrade.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index b856073c1..d95bbf359 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -117,6 +117,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { instClient.SubNotes = client.SubNotes instClient.Description = client.Description instClient.DependencyUpdate = client.DependencyUpdate + instClient.Labels = client.Labels rel, err := runInstall(args, instClient, valueOpts, out) if err != nil { @@ -228,6 +229,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f.IntVar(&client.MaxHistory, "history-max", settings.MaxHistory, "limit the maximum number of revisions saved per release. Use 0 for no limit") f.BoolVar(&client.CleanupOnFail, "cleanup-on-fail", false, "allow deletion of new resources created in this upgrade when upgrade fails") f.BoolVar(&client.SubNotes, "render-subchart-notes", false, "if set, render subchart notes along with the parent") + f.StringToStringVarP(&client.Labels, "labels", "l", nil, "Labels that would be added to relese metadata. Should be divided by comma. (Currently works only with configmap and secret storage drivers)") f.StringVar(&client.Description, "description", "", "add a custom description") f.BoolVar(&client.DependencyUpdate, "dependency-update", false, "update dependencies if they are missing before installing the chart") addChartPathOptionsFlags(f, &client.ChartPathOptions) diff --git a/pkg/action/upgrade.go b/pkg/action/upgrade.go index c98b524bc..5c8899b9c 100644 --- a/pkg/action/upgrade.go +++ b/pkg/action/upgrade.go @@ -92,6 +92,7 @@ type Upgrade struct { SubNotes bool // Description is the description of this operation Description string + Labels map[string]string // PostRender is an optional post-renderer // // If this is non-nil, then after templates are rendered, they will be sent to the @@ -251,6 +252,7 @@ func (u *Upgrade) prepareUpgrade(name string, chart *chart.Chart, vals map[strin Version: revision, Manifest: manifestDoc.String(), Hooks: hooks, + Labels: u.Labels, } if len(notesTxt) > 0 {