|
|
@ -31,6 +31,7 @@ import (
|
|
|
|
"k8s.io/apimachinery/pkg/util/yaml"
|
|
|
|
"k8s.io/apimachinery/pkg/util/yaml"
|
|
|
|
"k8s.io/helm/cmd/helm/installer"
|
|
|
|
"k8s.io/helm/cmd/helm/installer"
|
|
|
|
"k8s.io/helm/pkg/getter"
|
|
|
|
"k8s.io/helm/pkg/getter"
|
|
|
|
|
|
|
|
"k8s.io/helm/pkg/helm"
|
|
|
|
"k8s.io/helm/pkg/helm/helmpath"
|
|
|
|
"k8s.io/helm/pkg/helm/helmpath"
|
|
|
|
"k8s.io/helm/pkg/repo"
|
|
|
|
"k8s.io/helm/pkg/repo"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -79,11 +80,13 @@ type initCmd struct {
|
|
|
|
forceUpgrade bool
|
|
|
|
forceUpgrade bool
|
|
|
|
skipRefresh bool
|
|
|
|
skipRefresh bool
|
|
|
|
out io.Writer
|
|
|
|
out io.Writer
|
|
|
|
|
|
|
|
client helm.Interface
|
|
|
|
home helmpath.Home
|
|
|
|
home helmpath.Home
|
|
|
|
opts installer.Options
|
|
|
|
opts installer.Options
|
|
|
|
kubeClient kubernetes.Interface
|
|
|
|
kubeClient kubernetes.Interface
|
|
|
|
serviceAccount string
|
|
|
|
serviceAccount string
|
|
|
|
maxHistory int
|
|
|
|
maxHistory int
|
|
|
|
|
|
|
|
wait bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func newInitCmd(out io.Writer) *cobra.Command {
|
|
|
|
func newInitCmd(out io.Writer) *cobra.Command {
|
|
|
@ -99,6 +102,8 @@ func newInitCmd(out io.Writer) *cobra.Command {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i.namespace = settings.TillerNamespace
|
|
|
|
i.namespace = settings.TillerNamespace
|
|
|
|
i.home = settings.Home
|
|
|
|
i.home = settings.Home
|
|
|
|
|
|
|
|
i.client = ensureHelmClient(i.client)
|
|
|
|
|
|
|
|
|
|
|
|
return i.run()
|
|
|
|
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.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.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.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(&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")
|
|
|
|
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 {
|
|
|
|
if err := installer.Upgrade(i.kubeClient, &i.opts); err != nil {
|
|
|
|
return fmt.Errorf("error when upgrading: %s", err)
|
|
|
|
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.")
|
|
|
|
fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been upgraded to the current version.")
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
fmt.Fprintln(i.out, "Warning: Tiller is already installed in the cluster.\n"+
|
|
|
|
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.)")
|
|
|
|
"(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} 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.")
|
|
|
|
fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been installed into your Kubernetes Cluster.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -308,6 +320,16 @@ func (i *initCmd) run() error {
|
|
|
|
return nil
|
|
|
|
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.
|
|
|
|
// ensureDirectories checks to see if $HELM_HOME exists.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// If $HELM_HOME does not exist, this function will create it.
|
|
|
|
// If $HELM_HOME does not exist, this function will create it.
|
|
|
|