From eb52aa2b5d64fa3295a96305c8c8ae166097b050 Mon Sep 17 00:00:00 2001
From: Ergin Babani <ebabani@gmail.com>
Date: Tue, 15 Aug 2017 01:19:33 -0400
Subject: [PATCH] 'helm upgrade --install' uses the namespace from kube config.

Use the current kube config namespace by default if --namespace is not specified.
This makes 'helm upgrade --install' and 'helm install' handle namespaces
the same way.
---
 cmd/helm/install.go | 2 +-
 cmd/helm/upgrade.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmd/helm/install.go b/cmd/helm/install.go
index b480b0b93..324f68c89 100644
--- a/cmd/helm/install.go
+++ b/cmd/helm/install.go
@@ -177,7 +177,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command {
 	f := cmd.Flags()
 	f.VarP(&inst.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)")
 	f.StringVarP(&inst.name, "name", "n", "", "release name. If unspecified, it will autogenerate one for you")
-	f.StringVar(&inst.namespace, "namespace", "", "namespace to install the release into")
+	f.StringVar(&inst.namespace, "namespace", "", "namespace to install the release into. Defaults to the current kube config namespace.")
 	f.BoolVar(&inst.dryRun, "dry-run", false, "simulate an install")
 	f.BoolVar(&inst.disableHooks, "no-hooks", false, "prevent hooks from running during install")
 	f.BoolVar(&inst.replace, "replace", false, "re-use the given name, even if that name is already used. This is unsafe in production")
diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go
index 989d73cdd..4b852198a 100644
--- a/cmd/helm/upgrade.go
+++ b/cmd/helm/upgrade.go
@@ -121,7 +121,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command {
 	f.BoolVar(&upgrade.verify, "verify", false, "verify the provenance of the chart before upgrading")
 	f.StringVar(&upgrade.keyring, "keyring", defaultKeyring(), "path to the keyring that contains public signing keys")
 	f.BoolVarP(&upgrade.install, "install", "i", false, "if a release by this name doesn't already exist, run an install")
-	f.StringVar(&upgrade.namespace, "namespace", "default", "namespace to install the release into (only used if --install is set)")
+	f.StringVar(&upgrade.namespace, "namespace", "", "namespace to install the release into (only used if --install is set). Defaults to the current kube config namespace")
 	f.StringVar(&upgrade.version, "version", "", "specify the exact chart version to use. If this is not specified, the latest version is used")
 	f.Int64Var(&upgrade.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
 	f.BoolVar(&upgrade.resetValues, "reset-values", false, "when upgrading, reset the values to the ones built into the chart")
-- 
GitLab