From cbcae53e38274b11b0a08759749a8fd886eb8ae5 Mon Sep 17 00:00:00 2001 From: Dan Farrelly Date: Sat, 28 Mar 2020 12:16:22 -0400 Subject: [PATCH] Default to the current context's namespace If a user does not specify the namespace option, use the namespace set in the user's current context. This will provide a more natural behavior for kubectl users. --- lib/interactive/retrieve.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/interactive/retrieve.js b/lib/interactive/retrieve.js index 62d73f5..008edd2 100644 --- a/lib/interactive/retrieve.js +++ b/lib/interactive/retrieve.js @@ -264,9 +264,10 @@ const chooseNextActionWithGivenSecret = (chosenSecret) => { }; const beginWithNamespace = ({ - namespace = 'default', + namespace, }) => { - const kubectlOutput = shell.exec(`kubectl get secrets -n ${namespace} -o json`, { silent: true }); + const options = namespace ? `-n ${namespace}` : '' + const kubectlOutput = shell.exec(`kubectl get secrets ${options} -o json`, { silent: true }); const secrets = processsecret.processSecrets(kubectlOutput); if (secrets.result === 'success') { inq.prompt([