|
|
@ -4,10 +4,15 @@ import (
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/deis/tiller/pkg/client"
|
|
|
|
|
|
|
|
"github.com/deis/tiller/pkg/kubectl"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tillerImg string
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
|
|
|
|
|
initCmd.Flags().StringVarP(&tillerImg, "tiller-image", "i", "", "override tiller image")
|
|
|
|
RootCommand.AddCommand(initCmd)
|
|
|
|
RootCommand.AddCommand(initCmd)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -20,6 +25,28 @@ var initCmd = &cobra.Command{
|
|
|
|
|
|
|
|
|
|
|
|
// RunInit initializes local config and installs tiller to Kubernetes Cluster
|
|
|
|
// RunInit initializes local config and installs tiller to Kubernetes Cluster
|
|
|
|
func RunInit(cmd *cobra.Command, args []string) error {
|
|
|
|
func RunInit(cmd *cobra.Command, args []string) error {
|
|
|
|
fmt.Fprintln(stdout, "Init was called.")
|
|
|
|
if len(args) != 0 {
|
|
|
|
return errors.New("NotImplemented")
|
|
|
|
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{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|