@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
36 lines (35 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.commandKubeGetShell = void 0;
const defineCommand_1 = require("../../core/defineCommand");
const k8sApi_1 = require("../../k8sApi");
const shell_1 = require("../../utils/shell");
exports.commandKubeGetShell = (0, defineCommand_1.defineCommand)({
name: "k8s get-shell",
description: "get a shell to a pod in the environment",
group: "general",
inputs: {
namespace: {
type: "string",
message: "kubernetes namespace",
positional: true
},
podName: {
type: "string",
message: "Which pod? 🤔",
choices: async ctx => {
const namespace = await ctx.get("namespace");
const k8sApi = (0, k8sApi_1.getk8sApi)();
const res = await k8sApi.listNamespacedPod(namespace);
return res.body.items.map(i => i.metadata.name);
}
}
},
execute: async ctx => {
const namespace = await ctx.get("namespace");
const podName = await ctx.get("podName");
await (0, shell_1.getShell)(namespace, podName);
}
});