Exemple #1
0
func listRepos(c *cli.Context) error {
	dest := map[string]string{}
	if _, err := NewClient(c).Get(chartRepoPath, &dest); err != nil {
		return err
	}
	if len(dest) < 1 {
		format.Info("Looks like you don't have any chart repositories.")
		format.Info("Add a chart repository using the `helm repo add [REPOSITORY_URL]` command.")
	} else {
		format.Msg("Chart Repositories:\n")
		for k, v := range dest {
			//TODO: make formatting pretty
			format.Msg(k + "\t" + v + "\n")
		}
	}
	return nil
}
Exemple #2
0
func removeRepo(c *cli.Context) error {
	args := c.Args()
	if len(args) < 1 {
		return errors.New("'helm repo remove' requires a repository name as an argument")
	}
	name := args[0]
	if _, err := NewClient(c).Delete(filepath.Join(chartRepoPath, name), nil); err != nil {
		return err
	}
	format.Msg(name + " has been removed.\n")
	return nil
}
Exemple #3
0
func targetServer(c *cli.Context) error {
	dryRun := c.Bool("dry-run")
	kubectlPath := c.GlobalString("kubectl")
	runner := buildKubectlRunner(kubectlPath, dryRun)

	out, err := runner.ClusterInfo()
	if err != nil {
		return fmt.Errorf("%s (%s)", out, err)
	}
	format.Msg(string(out))
	return nil
}
Exemple #4
0
func statusServer(c *cli.Context) error {
	dryRun := c.Bool("dry-run")
	kubectlPath := c.GlobalString("kubectl")
	runner := buildKubectlRunner(kubectlPath, dryRun)

	out, err := runner.GetByKind("pods", "", "helm")
	if err != nil {
		return err
	}
	format.Msg(string(out))
	return nil
}
Exemple #5
0
func uninstallServer(c *cli.Context) error {
	dryRun := c.Bool("dry-run")
	kubectlPath := c.GlobalString("kubectl")
	runner := buildKubectlRunner(kubectlPath, dryRun)

	out, err := client.Uninstall(runner)
	if err != nil {
		return fmt.Errorf("error uninstalling: %s %s", out, err)
	}
	format.Msg(out)
	return nil
}
Exemple #6
0
func pack(cxt *cli.Context) error {
	args := cxt.Args()
	if len(args) < 1 {
		return errors.New("'helm package' requires a path to a chart directory as an argument")
	}

	dir := args[0]
	if fi, err := os.Stat(dir); err != nil {
		return fmt.Errorf("Could not find directory %s: %s", dir, err)
	} else if !fi.IsDir() {
		return fmt.Errorf("Not a directory: %s", dir)
	}

	fname, err := packDir(dir)
	if err != nil {
		return err
	}
	format.Msg(fname)
	return nil
}
Exemple #7
0
func installServer(c *cli.Context) error {
	resImg := c.String("resourcifier-image")
	ebImg := c.String("expandybird-image")
	manImg := c.String("manager-image")

	dryRun := c.Bool("dry-run")
	kubectlPath := c.GlobalString("kubectl")
	runner := buildKubectlRunner(kubectlPath, dryRun)

	i := client.NewInstaller()
	i.Manager["Image"] = manImg
	i.Resourcifier["Image"] = resImg
	i.Expandybird["Image"] = ebImg

	out, err := i.Install(runner)
	if err != nil {
		return fmt.Errorf("error installing %s %s", string(out), err)
	}
	format.Msg(out)
	return nil
}