🌳
pt0/deployF/k8sF/cliF/k8sCliBaseF.mts
1import * as _ from 'lodash-es'
8const getEpdepsLines = () => {
9 const appCfg = getAppCfg()
10 if (!appCfg) return []
11 const { dbQsCfg } = appCfg as {dbQsCfg?: {dbQsName?: string}}
12 const dbQsName = dbQsCfg?.dbQsName
13 if (!dbQsName) return []
15 const dbEps = getDbEntrypointsByQsName(dbQsName)
16 if (dbEps.length === 0) return []
18 return [
19 '',
20 chalkCyan(`Database (${dbQsName}):`),
21 ..._.map(dbEps, ep => ` ${ep.regEpPath}`)
22 ]
25export const k8sBuiltinActions = {
26 apply: { cliDescript: 'deploy to k8s', cliSchema: applyCli },
27 delete: { cliDescript: 'kubectl delete -f [action=resources] ( excludes pvcs for safety see delpvcs )' },
28 info: { cliDescript: 'show k8s resources & debug info' },
29 help: { cliDescript: '[action] may show more help' },
30 fexec: { cliDescript: 'shell into first pod' },
33export const k8sCliBase = (opts?: Record<string, unknown>) => cliBase({
34 ...opts,
35 builtinActions: k8sBuiltinActions,
36 getExtraHelpLines: getEpdepsLines,
37} as unknown as Parameters<typeof cliBase>[0])