fix(core): update

This commit is contained in:
2020-01-25 18:52:46 +00:00
parent 33d7b30b65
commit e8d89d32dc
9 changed files with 50 additions and 42 deletions

View File

@ -1 +1 @@
export * from './kubernetes.classes.kubeclient';
export * from './kubernetes.classes.kubeclient';

View File

@ -4,28 +4,29 @@ import * as paths from './kubernetes.paths';
export class KubeClient {
public client: plugins.kubectl.ApiRoot;
constructor() {};
constructor() {}
public async init () {
const { KubeConfig } = require('kubernetes-client')
const kubeconfig = new KubeConfig()
public async init() {
const { KubeConfig } = require('kubernetes-client');
const kubeconfig = new KubeConfig();
kubeconfig.loadFromFile(paths.defaultKubeConfigPath);
const Request = require('kubernetes-client/backends/request');
const backend = new Request({ kubeconfig });
this.client = new plugins.kubectl.Client1_13({ backend, version: '1.13' });
}
public async setRegistry () {
}
public async setRegistry() {}
/**
* sets an ssl secret
* @param domainNameArg
* @param sslCertificateArg
* @param domainNameArg
* @param sslCertificateArg
*/
public async setSslSecret (domainNameArg: string, sslCertificateArg: plugins.tsclass.network.ICert) {
public async setSslSecret(
domainNameArg: string,
sslCertificateArg: plugins.tsclass.network.ICert
) {
this.client.api.v1.namespace('default').secret.post({
body: {
apiVersion: 'v1',
@ -39,24 +40,30 @@ export class KubeClient {
'tls.key': plugins.smartstring.base64.encode(sslCertificateArg.privateKey)
}
}
})
});
}
public async getSslSecret (domainNameArg: string) {
this.client.api.v1.namespace('default').secrets(domainNameArg).get();
public async getSslSecret(domainNameArg: string) {
this.client.api.v1
.namespace('default')
.secrets(domainNameArg)
.get();
}
/**
* removes an ssl secret
* @param domainName
*/
public async removeSslSecret (domainName: string) {
this.client.api.v1.namespace('default').secrets(domainName).delete();
public async removeSslSecret(domainName: string) {
this.client.api.v1
.namespace('default')
.secrets(domainName)
.delete();
}
public async setService () {}
public async setService() {}
public async deleteService () {}
public async deleteService() {}
public async installIngress () {}
public async installIngress() {}
}

View File

@ -1,3 +1,6 @@
import * as plugins from './kubernetes.plugins';
export const defaultKubeConfigPath = plugins.path.join(plugins.smartpath.get.home(), '.kube/config')
export const defaultKubeConfigPath = plugins.path.join(
plugins.smartpath.get.home(),
'.kube/config'
);

View File

@ -1,29 +1,20 @@
// node native scope
import * as path from 'path';
export {
path
}
export { path };
// tsclass scope
import * as tsclass from '@tsclass/tsclass';
export {
tsclass
}
export { tsclass };
// pushrocks scope
import * as smartpath from '@pushrocks/smartpath';
import * as smartstring from '@pushrocks/smartstring';
export {
smartpath,
smartstring
}
export { smartpath, smartstring };
// third party scope
import * as kubeclient from 'kubernetes-client';
export {
kubeclient as kubectl
};
export { kubeclient as kubectl };