|
|
@ -123,11 +123,13 @@ func dmCmd() cli.Command {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func installServer(c *cli.Context) error {
|
|
|
|
func installServer(c *cli.Context) error {
|
|
|
|
dryRun := c.Bool("dry-run")
|
|
|
|
|
|
|
|
resImg := c.String("resourcifier-image")
|
|
|
|
resImg := c.String("resourcifier-image")
|
|
|
|
ebImg := c.String("expandybird-image")
|
|
|
|
ebImg := c.String("expandybird-image")
|
|
|
|
manImg := c.String("manager-image")
|
|
|
|
manImg := c.String("manager-image")
|
|
|
|
runner := getKubectlRunner(dryRun)
|
|
|
|
|
|
|
|
|
|
|
|
dryRun := c.Bool("dry-run")
|
|
|
|
|
|
|
|
kubectlPath := c.GlobalString("kubectl")
|
|
|
|
|
|
|
|
runner := buildKubectlRunner(kubectlPath, dryRun)
|
|
|
|
|
|
|
|
|
|
|
|
i := client.NewInstaller()
|
|
|
|
i := client.NewInstaller()
|
|
|
|
i.Manager["Image"] = manImg
|
|
|
|
i.Manager["Image"] = manImg
|
|
|
@ -144,7 +146,8 @@ func installServer(c *cli.Context) error {
|
|
|
|
|
|
|
|
|
|
|
|
func uninstallServer(c *cli.Context) error {
|
|
|
|
func uninstallServer(c *cli.Context) error {
|
|
|
|
dryRun := c.Bool("dry-run")
|
|
|
|
dryRun := c.Bool("dry-run")
|
|
|
|
runner := getKubectlRunner(dryRun)
|
|
|
|
kubectlPath := c.GlobalString("kubectl")
|
|
|
|
|
|
|
|
runner := buildKubectlRunner(kubectlPath, dryRun)
|
|
|
|
|
|
|
|
|
|
|
|
out, err := client.Uninstall(runner)
|
|
|
|
out, err := client.Uninstall(runner)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -156,12 +159,10 @@ func uninstallServer(c *cli.Context) error {
|
|
|
|
|
|
|
|
|
|
|
|
func statusServer(c *cli.Context) error {
|
|
|
|
func statusServer(c *cli.Context) error {
|
|
|
|
dryRun := c.Bool("dry-run")
|
|
|
|
dryRun := c.Bool("dry-run")
|
|
|
|
client := kubectl.Client
|
|
|
|
kubectlPath := c.GlobalString("kubectl")
|
|
|
|
if dryRun {
|
|
|
|
runner := buildKubectlRunner(kubectlPath, dryRun)
|
|
|
|
client = kubectl.PrintRunner{}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
out, err := client.GetByKind("pods", "", "dm")
|
|
|
|
out, err := runner.GetByKind("pods", "", "dm")
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -169,23 +170,26 @@ func statusServer(c *cli.Context) error {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func getKubectlRunner(dryRun bool) kubectl.Runner {
|
|
|
|
|
|
|
|
if dryRun {
|
|
|
|
|
|
|
|
return &kubectl.PrintRunner{}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return &kubectl.RealRunner{}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func targetServer(c *cli.Context) error {
|
|
|
|
func targetServer(c *cli.Context) error {
|
|
|
|
dryRun := c.Bool("dry-run")
|
|
|
|
dryRun := c.Bool("dry-run")
|
|
|
|
client := kubectl.Client
|
|
|
|
kubectlPath := c.GlobalString("kubectl")
|
|
|
|
if dryRun {
|
|
|
|
runner := buildKubectlRunner(kubectlPath, dryRun)
|
|
|
|
client = kubectl.PrintRunner{}
|
|
|
|
|
|
|
|
}
|
|
|
|
out, err := runner.ClusterInfo()
|
|
|
|
out, err := client.ClusterInfo()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("%s (%s)", out, err)
|
|
|
|
return fmt.Errorf("%s (%s)", out, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
format.Msg(string(out))
|
|
|
|
format.Msg(string(out))
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func buildKubectlRunner(kubectlPath string, dryRun bool) kubectl.Runner {
|
|
|
|
|
|
|
|
if dryRun {
|
|
|
|
|
|
|
|
return &kubectl.PrintRunner{}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Refactor out kubectl.Path global
|
|
|
|
|
|
|
|
if kubectlPath != "" {
|
|
|
|
|
|
|
|
kubectl.Path = kubectlPath
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return &kubectl.RealRunner{}
|
|
|
|
|
|
|
|
}
|
|
|
|