@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
20 lines (19 loc) • 629 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.commandKubeListNamespaces = void 0;
const defineCommand_1 = require("../../core/defineCommand");
const k8sApi_1 = require("../../k8sApi");
exports.commandKubeListNamespaces = (0, defineCommand_1.defineCommand)({
name: "k8s list-namespaces",
description: "list all namespaces",
group: "general",
inputs: {},
execute: async ctx => {
const k8sApi = (0, k8sApi_1.getk8sApi)();
const res = await k8sApi.listNamespace();
const namespaces = res.body.items.map(n => n.metadata.name);
ctx.log(namespaces.join("\n"));
}
});