|
|
|
@ -31,6 +31,7 @@ import (
|
|
|
|
|
"k8s.io/apimachinery/pkg/util/yaml"
|
|
|
|
|
"k8s.io/helm/cmd/helm/installer"
|
|
|
|
|
"k8s.io/helm/pkg/getter"
|
|
|
|
|
"k8s.io/helm/pkg/helm"
|
|
|
|
|
"k8s.io/helm/pkg/helm/helmpath"
|
|
|
|
|
"k8s.io/helm/pkg/repo"
|
|
|
|
|
)
|
|
|
|
@ -79,11 +80,13 @@ type initCmd struct {
|
|
|
|
|
forceUpgrade bool
|
|
|
|
|
skipRefresh bool
|
|
|
|
|
out io.Writer
|
|
|
|
|
client helm.Interface
|
|
|
|
|
home helmpath.Home
|
|
|
|
|
opts installer.Options
|
|
|
|
|
kubeClient kubernetes.Interface
|
|
|
|
|
serviceAccount string
|
|
|
|
|
maxHistory int
|
|
|
|
|
wait bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newInitCmd(out io.Writer) *cobra.Command {
|
|
|
|
@ -99,6 +102,8 @@ func newInitCmd(out io.Writer) *cobra.Command {
|
|
|
|
|
}
|
|
|
|
|
i.namespace = settings.TillerNamespace
|
|
|
|
|
i.home = settings.Home
|
|
|
|
|
i.client = ensureHelmClient(i.client)
|
|
|
|
|
|
|
|
|
|
return i.run()
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
@ -111,6 +116,7 @@ func newInitCmd(out io.Writer) *cobra.Command {
|
|
|
|
|
f.BoolVarP(&i.clientOnly, "client-only", "c", false, "if set does not install Tiller")
|
|
|
|
|
f.BoolVar(&i.dryRun, "dry-run", false, "do not install local or remote")
|
|
|
|
|
f.BoolVar(&i.skipRefresh, "skip-refresh", false, "do not refresh (download) the local repository cache")
|
|
|
|
|
f.BoolVar(&i.wait, "wait", false, "block until Tiller is running and ready to receive requests")
|
|
|
|
|
|
|
|
|
|
f.BoolVar(&tlsEnable, "tiller-tls", false, "install Tiller with TLS enabled")
|
|
|
|
|
f.BoolVar(&tlsVerify, "tiller-tls-verify", false, "install Tiller with TLS enabled and to verify remote certificates")
|
|
|
|
@ -292,12 +298,18 @@ func (i *initCmd) run() error {
|
|
|
|
|
if err := installer.Upgrade(i.kubeClient, &i.opts); err != nil {
|
|
|
|
|
return fmt.Errorf("error when upgrading: %s", err)
|
|
|
|
|
}
|
|
|
|
|
if err := i.ping(); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been upgraded to the current version.")
|
|
|
|
|
} else {
|
|
|
|
|
fmt.Fprintln(i.out, "Warning: Tiller is already installed in the cluster.\n"+
|
|
|
|
|
"(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)")
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if err := i.ping(); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been installed into your Kubernetes Cluster.")
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -308,6 +320,16 @@ func (i *initCmd) run() error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (i *initCmd) ping() error {
|
|
|
|
|
if i.wait {
|
|
|
|
|
if err := i.client.PingTiller(); err != nil {
|
|
|
|
|
return fmt.Errorf("could not ping Tiller: %s", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ensureDirectories checks to see if $HELM_HOME exists.
|
|
|
|
|
//
|
|
|
|
|
// If $HELM_HOME does not exist, this function will create it.
|
|
|
|
|