Skip to content

Commit

Permalink
fix: set namespace to kubectl context after cluster create (#521)
Browse files Browse the repository at this point in the history
Signed-off-by: Lenin Mehedy <[email protected]>
  • Loading branch information
leninmehedy authored Nov 10, 2023
1 parent 9883fa7 commit 803ee4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fullstack-network-manager/src/commands/cluster.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class ClusterCommand extends BaseCommand {
this.logger.showUser(chalk.green('OK'), `namespace '${namespace}' already exists`)
}

// TODO: kubectl config set-context --current --namespace="${NAMESPACE}"
await this.kubectl.config(`set-context --current --namespace="${namespace}"`)

this.showList("namespaces", await this.getNameSpaces())

Expand Down
9 changes: 9 additions & 0 deletions fullstack-network-manager/src/core/kubectl.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,13 @@ export class Kubectl extends ShellRunner {
async copy(pod, ...args) {
return this.run(this.prepareCommand('cp', ...args))
}

/**
* Invoke `kubectl config` command
* @param args args of the command
* @returns {Promise<Array>} console output as an array of strings
*/
async config(...args) {
return this.run(this.prepareCommand('config', ...args))
}
}

0 comments on commit 803ee4b

Please sign in to comment.