Skip to content

Commit

Permalink
renamed k8.getCurrentContextObject to k8.getCurrentContextNamespace
Browse files Browse the repository at this point in the history
Signed-off-by: Jeromy Cannon <[email protected]>
  • Loading branch information
jeromy-cannon committed Jan 29, 2025
1 parent f51fe08 commit 69f95cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/core/k8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1730,8 +1730,8 @@ export class K8 {
return this.kubeConfig.getCurrentContext();
}

public getCurrentContextObject(): Context {
return this.kubeConfig.getContextObject(this.getCurrentContext());
public getCurrentContextNamespace(): Namespace {
return this.kubeConfig.getContextObject(this.getCurrentContext())?.namespace;
}

public getCurrentClusterName(): string {
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function main(argv: any) {

// set cluster and namespace in the global configManager from kubernetes context
// so that we don't need to prompt the user
const context = k8.getCurrentContextObject();
const contextNamespace = k8.getCurrentContextNamespace();
const currentClusterName = k8.getCurrentClusterName();

const opts: Opts = {
Expand Down Expand Up @@ -106,8 +106,8 @@ export function main(argv: any) {

const clusterName = configManager.getFlag(flags.clusterName) || currentClusterName;

if (context.namespace) {
configManager.setFlag(flags.namespace, context.namespace);
if (contextNamespace) {
configManager.setFlag(flags.namespace, contextNamespace);
}

// apply precedence for flags
Expand Down

0 comments on commit 69f95cd

Please sign in to comment.