diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 4dcb17617..00933e03c 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -65,14 +65,20 @@ func initKubeLogs() { func main() { initKubeLogs() - cmd := newRootCmd(newActionConfig(false), os.Stdout, os.Args[1:]) + + actionConfig := new(action.Configuration) + cmd := newRootCmd(actionConfig, os.Stdout, os.Args[1:]) + + // Initialize the rest of the actionConfig + initActionConfig(actionConfig, false) + if err := cmd.Execute(); err != nil { logf("%+v", err) os.Exit(1) } } -func newActionConfig(allNamespaces bool) *action.Configuration { +func initActionConfig(actionConfig *action.Configuration, allNamespaces bool) { kc := kube.New(kubeConfig()) kc.Log = logf @@ -104,12 +110,10 @@ func newActionConfig(allNamespaces bool) *action.Configuration { panic("Unknown driver in HELM_DRIVER: " + os.Getenv("HELM_DRIVER")) } - return &action.Configuration{ - RESTClientGetter: kubeConfig(), - KubeClient: kc, - Releases: store, - Log: logf, - } + actionConfig.RESTClientGetter = kubeConfig() + actionConfig.KubeClient = kc + actionConfig.Releases = store + actionConfig.Log = logf } func kubeConfig() genericclioptions.RESTClientGetter { diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 02000ca1d..119fcac01 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -64,7 +64,7 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { Args: require.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { if client.AllNamespaces { - client.SetConfiguration(newActionConfig(true)) + initActionConfig(cfg, true) } client.SetStateMask()