Make get-kubeconfig scriptable and add more info at cluster create

After cluster create just print a simple command line to the screen to
help the user along.
pull/1/head
Darren Shepherd 6 years ago
parent ecc6a375e2
commit 9bb89374ce
  1. 8
      main.go

@ -44,6 +44,10 @@ func createCluster(c *cli.Context) error {
return err
}
log.Printf("SUCCESS: created cluster [%s]", c.String("name"))
log.Printf(`You can now use the cluster with:
export KUBECONFIG="$(%s get-kubeconfig --name='%s')"
kubectl cluster-info`, os.Args[0], c.String("name"))
return nil
}
@ -103,13 +107,11 @@ func getKubeConfig(c *cli.Context) error {
destPath, _ := getClusterDir(c.String("name"))
cmd := "docker"
args := []string{"cp", sourcePath, destPath}
log.Printf("Grabbing kubeconfig for cluster [%s]", c.String("name"))
if err := run(false, cmd, args...); err != nil {
log.Fatalf("FAILURE: couldn't get kubeconfig for cluster [%s] -> %+v", c.String("name"), err)
return err
}
log.Printf("SUCCESS: retrieved kubeconfig for cluster [%s]", c.String("name"))
fmt.Printf("%s", path.Join(destPath, "kubeconfig.yaml"))
fmt.Printf("%s\n", path.Join(destPath, "kubeconfig.yaml"))
return nil
}

Loading…
Cancel
Save