@@ -24,21 +24,13 @@ func GetTillerHosts(clientset *kubernetes.Clientset, namespace string) ([]string
2424 tillers = append (tillers , fmt .Sprintf ("%s:%d" , addr .IP , port .Port ))
2525 }
2626 }
27- //for a := range sub.Addresses {
28- // epAddrs = append(epAddrs, a)
29- //}
27+ }
28+ if len ( tillers ) == 0 {
29+ return nil , fmt . Errorf ( "Endpoint 'tiller' has no ready pods" )
3030 }
3131 return tillers , nil
3232}
3333
34- //func RunTiller(env []string, arg ...string) {
35- // cmd := exec.Command("helm", arg...)
36- // cmd.Env = env
37- // cmd.Stdout = os.Stdout
38- // cmd.Stderr = os.Stderr
39- // cmd.Run()
40- //}
41-
4234func NewKubeClient (configPath string , cluster string ) (* kubernetes.Clientset , error ) {
4335 if configPath == "" {
4436 configPath = path .Join (os .Getenv ("HOME" ), ".kube" , "config" )
@@ -60,26 +52,3 @@ func NewKubeClient(configPath string, cluster string) (*kubernetes.Clientset, er
6052
6153 return kubernetes .NewForConfig (config )
6254}
63-
64- //func main() {
65- // var clusterName string
66- //
67- // flag.StringVar(&clusterName, "cluster", "", "The name of the kubeconfig cluster to use")
68- // flag.Parse()
69- //
70- // spew.Dump(flag.Args())
71- //
72- // cl, err := NewKubeClient("/Users/olivierb/.kube/config", clusterName)
73- // if err != nil {
74- // panic(err.Error())
75- // }
76- //
77- // tillers, err := GetTillerHosts(cl, "kube-system")
78- // if err != nil {
79- // panic(err.Error())
80- // }
81- //
82- // env := os.Environ()
83- // env = append(env, fmt.Sprintf("HELM_HOST=%s", tillers[0]))
84- // RunTiller(env, flag.Args()...)
85- //}
0 commit comments