diff --git a/cmd/helm/get_values.go b/cmd/helm/get_values.go index 83747eebc..8c08eeda7 100644 --- a/cmd/helm/get_values.go +++ b/cmd/helm/get_values.go @@ -20,6 +20,7 @@ import ( "fmt" "io" "log" + "os" "github.com/spf13/cobra" @@ -53,7 +54,7 @@ func newGetValuesCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { return compListReleases(toComplete, args, cfg) }, RunE: func(cmd *cobra.Command, args []string) error { - overrideRegistryWriter(cfg, outfmt) + overrideRegistryWriter(cfg, outfmt, os.Stderr) vals, err := client.Run(args[0]) if err != nil { diff --git a/cmd/helm/history.go b/cmd/helm/history.go index 645a1f8df..e79737737 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -19,6 +19,7 @@ package main import ( "fmt" "io" + "os" "strconv" "time" @@ -67,7 +68,7 @@ func newHistoryCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { return compListReleases(toComplete, args, cfg) }, RunE: func(cmd *cobra.Command, args []string) error { - overrideRegistryWriter(cfg, outfmt) + overrideRegistryWriter(cfg, outfmt, os.Stderr) history, err := getHistory(client, args[0]) if err != nil { diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 155753cc9..39f7dc4cc 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -136,7 +136,7 @@ func newInstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { return compInstall(args, toComplete, client) }, RunE: func(_ *cobra.Command, args []string) error { - overrideRegistryWriter(cfg, outfmt) + overrideRegistryWriter(cfg, outfmt, os.Stderr) rel, err := runInstall(args, client, valueOpts, out) if err != nil { diff --git a/cmd/helm/list.go b/cmd/helm/list.go index c7dffd6f3..36281b196 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -70,7 +70,7 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { Args: require.NoArgs, ValidArgsFunction: noCompletions, RunE: func(cmd *cobra.Command, args []string) error { - overrideRegistryWriter(cfg, outfmt) + overrideRegistryWriter(cfg, outfmt, os.Stderr) if client.AllNamespaces { if err := cfg.Init(settings.RESTClientGetter(), "", os.Getenv("HELM_DRIVER"), debug); err != nil { diff --git a/cmd/helm/root.go b/cmd/helm/root.go index 8298296e5..a17a878a7 100644 --- a/cmd/helm/root.go +++ b/cmd/helm/root.go @@ -263,9 +263,9 @@ func checkForExpiredRepos(repofile string) { } -func overrideRegistryWriter(cfg *action.Configuration, outfmt output.Format) { +func overrideRegistryWriter(cfg *action.Configuration, outfmt output.Format, newWriter io.Writer) { // Ensure registry output doesn't break structured output if outfmt != output.Table { - registry.ClientOptWriter(os.Stderr)(cfg.RegistryClient) + registry.ClientOptWriter(newWriter)(cfg.RegistryClient) } } diff --git a/cmd/helm/status.go b/cmd/helm/status.go index a3690c69b..ec040c123 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -21,6 +21,7 @@ import ( "fmt" "io" "log" + "os" "strings" "time" @@ -65,7 +66,7 @@ func newStatusCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { return compListReleases(toComplete, args, cfg) }, RunE: func(cmd *cobra.Command, args []string) error { - overrideRegistryWriter(cfg, outfmt) + overrideRegistryWriter(cfg, outfmt, os.Stderr) // When the output format is a table the resources should be fetched // and displayed as a table. When YAML or JSON the resources will be diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 28444335c..8ee14a7d1 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -66,7 +66,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { return compInstall(args, toComplete, client) }, RunE: func(_ *cobra.Command, args []string) error { - overrideRegistryWriter(cfg, output.YAML) + overrideRegistryWriter(cfg, output.YAML, os.Stderr) if kubeVersion != "" { parsedKubeVersion, err := chartutil.ParseKubeVersion(kubeVersion) diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 9ff74a0b1..f7468f1a9 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -88,7 +88,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { return nil, cobra.ShellCompDirectiveNoFileComp }, RunE: func(cmd *cobra.Command, args []string) error { - overrideRegistryWriter(cfg, outfmt) + overrideRegistryWriter(cfg, outfmt, os.Stderr) client.Namespace = settings.Namespace()