Skip to content

Commit

Permalink
fix(plugins/plugin-kubectl): windows powershell fails to get default …
Browse files Browse the repository at this point in the history
…namespace

Fixes #4912
  • Loading branch information
starpit committed Jun 18, 2020
1 parent 168b84a commit 120ae5b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/plugin-kubectl/src/controller/kubectl/contexts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ export async function getCurrentContextName({ REPL }: { REPL: REPLType }) {

/** Extract the namespace from the current context */
export async function getCurrentDefaultNamespace({ REPL }: { REPL: REPLType }) {
const ns = await REPL.qexec<string>(`kubectl config view --minify --output 'jsonpath={..namespace}'`)
const ns = await REPL.qexec<string>(`kubectl config view --minify --output "jsonpath={..namespace}"`).catch(err => {
console.error('error determining default namespace', err)
return 'default'
})

if (typeof ns !== 'string') {
// e.g. microk8s
return 'default'
Expand Down

0 comments on commit 120ae5b

Please sign in to comment.