@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
16 lines (14 loc) • 484 B
text/typescript
import { defineCommand } from "../../core/defineCommand";
import { getk8sApi } from "../../k8sApi";
export const commandKubeListNamespaces = defineCommand({
name: "k8s list-namespaces",
description: "list all namespaces",
group: "general",
inputs: {},
execute: async (ctx) => {
const k8sApi = getk8sApi();
const res = await k8sApi.listNamespace();
const namespaces = res.body.items.map((n: any) => n.metadata.name);
ctx.log(namespaces.join("\n"));
},
});