Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function purge(name: string) {
const kc = new KubeConfig();
kc.loadFromDefault();
const coreV1Client: CoreV1Api = kc.makeApiClient(CoreV1Api);
const appsV1Client: AppsV1Api = kc.makeApiClient(AppsV1Api);
const exec: Exec = new Exec(kc);
let { response, body: node } = await coreV1Client.readNode(name);
if (response.statusCode !== 200) {
throw new ReplicatedError(`get node ${name} response: ${response.statusCode}`);
}
({ response } = await coreV1Client.deleteNode(name));
if (response.statusCode !== 200) {
throw new Error(`Delete node returned status code ${response.statusCode}`);
}
await purgeOSD(coreV1Client, appsV1Client, exec, name);
const isMaster = _.has(node.metadata!.labels!, "node-role.kubernetes.io/master");
useFactory: (kc: KubeConfig) => new Exec(kc),
inject: [KubeConfig],