diff --git a/cmd/helm/create_test.go b/cmd/helm/create_test.go index a49d3cfa9..d45843eda 100644 --- a/cmd/helm/create_test.go +++ b/cmd/helm/create_test.go @@ -87,7 +87,7 @@ func TestCreateStarterCmd(t *testing.T) { if err != nil { t.Fatal(err) } - old := helmpath.Home(environment.DefaultHelmHome()) + old := helmpath.Home(environment.DefaultHelmHome) settings.Home = thome defer func() { settings.Home = old diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go index 2390573d9..67ab4379c 100755 --- a/cmd/helm/delete.go +++ b/cmd/helm/delete.go @@ -52,12 +52,12 @@ func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command { } cmd := &cobra.Command{ - Use: "delete [flags] RELEASE_NAME [...]", - Aliases: []string{"del"}, - SuggestFor: []string{"remove", "rm"}, - Short: "given a release name, delete the release from Kubernetes", - Long: deleteDesc, - PersistentPreRunE: setupConnection, + Use: "delete [flags] RELEASE_NAME [...]", + Aliases: []string{"del"}, + SuggestFor: []string{"remove", "rm"}, + Short: "given a release name, delete the release from Kubernetes", + Long: deleteDesc, + PreRunE: setupConnection, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return errors.New("command 'delete' requires a release name") diff --git a/cmd/helm/fetch_test.go b/cmd/helm/fetch_test.go index 3958a6e25..4d81ed38e 100644 --- a/cmd/helm/fetch_test.go +++ b/cmd/helm/fetch_test.go @@ -34,7 +34,7 @@ func TestFetchCmd(t *testing.T) { if err != nil { t.Fatal(err) } - old := helmpath.Home(environment.DefaultHelmHome()) + old := helmpath.Home(environment.DefaultHelmHome) settings.Home = hh defer func() { settings.Home = old diff --git a/cmd/helm/get.go b/cmd/helm/get.go index b540d24fe..fc5871f46 100644 --- a/cmd/helm/get.go +++ b/cmd/helm/get.go @@ -54,10 +54,10 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command { } cmd := &cobra.Command{ - Use: "get [flags] RELEASE_NAME", - Short: "download a named release", - Long: getHelp, - PersistentPreRunE: setupConnection, + Use: "get [flags] RELEASE_NAME", + Short: "download a named release", + Long: getHelp, + PreRunE: setupConnection, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return errReleaseRequired diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 48f87d5e5..c395d1f55 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -19,7 +19,6 @@ package main // import "k8s.io/helm/cmd/helm" import ( "errors" "fmt" - "io" "io/ioutil" "log" "os" @@ -39,23 +38,16 @@ import ( "k8s.io/helm/pkg/tlsutil" ) -const ( - localRepoIndexFilePath = "index.yaml" -) - var ( tlsCaCertFile string // path to TLS CA certificate file tlsCertFile string // path to TLS certificate file tlsKeyFile string // path to TLS key file tlsVerify bool // enable TLS and verify remote certificates tlsEnable bool // enable TLS -) -var ( - kubeContext string - settings helm_env.EnvSettings - // TODO refactor out this global var + kubeContext string tillerTunnel *kube.Tunnel + settings helm_env.EnvSettings ) var globalUsage = `The Kubernetes package manager @@ -82,34 +74,58 @@ Environment: $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") ` -func newRootCmd(out io.Writer) *cobra.Command { +func setFlagFromEnv(name, envar string, cmd *cobra.Command) { + if cmd.Flags().Changed(name) { + return + } + if v, ok := os.LookupEnv(envar); ok { + cmd.Flags().Set(name, v) + } +} + +func setFlagsFromEnv(flags map[string]string, cmd *cobra.Command) { + for name, envar := range flags { + setFlagFromEnv(name, envar, cmd) + } +} + +func addRootFlags(cmd *cobra.Command) { + pf := cmd.PersistentFlags() + pf.StringVar((*string)(&settings.Home), "home", helm_env.DefaultHelmHome, "location of your Helm config. Overrides $HELM_HOME") + pf.StringVar(&settings.TillerHost, "host", "", "address of tiller. Overrides $HELM_HOST") + pf.StringVar(&kubeContext, "kube-context", "", "name of the kubeconfig context to use") + pf.BoolVar(&settings.Debug, "debug", false, "enable verbose output") + pf.StringVar(&settings.TillerNamespace, "tiller-namespace", tiller_env.DefaultTillerNamespace, "namespace of tiller") +} + +func initRootFlags(cmd *cobra.Command) { + setFlagsFromEnv(map[string]string{ + "debug": helm_env.DebugEnvVar, + "home": helm_env.HomeEnvVar, + "host": helm_env.HostEnvVar, + "tiller-namespace": tiller_env.TillerNamespaceEnvVar, + }, cmd.Root()) + + tlsCaCertFile = os.ExpandEnv(tlsCaCertFile) + tlsCertFile = os.ExpandEnv(tlsCertFile) + tlsKeyFile = os.ExpandEnv(tlsKeyFile) +} + +func newRootCmd() *cobra.Command { cmd := &cobra.Command{ Use: "helm", Short: "The Helm package manager for Kubernetes.", Long: globalUsage, SilenceUsage: true, - PersistentPreRun: func(cmd *cobra.Command, args []string) { - tlsCaCertFile = os.ExpandEnv(tlsCaCertFile) - tlsCertFile = os.ExpandEnv(tlsCertFile) - tlsKeyFile = os.ExpandEnv(tlsKeyFile) + PersistentPreRun: func(cmd *cobra.Command, _ []string) { + initRootFlags(cmd) }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { + PersistentPostRun: func(*cobra.Command, []string) { teardown() }, } - p := cmd.PersistentFlags() - p.StringVar((*string)(&settings.Home), "home", helm_env.DefaultHelmHome(), "location of your Helm config. Overrides $HELM_HOME") - p.StringVar(&settings.TillerHost, "host", helm_env.DefaultHelmHost(), "address of tiller. Overrides $HELM_HOST") - p.StringVar(&kubeContext, "kube-context", "", "name of the kubeconfig context to use") - p.BoolVar(&settings.Debug, "debug", false, "enable verbose output") - p.StringVar(&settings.TillerNamespace, "tiller-namespace", tiller_env.GetTillerNamespace(), "namespace of tiller") - - if os.Getenv(helm_env.PluginDisableEnvVar) != "1" { - settings.PlugDirs = os.Getenv(helm_env.PluginEnvVar) - if settings.PlugDirs == "" { - settings.PlugDirs = settings.Home.Plugins() - } - } + addRootFlags(cmd) + out := cmd.OutOrStdout() cmd.AddCommand( // chart commands @@ -139,7 +155,7 @@ func newRootCmd(out io.Writer) *cobra.Command { addFlagsTLS(newVersionCmd(nil, out)), newCompletionCmd(out), - newHomeCmd(out), + newHomeCmd(), newInitCmd(out), newPluginCmd(out), @@ -162,7 +178,7 @@ func init() { } func main() { - cmd := newRootCmd(os.Stdout) + cmd := newRootCmd() if err := cmd.Execute(); err != nil { os.Exit(1) } diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index cf70b3f74..910daa22a 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -23,6 +23,7 @@ import ( "io/ioutil" "math/rand" "os" + "path/filepath" "regexp" "sync" "testing" @@ -321,7 +322,7 @@ func ensureTestHome(home helmpath.Home, t *testing.T) error { } } - localRepoIndexFile := home.LocalRepository(localRepoIndexFilePath) + localRepoIndexFile := home.LocalRepository(localRepositoryIndexFile) if fi, err := os.Stat(localRepoIndexFile); err != nil { i := repo.NewIndexFile() if err := i.WriteFile(localRepoIndexFile, 0644); err != nil { @@ -337,3 +338,77 @@ func ensureTestHome(home helmpath.Home, t *testing.T) error { t.Logf("$HELM_HOME has been configured at %s.\n", settings.Home.String()) return nil } + +func TestRootCmd(t *testing.T) { + oldhome := os.Getenv("HELM_HOME") + defer os.Setenv("HELM_HOME", oldhome) + + tests := []struct { + name string + args []string + envars map[string]string + home string + }{ + { + name: "defaults", + home: filepath.Join(os.Getenv("HOME"), "/.helm"), + }, + { + name: "with --home set", + args: []string{"--home", "/foo"}, + home: "/foo", + }, + { + name: "subcommands with --home set", + args: []string{"home", "--home", "/foo"}, + home: "/foo", + }, + { + name: "with $HELM_HOME set", + envars: map[string]string{"HELM_HOME": "/bar"}, + home: "/bar", + }, + { + name: "subcommands with $HELM_HOME set", + args: []string{"home"}, + envars: map[string]string{"HELM_HOME": "/bar"}, + home: "/bar", + }, + { + name: "with $HELM_HOME and --home set", + args: []string{"home", "--home", "/foo"}, + envars: map[string]string{"HELM_HOME": "/bar"}, + home: "/foo", + }, + } + + // ensure not set locally + os.Unsetenv("HELM_HOME") + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + defer os.Unsetenv("HELM_HOME") + + for k, v := range tt.envars { + os.Setenv(k, v) + } + + cmd := newRootCmd() + cmd.SetOutput(ioutil.Discard) + cmd.SetArgs(tt.args) + cmd.Run = func(*cobra.Command, []string) {} + if err := cmd.Execute(); err != nil { + t.Errorf("unexpected error: %s", err) + } + + if settings.Home.String() != tt.home { + t.Errorf("expected home %q, got %q", tt.home, settings.Home) + } + homeFlag := cmd.Flag("home").Value.String() + homeFlag = os.ExpandEnv(homeFlag) + if homeFlag != tt.home { + t.Errorf("expected home %q, got %q", tt.home, homeFlag) + } + }) + } +} diff --git a/cmd/helm/history.go b/cmd/helm/history.go index 21c444dab..08f1656f5 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -56,11 +56,11 @@ 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, + Use: "history [flags] RELEASE_NAME", + Long: historyHelp, + Short: "fetch release history", + Aliases: []string{"hist"}, + PreRunE: setupConnection, RunE: func(cmd *cobra.Command, args []string) error { switch { case len(args) == 0: diff --git a/cmd/helm/home.go b/cmd/helm/home.go index 25809b521..abd7fb101 100644 --- a/cmd/helm/home.go +++ b/cmd/helm/home.go @@ -17,9 +17,6 @@ limitations under the License. package main import ( - "fmt" - "io" - "github.com/spf13/cobra" ) @@ -28,25 +25,24 @@ This command displays the location of HELM_HOME. This is where any helm configuration files live. ` -func newHomeCmd(out io.Writer) *cobra.Command { +func newHomeCmd() *cobra.Command { cmd := &cobra.Command{ Use: "home", Short: "displays the location of HELM_HOME", Long: longHomeHelp, Run: func(cmd *cobra.Command, args []string) { h := settings.Home - fmt.Fprintf(out, "%s\n", h) + cmd.Println(h) if settings.Debug { - fmt.Fprintf(out, "Repository: %s\n", h.Repository()) - fmt.Fprintf(out, "RepositoryFile: %s\n", h.RepositoryFile()) - fmt.Fprintf(out, "Cache: %s\n", h.Cache()) - fmt.Fprintf(out, "Stable CacheIndex: %s\n", h.CacheIndex("stable")) - fmt.Fprintf(out, "Starters: %s\n", h.Starters()) - fmt.Fprintf(out, "LocalRepository: %s\n", h.LocalRepository()) - fmt.Fprintf(out, "Plugins: %s\n", h.Plugins()) + cmd.Printf("Repository: %s\n", h.Repository()) + cmd.Printf("RepositoryFile: %s\n", h.RepositoryFile()) + cmd.Printf("Cache: %s\n", h.Cache()) + cmd.Printf("Stable CacheIndex: %s\n", h.CacheIndex("stable")) + cmd.Printf("Starters: %s\n", h.Starters()) + cmd.Printf("LocalRepository: %s\n", h.LocalRepository()) + cmd.Printf("Plugins: %s\n", h.Plugins()) } }, } - return cmd } diff --git a/cmd/helm/init.go b/cmd/helm/init.go index dc1298915..dab6e0bc7 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -54,8 +54,9 @@ To dump a manifest containing the Tiller deployment YAML, combine the ` const ( - stableRepository = "stable" - localRepository = "local" + stableRepository = "stable" + localRepository = "local" + localRepositoryIndexFile = "index.yaml" ) var ( @@ -296,7 +297,7 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer, skipRefresh bool) err if err != nil { return err } - lr, err := initLocalRepo(home.LocalRepository(localRepoIndexFilePath), home.CacheIndex("local")) + lr, err := initLocalRepo(home.LocalRepository(localRepositoryIndexFile), home.CacheIndex("local")) if err != nil { return err } diff --git a/cmd/helm/init_test.go b/cmd/helm/init_test.go index 4d82c297b..874d9d4dc 100644 --- a/cmd/helm/init_test.go +++ b/cmd/helm/init_test.go @@ -214,7 +214,7 @@ func TestEnsureHome(t *testing.T) { t.Errorf("%s should not be a directory", fi) } - if fi, err := os.Stat(hh.LocalRepository(localRepoIndexFilePath)); err != nil { + if fi, err := os.Stat(hh.LocalRepository(localRepositoryIndexFile)); err != nil { t.Errorf("%s", err) } else if fi.IsDir() { t.Errorf("%s should not be a directory", fi) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index c51786f90..f438ebe04 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -148,10 +148,10 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { } cmd := &cobra.Command{ - Use: "install [CHART]", - Short: "install a chart archive", - Long: installDesc, - PersistentPreRunE: setupConnection, + Use: "install [CHART]", + Short: "install a chart archive", + Long: installDesc, + PreRunE: setupConnection, RunE: func(cmd *cobra.Command, args []string) error { if err := checkArgsLength(len(args), "chart name"); err != nil { return err diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 0919a1c3b..391e83e20 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -82,11 +82,11 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { } cmd := &cobra.Command{ - Use: "list [flags] [FILTER]", - Short: "list releases", - Long: listHelp, - Aliases: []string{"ls"}, - PersistentPreRunE: setupConnection, + Use: "list [flags] [FILTER]", + Short: "list releases", + Long: listHelp, + Aliases: []string{"ls"}, + PreRunE: setupConnection, RunE: func(cmd *cobra.Command, args []string) error { if len(args) > 0 { list.filter = strings.Join(args, " ") diff --git a/cmd/helm/load_plugins.go b/cmd/helm/load_plugins.go index af4e2f2bf..ee773cb4b 100644 --- a/cmd/helm/load_plugins.go +++ b/cmd/helm/load_plugins.go @@ -25,19 +25,10 @@ import ( "github.com/spf13/cobra" - "k8s.io/helm/pkg/helm/helmpath" + helm_env "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/plugin" ) -const pluginEnvVar = "HELM_PLUGIN" - -func pluginDirs(home helmpath.Home) string { - if dirs := os.Getenv(pluginEnvVar); dirs != "" { - return dirs - } - return home.Plugins() -} - // loadPlugins loads plugins into the command list. // // This follows a different pattern than the other commands because it has @@ -46,16 +37,25 @@ func pluginDirs(home helmpath.Home) string { func loadPlugins(baseCmd *cobra.Command, out io.Writer) { // If HELM_NO_PLUGINS is set to 1, do not load plugins. - if settings.PlugDirs == "" { + if os.Getenv(helm_env.PluginDisableEnvVar) == "1" { return } - found, err := findPlugins(settings.PlugDirs) + found, err := findPlugins(settings.PluginDirs()) if err != nil { fmt.Fprintf(os.Stderr, "failed to load plugins: %s", err) return } + processParent := func(cmd *cobra.Command, args []string) ([]string, error) { + k, u := manuallyProcessArgs(args) + if err := cmd.Parent().ParseFlags(k); err != nil { + return nil, err + } + initRootFlags(cmd) + return u, nil + } + // Now we create commands for all of these. for _, plug := range found { plug := plug @@ -69,9 +69,8 @@ func loadPlugins(baseCmd *cobra.Command, out io.Writer) { Short: md.Usage, Long: md.Description, RunE: func(cmd *cobra.Command, args []string) error { - - k, u := manuallyProcessArgs(args) - if err := cmd.Parent().ParseFlags(k); err != nil { + u, err := processParent(cmd, args) + if err != nil { return err } @@ -99,10 +98,9 @@ func loadPlugins(baseCmd *cobra.Command, out io.Writer) { } if md.UseTunnel { - c.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { + c.PreRunE = func(cmd *cobra.Command, args []string) error { // Parse the parent flag, but not the local flags. - k, _ := manuallyProcessArgs(args) - if err := c.Parent().ParseFlags(k); err != nil { + if _, err := processParent(cmd, args); err != nil { return err } return setupConnection(cmd, args) diff --git a/cmd/helm/plugin_list.go b/cmd/helm/plugin_list.go index 0bf9acbc8..e7618f38a 100644 --- a/cmd/helm/plugin_list.go +++ b/cmd/helm/plugin_list.go @@ -44,11 +44,8 @@ func newPluginListCmd(out io.Writer) *cobra.Command { } func (pcmd *pluginListCmd) run() error { - plugdirs := pluginDirs(pcmd.home) - - debug("pluginDirs: %s", plugdirs) - - plugins, err := findPlugins(plugdirs) + debug("pluginDirs: %s", settings.PluginDirs()) + plugins, err := findPlugins(settings.PluginDirs()) if err != nil { return err } diff --git a/cmd/helm/plugin_remove.go b/cmd/helm/plugin_remove.go index e7e522d51..83bc863bf 100644 --- a/cmd/helm/plugin_remove.go +++ b/cmd/helm/plugin_remove.go @@ -59,9 +59,8 @@ func (pcmd *pluginRemoveCmd) complete(args []string) error { } func (pcmd *pluginRemoveCmd) run() error { - plugdirs := pluginDirs(pcmd.home) - debug("loading installed plugins from %s", plugdirs) - plugins, err := findPlugins(plugdirs) + debug("loading installed plugins from %s", settings.PluginDirs()) + plugins, err := findPlugins(settings.PluginDirs()) if err != nil { return err } diff --git a/cmd/helm/plugin_test.go b/cmd/helm/plugin_test.go index 095de7063..77ef00c5d 100644 --- a/cmd/helm/plugin_test.go +++ b/cmd/helm/plugin_test.go @@ -23,6 +23,7 @@ import ( "strings" "testing" + helm_env "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/plugin" @@ -71,7 +72,6 @@ func TestLoadPlugins(t *testing.T) { settings.Home = old }() hh := settings.Home - settings.PlugDirs = hh.Plugins() out := bytes.NewBuffer(nil) cmd := &cobra.Command{} @@ -139,12 +139,11 @@ func TestLoadPlugins(t *testing.T) { func TestLoadPlugins_HelmNoPlugins(t *testing.T) { // Set helm home to point to testdata old := settings.Home - oldPlugDirs := settings.PlugDirs settings.Home = "testdata/helmhome" - settings.PlugDirs = "" + os.Setenv(helm_env.PluginDisableEnvVar, "1") defer func() { settings.Home = old - settings.PlugDirs = oldPlugDirs + os.Unsetenv(helm_env.PluginDisableEnvVar) }() out := bytes.NewBuffer(nil) @@ -161,7 +160,6 @@ func TestSetupEnv(t *testing.T) { name := "pequod" settings.Home = helmpath.Home("testdata/helmhome") base := filepath.Join(settings.Home.Plugins(), name) - settings.PlugDirs = settings.Home.Plugins() settings.Debug = true defer func() { settings.Debug = false diff --git a/cmd/helm/plugin_update.go b/cmd/helm/plugin_update.go index e4fbe18df..2e19a2175 100644 --- a/cmd/helm/plugin_update.go +++ b/cmd/helm/plugin_update.go @@ -61,9 +61,8 @@ func (pcmd *pluginUpdateCmd) complete(args []string) error { func (pcmd *pluginUpdateCmd) run() error { installer.Debug = settings.Debug - plugdirs := pluginDirs(pcmd.home) - debug("loading installed plugins from %s", plugdirs) - plugins, err := findPlugins(plugdirs) + debug("loading installed plugins from %s", settings.PluginDirs()) + plugins, err := findPlugins(settings.PluginDirs()) if err != nil { return err } diff --git a/cmd/helm/release_testing.go b/cmd/helm/release_testing.go index a196f7809..1aadd4de3 100644 --- a/cmd/helm/release_testing.go +++ b/cmd/helm/release_testing.go @@ -48,10 +48,10 @@ func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command { } cmd := &cobra.Command{ - Use: "test [RELEASE]", - Short: "test a release", - Long: releaseTestDesc, - PersistentPreRunE: setupConnection, + Use: "test [RELEASE]", + Short: "test a release", + Long: releaseTestDesc, + PreRunE: setupConnection, RunE: func(cmd *cobra.Command, args []string) error { if err := checkArgsLength(len(args), "release name"); err != nil { return err diff --git a/cmd/helm/reset.go b/cmd/helm/reset.go index 56a216735..7e040ca9e 100644 --- a/cmd/helm/reset.go +++ b/cmd/helm/reset.go @@ -57,7 +57,7 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { Use: "reset", Short: "uninstalls Tiller from a cluster", Long: resetDesc, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { + PreRunE: func(cmd *cobra.Command, args []string) error { if err := setupConnection(cmd, args); !d.force && err != nil { return err } diff --git a/cmd/helm/rollback.go b/cmd/helm/rollback.go index b6c031c56..95c27e2a5 100644 --- a/cmd/helm/rollback.go +++ b/cmd/helm/rollback.go @@ -30,7 +30,7 @@ const rollbackDesc = ` This command rolls back a release to a previous revision. The first argument of the rollback command is the name of a release, and the -second is a revision (version) number. To see revision numbers, run +second is a revision (version) number. To see revision numbers, run 'helm history RELEASE'. ` @@ -54,10 +54,10 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { } cmd := &cobra.Command{ - Use: "rollback [flags] [RELEASE] [REVISION]", - Short: "roll back a release to a previous revision", - Long: rollbackDesc, - PersistentPreRunE: setupConnection, + Use: "rollback [flags] [RELEASE] [REVISION]", + Short: "roll back a release to a previous revision", + Long: rollbackDesc, + PreRunE: setupConnection, RunE: func(cmd *cobra.Command, args []string) error { if err := checkArgsLength(len(args), "release name", "revision number"); err != nil { return err diff --git a/cmd/helm/status.go b/cmd/helm/status.go index b635e6186..36269c4b1 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -57,10 +57,10 @@ func newStatusCmd(client helm.Interface, out io.Writer) *cobra.Command { } cmd := &cobra.Command{ - Use: "status [flags] RELEASE_NAME", - Short: "displays the status of the named release", - Long: statusHelp, - PersistentPreRunE: setupConnection, + Use: "status [flags] RELEASE_NAME", + Short: "displays the status of the named release", + Long: statusHelp, + PreRunE: setupConnection, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return errReleaseRequired diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 3c0a780f1..3be680a9f 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -91,10 +91,10 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { } cmd := &cobra.Command{ - Use: "upgrade [RELEASE] [CHART]", - Short: "upgrade a release", - Long: upgradeDesc, - PersistentPreRunE: setupConnection, + Use: "upgrade [RELEASE] [CHART]", + Short: "upgrade a release", + Long: upgradeDesc, + PreRunE: setupConnection, RunE: func(cmd *cobra.Command, args []string) error { if err := checkArgsLength(len(args), "release name", "chart path"); err != nil { return err diff --git a/docs/helm/helm.md b/docs/helm/helm.md index 4cc3289d3..4567049da 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -33,7 +33,7 @@ Environment: ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -66,4 +66,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_completion.md b/docs/helm/helm_completion.md index 7b63a91d8..4b7c540a1 100644 --- a/docs/helm/helm_completion.md +++ b/docs/helm/helm_completion.md @@ -25,7 +25,7 @@ helm completion SHELL ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -34,4 +34,4 @@ helm completion SHELL ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_create.md b/docs/helm/helm_create.md index 79704c3d1..8284be8ff 100644 --- a/docs/helm/helm_create.md +++ b/docs/helm/helm_create.md @@ -44,7 +44,7 @@ helm create NAME ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -53,4 +53,4 @@ helm create NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_delete.md b/docs/helm/helm_delete.md index cee3bcb87..0d15b9d02 100644 --- a/docs/helm/helm_delete.md +++ b/docs/helm/helm_delete.md @@ -35,7 +35,7 @@ helm delete [flags] RELEASE_NAME [...] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -44,4 +44,4 @@ helm delete [flags] RELEASE_NAME [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_dependency.md b/docs/helm/helm_dependency.md index c824c73b3..629a27d38 100644 --- a/docs/helm/helm_dependency.md +++ b/docs/helm/helm_dependency.md @@ -58,7 +58,7 @@ for this case. ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -70,4 +70,4 @@ for this case. * [helm dependency list](helm_dependency_list.md) - list the dependencies for the given chart * [helm dependency update](helm_dependency_update.md) - update charts/ based on the contents of requirements.yaml -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_dependency_build.md b/docs/helm/helm_dependency_build.md index 2bd2cb3ed..9c5d6af78 100644 --- a/docs/helm/helm_dependency_build.md +++ b/docs/helm/helm_dependency_build.md @@ -31,7 +31,7 @@ helm dependency build [flags] CHART ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -40,4 +40,4 @@ helm dependency build [flags] CHART ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_dependency_list.md b/docs/helm/helm_dependency_list.md index 57f89c20c..ec5e861fd 100644 --- a/docs/helm/helm_dependency_list.md +++ b/docs/helm/helm_dependency_list.md @@ -23,7 +23,7 @@ helm dependency list [flags] CHART ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -32,4 +32,4 @@ helm dependency list [flags] CHART ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_dependency_update.md b/docs/helm/helm_dependency_update.md index 6c07aaf54..8fb8fd2d1 100644 --- a/docs/helm/helm_dependency_update.md +++ b/docs/helm/helm_dependency_update.md @@ -36,7 +36,7 @@ helm dependency update [flags] CHART ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -45,4 +45,4 @@ helm dependency update [flags] CHART ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_fetch.md b/docs/helm/helm_fetch.md index b6a424569..a95781997 100644 --- a/docs/helm/helm_fetch.md +++ b/docs/helm/helm_fetch.md @@ -45,7 +45,7 @@ helm fetch [flags] [chart URL | repo/chartname] [...] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -54,4 +54,4 @@ helm fetch [flags] [chart URL | repo/chartname] [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_get.md b/docs/helm/helm_get.md index a8c3699a1..efa3c458a 100644 --- a/docs/helm/helm_get.md +++ b/docs/helm/helm_get.md @@ -37,7 +37,7 @@ helm get [flags] RELEASE_NAME ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -49,4 +49,4 @@ helm get [flags] RELEASE_NAME * [helm get manifest](helm_get_manifest.md) - download the manifest for a named release * [helm get values](helm_get_values.md) - download the values file for a named release -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_get_hooks.md b/docs/helm/helm_get_hooks.md index 9c15ab3dc..d2fad8b69 100644 --- a/docs/helm/helm_get_hooks.md +++ b/docs/helm/helm_get_hooks.md @@ -25,7 +25,7 @@ helm get hooks [flags] RELEASE_NAME ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -34,4 +34,4 @@ helm get hooks [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_get_manifest.md b/docs/helm/helm_get_manifest.md index f4346ea9e..053ef652d 100644 --- a/docs/helm/helm_get_manifest.md +++ b/docs/helm/helm_get_manifest.md @@ -27,7 +27,7 @@ helm get manifest [flags] RELEASE_NAME ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -36,4 +36,4 @@ helm get manifest [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_get_values.md b/docs/helm/helm_get_values.md index f86b7e574..5cdcbd7d2 100644 --- a/docs/helm/helm_get_values.md +++ b/docs/helm/helm_get_values.md @@ -24,7 +24,7 @@ helm get values [flags] RELEASE_NAME ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -33,4 +33,4 @@ helm get values [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index e735a1f1c..590c8a684 100644 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -40,7 +40,7 @@ helm history [flags] RELEASE_NAME ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -49,4 +49,4 @@ helm history [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_home.md b/docs/helm/helm_home.md index b2b37b0b4..683142f71 100644 --- a/docs/helm/helm_home.md +++ b/docs/helm/helm_home.md @@ -18,7 +18,7 @@ helm home ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -27,4 +27,4 @@ helm home ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_init.md b/docs/helm/helm_init.md index 5329fde3b..2d498c554 100644 --- a/docs/helm/helm_init.md +++ b/docs/helm/helm_init.md @@ -54,7 +54,7 @@ helm init ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -63,4 +63,4 @@ helm init ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_inspect.md b/docs/helm/helm_inspect.md index 9b72f646d..30f09a72f 100644 --- a/docs/helm/helm_inspect.md +++ b/docs/helm/helm_inspect.md @@ -32,7 +32,7 @@ helm inspect [CHART] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -43,4 +43,4 @@ helm inspect [CHART] * [helm inspect chart](helm_inspect_chart.md) - shows inspect chart * [helm inspect values](helm_inspect_values.md) - shows inspect values -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_inspect_chart.md b/docs/helm/helm_inspect_chart.md index 178702d7b..5e49e282b 100644 --- a/docs/helm/helm_inspect_chart.md +++ b/docs/helm/helm_inspect_chart.md @@ -30,7 +30,7 @@ helm inspect chart [CHART] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -39,4 +39,4 @@ helm inspect chart [CHART] ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_inspect_values.md b/docs/helm/helm_inspect_values.md index e388e3c7a..f49215975 100644 --- a/docs/helm/helm_inspect_values.md +++ b/docs/helm/helm_inspect_values.md @@ -30,7 +30,7 @@ helm inspect values [CHART] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -39,4 +39,4 @@ helm inspect values [CHART] ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 859df2ef1..f8e0885ff 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -97,7 +97,7 @@ helm install [CHART] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -106,4 +106,4 @@ helm install [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_lint.md b/docs/helm/helm_lint.md index a7fad58d1..61e6737c4 100644 --- a/docs/helm/helm_lint.md +++ b/docs/helm/helm_lint.md @@ -28,7 +28,7 @@ helm lint [flags] PATH ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -37,4 +37,4 @@ helm lint [flags] PATH ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_list.md b/docs/helm/helm_list.md index 5ccfdfdca..a69f5ba2c 100644 --- a/docs/helm/helm_list.md +++ b/docs/helm/helm_list.md @@ -61,7 +61,7 @@ helm list [flags] [FILTER] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -70,4 +70,4 @@ helm list [flags] [FILTER] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_package.md b/docs/helm/helm_package.md index a7b69f6b9..a88022193 100644 --- a/docs/helm/helm_package.md +++ b/docs/helm/helm_package.md @@ -35,7 +35,7 @@ helm package [flags] [CHART_PATH] [...] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -44,4 +44,4 @@ helm package [flags] [CHART_PATH] [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_plugin.md b/docs/helm/helm_plugin.md index d4d0ee08b..b38f3e013 100644 --- a/docs/helm/helm_plugin.md +++ b/docs/helm/helm_plugin.md @@ -13,7 +13,7 @@ Manage client-side Helm plugins. ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -26,4 +26,4 @@ Manage client-side Helm plugins. * [helm plugin remove](helm_plugin_remove.md) - remove one or more Helm plugins * [helm plugin update](helm_plugin_update.md) - update one or more Helm plugins -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_plugin_install.md b/docs/helm/helm_plugin_install.md index 13581c055..7b4f8904e 100644 --- a/docs/helm/helm_plugin_install.md +++ b/docs/helm/helm_plugin_install.md @@ -21,7 +21,7 @@ helm plugin install [options] ... ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -30,4 +30,4 @@ helm plugin install [options] ... ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_plugin_list.md b/docs/helm/helm_plugin_list.md index 4448a5a04..53f37b8d0 100644 --- a/docs/helm/helm_plugin_list.md +++ b/docs/helm/helm_plugin_list.md @@ -15,7 +15,7 @@ helm plugin list ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -24,4 +24,4 @@ helm plugin list ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_plugin_remove.md b/docs/helm/helm_plugin_remove.md index 4ae04b286..0559f395c 100644 --- a/docs/helm/helm_plugin_remove.md +++ b/docs/helm/helm_plugin_remove.md @@ -15,7 +15,7 @@ helm plugin remove ... ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -24,4 +24,4 @@ helm plugin remove ... ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_plugin_update.md b/docs/helm/helm_plugin_update.md index 6f59cd4b2..c0dac090a 100644 --- a/docs/helm/helm_plugin_update.md +++ b/docs/helm/helm_plugin_update.md @@ -15,7 +15,7 @@ helm plugin update ... ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -24,4 +24,4 @@ helm plugin update ... ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_repo.md b/docs/helm/helm_repo.md index d0d015569..150b565fa 100644 --- a/docs/helm/helm_repo.md +++ b/docs/helm/helm_repo.md @@ -17,7 +17,7 @@ Example usage: ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -31,4 +31,4 @@ Example usage: * [helm repo remove](helm_repo_remove.md) - remove a chart repository * [helm repo update](helm_repo_update.md) - update information on available charts in the chart repositories -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_repo_add.md b/docs/helm/helm_repo_add.md index c7b2a41ef..f7f3e8727 100644 --- a/docs/helm/helm_repo_add.md +++ b/docs/helm/helm_repo_add.md @@ -24,7 +24,7 @@ helm repo add [flags] [NAME] [URL] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -33,4 +33,4 @@ helm repo add [flags] [NAME] [URL] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_repo_index.md b/docs/helm/helm_repo_index.md index 7a33052a3..79c8ee608 100644 --- a/docs/helm/helm_repo_index.md +++ b/docs/helm/helm_repo_index.md @@ -31,7 +31,7 @@ helm repo index [flags] [DIR] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -40,4 +40,4 @@ helm repo index [flags] [DIR] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_repo_list.md b/docs/helm/helm_repo_list.md index 7966592cb..4f8f2e1dd 100644 --- a/docs/helm/helm_repo_list.md +++ b/docs/helm/helm_repo_list.md @@ -15,7 +15,7 @@ helm repo list [flags] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -24,4 +24,4 @@ helm repo list [flags] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_repo_remove.md b/docs/helm/helm_repo_remove.md index 705fd8e89..075b15fce 100644 --- a/docs/helm/helm_repo_remove.md +++ b/docs/helm/helm_repo_remove.md @@ -15,7 +15,7 @@ helm repo remove [flags] [NAME] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -24,4 +24,4 @@ helm repo remove [flags] [NAME] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_repo_update.md b/docs/helm/helm_repo_update.md index b54ad3dda..98e443e59 100644 --- a/docs/helm/helm_repo_update.md +++ b/docs/helm/helm_repo_update.md @@ -21,7 +21,7 @@ helm repo update ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -30,4 +30,4 @@ helm repo update ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_reset.md b/docs/helm/helm_reset.md index 1d6fea9c9..bc3299d48 100644 --- a/docs/helm/helm_reset.md +++ b/docs/helm/helm_reset.md @@ -31,7 +31,7 @@ helm reset ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -40,4 +40,4 @@ helm reset ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index 7e59a67c8..3a3ed1a24 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -9,7 +9,7 @@ roll back a release to a previous revision This command rolls back a release to a previous revision. The first argument of the rollback command is the name of a release, and the -second is a revision (version) number. To see revision numbers, run +second is a revision (version) number. To see revision numbers, run 'helm history RELEASE'. @@ -37,7 +37,7 @@ helm rollback [flags] [RELEASE] [REVISION] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -46,4 +46,4 @@ helm rollback [flags] [RELEASE] [REVISION] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_search.md b/docs/helm/helm_search.md index 68f2f16be..48579c5b8 100644 --- a/docs/helm/helm_search.md +++ b/docs/helm/helm_search.md @@ -28,7 +28,7 @@ helm search [keyword] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -37,4 +37,4 @@ helm search [keyword] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_serve.md b/docs/helm/helm_serve.md index 71aaf26c5..1a317e9e4 100644 --- a/docs/helm/helm_serve.md +++ b/docs/helm/helm_serve.md @@ -36,7 +36,7 @@ helm serve ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -45,4 +45,4 @@ helm serve ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_status.md b/docs/helm/helm_status.md index 62a99796c..a737d7a64 100644 --- a/docs/helm/helm_status.md +++ b/docs/helm/helm_status.md @@ -35,7 +35,7 @@ helm status [flags] RELEASE_NAME ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -44,4 +44,4 @@ helm status [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_test.md b/docs/helm/helm_test.md index 578737578..8d7b39a59 100644 --- a/docs/helm/helm_test.md +++ b/docs/helm/helm_test.md @@ -32,7 +32,7 @@ helm test [RELEASE] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -41,4 +41,4 @@ helm test [RELEASE] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index c36c3ae5a..1fbefcba3 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -67,7 +67,7 @@ helm upgrade [RELEASE] [CHART] ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -76,4 +76,4 @@ helm upgrade [RELEASE] [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_verify.md b/docs/helm/helm_verify.md index 83c33844b..10ddab059 100644 --- a/docs/helm/helm_verify.md +++ b/docs/helm/helm_verify.md @@ -30,7 +30,7 @@ helm verify [flags] PATH ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -39,4 +39,4 @@ helm verify [flags] PATH ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/docs/helm/helm_version.md b/docs/helm/helm_version.md index f0aa4f8ca..16e2f5b92 100644 --- a/docs/helm/helm_version.md +++ b/docs/helm/helm_version.md @@ -44,7 +44,7 @@ helm version ``` --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --home string location of your Helm config. Overrides $HELM_HOME (default "$HOME/.helm") --host string address of tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-namespace string namespace of tiller (default "kube-system") @@ -53,4 +53,4 @@ helm version ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 26-May-2017 +###### Auto generated by spf13/cobra on 29-May-2017 diff --git a/pkg/getter/plugingetter.go b/pkg/getter/plugingetter.go index ff893421e..c747eef7f 100644 --- a/pkg/getter/plugingetter.go +++ b/pkg/getter/plugingetter.go @@ -29,7 +29,7 @@ import ( // collectPlugins scans for getter plugins. // This will load plugins according to the environment. func collectPlugins(settings environment.EnvSettings) (Providers, error) { - plugins, err := plugin.FindPlugins(settings.PlugDirs) + plugins, err := plugin.FindPlugins(settings.PluginDirs()) if err != nil { return nil, err } diff --git a/pkg/getter/plugingetter_test.go b/pkg/getter/plugingetter_test.go index 27079351a..f1fe9bf29 100644 --- a/pkg/getter/plugingetter_test.go +++ b/pkg/getter/plugingetter_test.go @@ -32,9 +32,8 @@ func hh(debug bool) environment.EnvSettings { } hp := helmpath.Home(apath) return environment.EnvSettings{ - Home: hp, - PlugDirs: hp.Plugins(), - Debug: debug, + Home: hp, + Debug: debug, } } diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go index f65f90ac7..2092450e1 100644 --- a/pkg/helm/environment/environment.go +++ b/pkg/helm/environment/environment.go @@ -38,20 +38,12 @@ const ( PluginDisableEnvVar = "HELM_NO_PLUGINS" // HostEnvVar is the HELM_HOST environment variable key. HostEnvVar = "HELM_HOST" + // DebugEnvVar is the HELM_DEBUG environment variable key. + DebugEnvVar = "HELM_DEBUG" ) -// DefaultHelmHome gets the configured HELM_HOME, or returns the default. -func DefaultHelmHome() string { - if home := os.Getenv(HomeEnvVar); home != "" { - return home - } - return filepath.Join(os.Getenv("HOME"), ".helm") -} - -// DefaultHelmHost returns the configured HELM_HOST or an empty string. -func DefaultHelmHost() string { - return os.Getenv(HostEnvVar) -} +// DefaultHelmHome is the default HELM_HOME. +var DefaultHelmHome = filepath.Join("$HOME", ".helm") // EnvSettings describes all of the environment settings. type EnvSettings struct { @@ -61,8 +53,14 @@ type EnvSettings struct { TillerNamespace string // Home is the local path to the Helm home directory. Home helmpath.Home - // PluginDirs is the path to the plugin directories. - PlugDirs string // Debug indicates whether or not Helm is running in Debug mode. Debug bool } + +// PluginDirs is the path to the plugin directories. +func (s EnvSettings) PluginDirs() string { + if d := os.Getenv(PluginEnvVar); d != "" { + return d + } + return s.Home.Plugins() +} diff --git a/pkg/helm/helmpath/helmhome.go b/pkg/helm/helmpath/helmhome.go index d3023dcba..c9aad70c6 100644 --- a/pkg/helm/helmpath/helmhome.go +++ b/pkg/helm/helmpath/helmhome.go @@ -17,6 +17,7 @@ package helmpath import ( "fmt" + "os" "path/filepath" ) @@ -29,12 +30,12 @@ type Home string // // Implements fmt.Stringer. func (h Home) String() string { - return string(h) + return os.ExpandEnv(string(h)) } // Path returns Home with elements appended. func (h Home) Path(elem ...string) string { - p := []string{string(h)} + p := []string{h.String()} p = append(p, elem...) return filepath.Join(p...) } diff --git a/pkg/helm/helmpath/helmhome_unix_test.go b/pkg/helm/helmpath/helmhome_unix_test.go index cca303d29..9c31a9c07 100644 --- a/pkg/helm/helmpath/helmhome_unix_test.go +++ b/pkg/helm/helmpath/helmhome_unix_test.go @@ -38,3 +38,9 @@ func TestHelmHome(t *testing.T) { isEq(t, hh.CacheIndex("t"), "/r/repository/cache/t-index.yaml") isEq(t, hh.Starters(), "/r/starters") } + +func TestHelmHome_expand(t *testing.T) { + if Home("$HOME").String() == "$HOME" { + t.Error("expected variable expansion") + } +} diff --git a/pkg/plugin/plugin.go b/pkg/plugin/plugin.go index 8bde6ad24..75d808701 100644 --- a/pkg/plugin/plugin.go +++ b/pkg/plugin/plugin.go @@ -179,7 +179,7 @@ func SetupPluginEnv(settings helm_env.EnvSettings, // Set vars that may not have been set, and save client the // trouble of re-parsing. - helm_env.PluginEnvVar: settings.PlugDirs, + helm_env.PluginEnvVar: settings.PluginDirs(), helm_env.HomeEnvVar: settings.Home.String(), // Set vars that convey common information. diff --git a/pkg/tiller/environment/environment.go b/pkg/tiller/environment/environment.go index 713699aca..de0dbe33d 100644 --- a/pkg/tiller/environment/environment.go +++ b/pkg/tiller/environment/environment.go @@ -24,7 +24,6 @@ package environment import ( "io" - "os" "time" "k8s.io/helm/pkg/chartutil" @@ -44,14 +43,6 @@ const TillerNamespaceEnvVar = "TILLER_NAMESPACE" // DefaultTillerNamespace is the default namespace for tiller. const DefaultTillerNamespace = "kube-system" -// GetTillerNamespace returns the right tiller namespace. -func GetTillerNamespace() string { - if ns := os.Getenv(TillerNamespaceEnvVar); ns != "" { - return ns - } - return DefaultTillerNamespace -} - // GoTplEngine is the name of the Go template engine, as registered in the EngineYard. const GoTplEngine = "gotpl"