From 8a2516fcc1641e77f7451bf09e09df687933adc8 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Fri, 16 Dec 2016 20:43:30 -0800 Subject: [PATCH 1/2] fix(helm): add tiller-host to plugin environment --- cmd/helm/plugins.go | 5 +++-- cmd/helm/plugins_test.go | 13 ++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/helm/plugins.go b/cmd/helm/plugins.go index af3848379..608886997 100644 --- a/cmd/helm/plugins.go +++ b/cmd/helm/plugins.go @@ -112,7 +112,7 @@ func loadPlugins(baseCmd *cobra.Command, home helmpath.Home, out io.Writer) { func manuallyProcessArgs(args []string) ([]string, []string) { known := []string{} unknown := []string{} - kvargs := []string{"--host", "--kube-context", "--home"} + kvargs := []string{"--host", "--kube-context", "--home", "--tiller-namespace"} knownArg := func(a string) bool { for _, pre := range kvargs { if strings.HasPrefix(a, pre+"=") { @@ -175,7 +175,8 @@ func setupEnv(shortname, base, plugdirs string, home helmpath.Home) { "HELM_PATH_LOCAL_REPOSITORY": home.LocalRepository(), "HELM_PATH_STARTER": home.Starters(), - "TILLER_HOST": tillerHost, + "TILLER_HOST": tillerHost, + tillerNamespaceEnvVar: tillerNamespace, } { os.Setenv(key, val) } diff --git a/cmd/helm/plugins_test.go b/cmd/helm/plugins_test.go index 471f2370f..4d2eaa9a8 100644 --- a/cmd/helm/plugins_test.go +++ b/cmd/helm/plugins_test.go @@ -31,18 +31,16 @@ import ( func TestManuallyProcessArgs(t *testing.T) { input := []string{ "--debug", - "--foo", - "bar", - "--host", - "example.com", - "--kube-context", - "test1", + "--foo", "bar", + "--host", "example.com", + "--kube-context", "test1", "--home=/tmp", + "--tiller-namespace=hello", "command", } expectKnown := []string{ - "--debug", "--host", "example.com", "--kube-context", "test1", "--home=/tmp", + "--debug", "--host", "example.com", "--kube-context", "test1", "--home=/tmp", "--tiller-namespace=hello", } expectUnknown := []string{ @@ -162,6 +160,7 @@ func TestSetupEnv(t *testing.T) { {"HELM_PATH_LOCAL_REPOSITORY", hh.LocalRepository()}, {"HELM_PATH_STARTER", hh.Starters()}, {"TILLER_HOST", tillerHost}, + {"TILLER_NAMESPACE", tillerNamespace}, } { if got := os.Getenv(tt.name); got != tt.expect { t.Errorf("Expected $%s=%q, got %q", tt.name, tt.expect, got) From 5961cc44b3a0811509313d0668f0c6574b3a69d6 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Fri, 16 Dec 2016 20:51:25 -0800 Subject: [PATCH 2/2] fix(helm): fix persistent flags not being parsed --- cmd/helm/plugins.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/plugins.go b/cmd/helm/plugins.go index 608886997..8ffeb788d 100644 --- a/cmd/helm/plugins.go +++ b/cmd/helm/plugins.go @@ -63,7 +63,7 @@ func loadPlugins(baseCmd *cobra.Command, home helmpath.Home, out io.Writer) { RunE: func(cmd *cobra.Command, args []string) error { k, u := manuallyProcessArgs(args) - if err := cmd.ParseFlags(k); err != nil { + if err := cmd.Parent().ParseFlags(k); err != nil { return err }