diff --git a/cmd/helm/init.go b/cmd/helm/init.go index d368945ec..f1ff825a6 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -23,6 +23,7 @@ import ( "fmt" "io" "os" + "strings" "time" "github.com/spf13/cobra" @@ -36,6 +37,7 @@ import ( "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/portforwarder" "k8s.io/helm/pkg/repo" + "k8s.io/helm/pkg/version" ) const initDesc = ` @@ -323,6 +325,13 @@ func (i *initCmd) run() error { fmt.Fprintln(i.out, "Not installing Tiller due to 'client-only' flag having been set") } + if !(len(strings.Split(version.Version, ".")) > 2) && !i.opts.UseCanary && len(i.opts.ImageSpec) == 0 { + fmt.Fprintf(i.out, "\nWarning: You appear to be using an unreleased version of Helm. Please either use the\n"+ + "--canary-image flag, or specify your desired tiller version with --tiller-image.\n\n"+ + "Ex:\n"+ + "$ helm init --tiller-image gcr.io/kubernetes-helm/tiller:v2.8.2\n\n") + } + fmt.Fprintln(i.out, "Happy Helming!") return nil } diff --git a/cmd/helm/installer/install_test.go b/cmd/helm/installer/install_test.go index dbb7143e3..b769e736e 100644 --- a/cmd/helm/installer/install_test.go +++ b/cmd/helm/installer/install_test.go @@ -20,6 +20,7 @@ import ( "os" "path/filepath" "reflect" + "strings" "testing" "github.com/ghodss/yaml" @@ -57,6 +58,10 @@ func TestDeploymentManifest(t *testing.T) { t.Fatalf("%s: error %q", tt.name, err) } + // Unreleased versions of helm don't have a release image. See issue 3370 + if tt.name == "default" && !(len(strings.Split(version.Version, ".")) > 2) { + tt.expect = "gcr.io/kubernetes-helm/tiller:canary" + } if got := dep.Spec.Template.Spec.Containers[0].Image; got != tt.expect { t.Errorf("%s: expected image %q, got %q", tt.name, tt.expect, got) } diff --git a/cmd/helm/installer/options.go b/cmd/helm/installer/options.go index 13cf43dcc..c4e2c11b2 100644 --- a/cmd/helm/installer/options.go +++ b/cmd/helm/installer/options.go @@ -18,6 +18,7 @@ package installer // import "k8s.io/helm/cmd/helm/installer" import ( "fmt" + "strings" "k8s.io/api/core/v1" "k8s.io/helm/pkg/strvals" @@ -101,6 +102,9 @@ func (opts *Options) selectImage() string { case opts.UseCanary: return defaultImage + ":canary" case opts.ImageSpec == "": + if !(len(strings.Split(version.Version, ".")) > 2) { + return defaultImage + ":canary" + } return fmt.Sprintf("%s:%s", defaultImage, version.Version) default: return opts.ImageSpec