How to use the @kubernetes/client-node.Exec function in @kubernetes/client-node

To help you get started, we’ve selected a few @kubernetes/client-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github replicatedhq / kots / kotsadm / api / src / kurl / resolvers / kurl_mutations.ts View on Github external
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");
github ForetagInc / fullstack-ts-boilerplate / apps / api / src / app / common.module.ts View on Github external
      useFactory: (kc: KubeConfig) => new Exec(kc),
      inject: [KubeConfig],