Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x | import { defineCommand } from '../../lib/define-command.js';
import { isK8sClusterActive, k8sAddPersistentStorage } from '../../lib/k8s.js';
import { styleText } from '../../lib/style-text.js';
import { Logger } from '../../logger.js';
import { orgaIdOrNameOption } from '../global.options.js';
import { k8sIdOrNameArg } from './k8s.args.js';
export const k8sAddPersistentStorageCommand = defineCommand({
description: 'Activate persistent storage to a deployed Kubernetes cluster',
since: '4.3.0',
options: {
org: orgaIdOrNameOption,
},
args: [k8sIdOrNameArg],
async handler(options, clusterIdOrName) {
const orgIdOrName = options.org;
if ((await isK8sClusterActive(orgIdOrName, clusterIdOrName)) === false) {
Logger.printInfo(
'Persistent storage can only be added to deployed clusters, wait for the deployment to finish and try again',
);
const orgMessageComplement = orgIdOrName ? `--org "${orgIdOrName.orga_id || orgIdOrName.orga_name}"` : '';
Logger.println(
`Check with ${styleText('blue', `clever k8s get ${clusterIdOrName.addon_name || clusterIdOrName.operator_id} ${orgMessageComplement}`)}`,
);
return;
}
try {
await k8sAddPersistentStorage(orgIdOrName, clusterIdOrName);
Logger.printSuccess(
`Persistent storage successfully activated on cluster ${styleText('green', clusterIdOrName.addon_name || clusterIdOrName.operator_id)}`,
);
} catch (error) {
Logger.error("Failed to add persistent storage, check if it's not already activated");
}
},
});
|