2020-01-18 17:33:57 +00:00
|
|
|
import * as plugins from './kubernetes.plugins';
|
|
|
|
|
|
|
|
export class KubeClient {
|
2020-01-18 18:47:46 +00:00
|
|
|
public client: plugins.kubectl.ApiRoot;
|
2020-01-18 17:33:57 +00:00
|
|
|
|
2020-01-18 18:47:46 +00:00
|
|
|
constructor() {};
|
|
|
|
|
|
|
|
public async init () {
|
|
|
|
const { KubeConfig } = require('kubernetes-client')
|
|
|
|
const kubeconfig = new KubeConfig()
|
|
|
|
kubeconfig.loadFromFile('~/some/path');
|
|
|
|
const Request = require('kubernetes-client/backends/request');
|
|
|
|
|
|
|
|
const backend = new Request({ kubeconfig });
|
|
|
|
this.client = new plugins.kubectl.Client1_13({ backend, version: '1.13' })
|
|
|
|
}
|
2020-01-18 17:33:57 +00:00
|
|
|
}
|