Пример #1
0
func newStatusCmd(client helm.Interface, out io.Writer) *cobra.Command {
	status := &statusCmd{
		out:    out,
		client: client,
	}
	cmd := &cobra.Command{
		Use:               "status [flags] RELEASE_NAME",
		Short:             "displays the status of the named release",
		Long:              statusHelp,
		PersistentPreRunE: setupConnection,
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) == 0 {
				return errReleaseRequired
			}
			status.release = args[0]
			if status.client == nil {
				status.client = helm.NewClient(helm.Host(tillerHost))
			}
			return status.run()
		},
	}

	cmd.PersistentFlags().Int32Var(&status.version, "version", 0, "If set, display the status of the named release with version")

	return cmd
}
Пример #2
0
func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command {
	get := &getCmd{
		out:    out,
		client: client,
	}
	cmd := &cobra.Command{
		Use:               "get [flags] RELEASE_NAME",
		Short:             "download a named release",
		Long:              getHelp,
		PersistentPreRunE: setupConnection,
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) == 0 {
				return errReleaseRequired
			}
			get.release = args[0]
			if get.client == nil {
				get.client = helm.NewClient(helm.HelmHost(helm.Config.ServAddr))
			}
			return get.run()
		},
	}
	cmd.AddCommand(newGetValuesCmd(nil, out))
	cmd.AddCommand(newGetManifestCmd(nil, out))
	return cmd
}
Пример #3
0
func newListCmd(client helm.Interface, out io.Writer) *cobra.Command {
	list := &listCmd{
		out:    out,
		client: client,
	}
	cmd := &cobra.Command{
		Use:               "list [flags] [FILTER]",
		Short:             "list releases",
		Long:              listHelp,
		Aliases:           []string{"ls"},
		PersistentPreRunE: setupConnection,
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) > 0 {
				list.filter = strings.Join(args, " ")
			}
			if list.client == nil {
				list.client = helm.NewClient(helm.Host(tillerHost))
			}
			return list.run()
		},
	}
	f := cmd.Flags()
	f.BoolVarP(&list.short, "short", "q", false, "output short (quiet) listing format")
	f.BoolVarP(&list.byDate, "date", "d", false, "sort by release date")
	f.BoolVarP(&list.sortDesc, "reverse", "r", false, "reverse the sort order")
	f.IntVarP(&list.limit, "max", "m", 256, "maximum number of releases to fetch")
	f.StringVarP(&list.offset, "offset", "o", "", "the next release name in the list, used to offset from start value")
	f.BoolVar(&list.all, "all", false, "show all releases, not just the ones marked DEPLOYED")
	f.BoolVar(&list.deleted, "deleted", false, "show deleted releases")
	f.BoolVar(&list.deployed, "deployed", false, "show deployed releases. If no other is specified, this will be automatically enabled")
	f.BoolVar(&list.failed, "failed", false, "show failed releases")
	// TODO: Do we want this as a feature of 'helm list'?
	//f.BoolVar(&list.superseded, "history", true, "show historical releases")
	return cmd
}
Пример #4
0
func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command {
	his := &historyCmd{out: w, helmc: c}

	cmd := &cobra.Command{
		Use:               "history [flags] RELEASE_NAME",
		Long:              historyHelp,
		Short:             "fetch release history",
		Aliases:           []string{"hist"},
		PersistentPreRunE: setupConnection,
		RunE: func(cmd *cobra.Command, args []string) error {
			switch {
			case len(args) == 0:
				return errReleaseRequired
			case his.helmc == nil:
				his.helmc = helm.NewClient(helm.Host(tillerHost))
			}
			his.rls = args[0]
			return his.run()
		},
	}

	cmd.Flags().Int32Var(&his.max, "max", 256, "maximum number of revision to include in history")

	return cmd
}
Пример #5
0
func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command {
	get := &getManifestCmd{
		out:    out,
		client: client,
	}
	cmd := &cobra.Command{
		Use:   "manifest [flags] RELEASE_NAME",
		Short: "download the manifest for a named release",
		Long:  getManifestHelp,
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) == 0 {
				return errReleaseRequired
			}
			get.release = args[0]
			if get.client == nil {
				get.client = helm.NewClient(helm.HelmHost(helm.Config.ServAddr))
			}
			return get.run()
		},
	}
	return cmd
}
Пример #6
0
func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command {
	get := &getValuesCmd{
		out:    out,
		client: client,
	}
	cmd := &cobra.Command{
		Use:   "values [flags] RELEASE_NAME",
		Short: "download the values file for a named release",
		Long:  getValuesHelp,
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) == 0 {
				return errReleaseRequired
			}
			get.release = args[0]
			if get.client == nil {
				get.client = helm.NewClient(helm.HelmHost(helm.Config.ServAddr))
			}
			return get.run()
		},
	}
	cmd.Flags().BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values")
	return cmd
}
Пример #7
0
func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command {
	get := &getManifestCmd{
		out:    out,
		client: client,
	}
	cmd := &cobra.Command{
		Use:   "manifest [flags] RELEASE_NAME",
		Short: "download the manifest for a named release",
		Long:  getManifestHelp,
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) == 0 {
				return errReleaseRequired
			}
			get.release = args[0]
			if get.client == nil {
				get.client = helm.NewClient(helm.Host(tillerHost))
			}
			return get.run()
		},
	}

	cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision")
	return cmd
}
Пример #8
0
Файл: get.go Проект: runseb/helm
func ensureHelmClient(h helm.Interface) helm.Interface {
	if h != nil {
		return h
	}
	return helm.NewClient(helm.Host(tillerHost))
}