Skip to content

Commit

Permalink
Fix namespace on kubeconfig error
Browse files Browse the repository at this point in the history
Signed-off-by: Calvin Krist <calvin.krist@yahoo.com>
  • Loading branch information
CalvinKrist committed Apr 24, 2024
1 parent 14d0c13 commit 14b80f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/cli/environment.go
Expand Up @@ -244,6 +244,9 @@ func (s *EnvSettings) Namespace() string {
if ns, _, err := s.config.ToRawKubeConfigLoader().Namespace(); err == nil {
return ns
}
if s.namespace != "" {
return s.namespace
}
return "default"
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/cli/environment_test.go
Expand Up @@ -111,6 +111,14 @@ func TestEnvSettings(t *testing.T) {
kubeTLSServer: "example.org",
kubeInsecure: true,
},
{
name: "invalid kubeconfig",
ns: "testns",
envvars: map[string]string{"HELM_KUBECONTEXT": "/path/to/fake/variable"},
maxhistory: defaultMaxHistory,
burstLimit: defaultBurstLimit,
qps: defaultQPS,
},
}

for _, tt := range tests {
Expand Down

0 comments on commit 14b80f1

Please sign in to comment.