Detect kubeconfig as known argument in plugin invocations

--kubeconfig is not detected as a known argument on plugin invocations.
This means it depends on the order or arguments if helm picks it up or
not which might not be under users control (for me in case of helmfile
calling "helm diff").

Signed-off-by: Janis Meybohm <jayme-github@users.noreply.github.com>
pull/8561/head
Janis Meybohm 5 years ago
parent 35f1f666f3
commit 657b23f672

@ -128,7 +128,7 @@ func loadPlugins(baseCmd *cobra.Command, out io.Writer) {
func manuallyProcessArgs(args []string) ([]string, []string) { func manuallyProcessArgs(args []string) ([]string, []string) {
known := []string{} known := []string{}
unknown := []string{} unknown := []string{}
kvargs := []string{"--host", "--kube-context", "--home", "--tiller-namespace"} kvargs := []string{"--host", "--kube-context", "--home", "--tiller-namespace", "--kubeconfig"}
knownArg := func(a string) bool { knownArg := func(a string) bool {
for _, pre := range kvargs { for _, pre := range kvargs {
if strings.HasPrefix(a, pre+"=") { if strings.HasPrefix(a, pre+"=") {

@ -34,6 +34,7 @@ func TestManuallyProcessArgs(t *testing.T) {
"--debug", "--debug",
"--foo", "bar", "--foo", "bar",
"--host", "example.com", "--host", "example.com",
"--kubeconfig=/home/foo",
"--kube-context", "test1", "--kube-context", "test1",
"--home=/tmp", "--home=/tmp",
"--tiller-namespace=hello", "--tiller-namespace=hello",
@ -41,7 +42,7 @@ func TestManuallyProcessArgs(t *testing.T) {
} }
expectKnown := []string{ expectKnown := []string{
"--debug", "--host", "example.com", "--kube-context", "test1", "--home=/tmp", "--tiller-namespace=hello", "--debug", "--host", "example.com", "--kubeconfig=/home/foo", "--kube-context", "test1", "--home=/tmp", "--tiller-namespace=hello",
} }
expectUnknown := []string{ expectUnknown := []string{

Loading…
Cancel
Save