|
|
|
@ -4,10 +4,15 @@ import (
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
"github.com/deis/tiller/pkg/client"
|
|
|
|
|
"github.com/deis/tiller/pkg/kubectl"
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var tillerImg string
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
initCmd.Flags().StringVarP(&tillerImg, "tiller-image", "i", "", "override tiller image")
|
|
|
|
|
RootCommand.AddCommand(initCmd)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -20,6 +25,28 @@ var initCmd = &cobra.Command{
|
|
|
|
|
|
|
|
|
|
// RunInit initializes local config and installs tiller to Kubernetes Cluster
|
|
|
|
|
func RunInit(cmd *cobra.Command, args []string) error {
|
|
|
|
|
fmt.Fprintln(stdout, "Init was called.")
|
|
|
|
|
return errors.New("NotImplemented")
|
|
|
|
|
if len(args) != 0 {
|
|
|
|
|
return errors.New("This command does not accept arguments. \n")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: take value of global flag kubectl and pass that in
|
|
|
|
|
runner := buildKubectlRunner("")
|
|
|
|
|
|
|
|
|
|
i := client.NewInstaller()
|
|
|
|
|
i.Tiller["Image"] = tillerImg
|
|
|
|
|
|
|
|
|
|
out, err := i.Install(runner)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("error installing %s %s", string(out), err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt.Printf("Tiller (the helm server side component) has been installed into your Kubernetes Cluster.\n")
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func buildKubectlRunner(kubectlPath string) kubectl.Runner {
|
|
|
|
|
if kubectlPath != "" {
|
|
|
|
|
kubectl.Path = kubectlPath
|
|
|
|
|
}
|
|
|
|
|
return &kubectl.RealRunner{}
|
|
|
|
|
}
|
|
|
|
|