From 84d69953497779ddfd64d0308e7f4334684fa5a9 Mon Sep 17 00:00:00 2001 From: Bobby DeSimone Date: Fri, 10 Jan 2020 19:53:25 -0800 Subject: [PATCH] install: reintroduce name flag Signed-off-by: Bobby DeSimone --- cmd/helm/install.go | 1 + cmd/helm/install_test.go | 12 +++++++++++- pkg/action/install.go | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index b75dfce74..e9c73190c 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -142,6 +142,7 @@ func addInstallFlags(f *pflag.FlagSet, client *action.Install, valueOpts *values f.BoolVar(&client.Atomic, "atomic", false, "if set, installation process purges chart on fail. The --wait flag will be set automatically if --atomic is used") f.BoolVar(&client.SkipCRDs, "skip-crds", false, "if set, no CRDs will be installed. By default, CRDs are installed if not already present") f.BoolVar(&client.SubNotes, "render-subchart-notes", false, "if set, render subchart notes along with the parent") + f.StringVarP(&client.ReleaseName, "name", "", "", "The release name (and omit NAME parameter)") addValueOptionsFlags(f, valueOpts) addChartPathOptionsFlags(f, &client.ChartPathOptions) } diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index e8b573dfc..6d5d9a019 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -189,7 +189,17 @@ func TestInstall(t *testing.T) { cmd: "install aeneas testdata/testcharts/deprecated --namespace default", golden: "output/deprecated-chart.txt", }, + // Install using v2 name flags (--name) + { + name: "basic install using name flag no arguments", + cmd: "install --name aeneas --namespace default testdata/testcharts/empty", + golden: "output/install.txt", + }, + { + name: "basic install using name flag and name argument no arguments", + cmd: "install --name aeneas --namespace default aeneas testdata/testcharts/empty", + wantError: true, + }, } - runTestActionCmd(t, tests) } diff --git a/pkg/action/install.go b/pkg/action/install.go index e368bcb28..af36f0f80 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -552,6 +552,9 @@ func (i *Install) NameAndChart(args []string) (string, string, error) { if i.NameTemplate != "" { return errors.New("cannot set --name-template and also specify a name") } + if i.ReleaseName != "" { + return errors.New("cannot set --name and also specify specify a name argument") + } return nil }