From 3128562149d5f34b8472a25c0744eb40e3c29646 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Wed, 10 Aug 2016 14:32:47 -0600 Subject: [PATCH] fix(helm): warn on init when Tiller already exists Previously, if 'helm init' was run on a cluster that had Tiller installed, the init would fail. However, this condition indicates that both the client and the server are in a condition to work, so this should not be an error. This PR downgrades that error to a warning. Closes #1041 --- cmd/helm/init.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index 218527295..81c7388c9 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -21,6 +21,7 @@ import ( "fmt" "io" "os" + "strings" "github.com/spf13/cobra" @@ -71,9 +72,13 @@ func (i *initCmd) run() error { if !i.clientOnly { if err := client.Install(tillerNamespace, i.image, flagDebug); err != nil { - return fmt.Errorf("error installing: %s", err) + if !strings.Contains(err.Error(), `"tiller-deploy" already exists`) { + return fmt.Errorf("error installing: %s", err) + } + fmt.Fprintln(i.out, "Warning: Tiller is already installed in the cluster. (Use --client-only to supress this message.)") + } else { + fmt.Fprintln(i.out, "\nTiller (the helm server side component) has been installed into your Kubernetes Cluster.") } - fmt.Fprintln(i.out, "\nTiller (the helm server side component) has been installed into your Kubernetes Cluster.") } else { fmt.Fprintln(i.out, "Not installing tiller due to 'client-only' flag having been set") }