fix(core): update
This commit is contained in:
parent
33d7b30b65
commit
e8d89d32dc
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@ -11,7 +11,13 @@
|
||||
},
|
||||
"gitzone": {
|
||||
"type": "object",
|
||||
"description": "settings for gitzone"
|
||||
"description": "settings for gitzone",
|
||||
"properties": {
|
||||
"projectType": {
|
||||
"type": "string",
|
||||
"enum": ["website", "element", "service", "npm"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"gitzone": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "mojoio",
|
||||
|
@ -37,4 +37,4 @@
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
]
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ a simmplified kubernetes api abstraction
|
||||
* [docs (typedoc)](https://mojoio.gitlab.io/kubernetes/)
|
||||
|
||||
## Status for master
|
||||
[![build status](https://gitlab.com/mojoio/kubernetes/badges/master/build.svg)](https://gitlab.com/mojoio/kubernetes/commits/master)
|
||||
[![pipeline status](https://gitlab.com/mojoio/kubernetes/badges/master/pipeline.svg)](https://gitlab.com/mojoio/kubernetes/commits/master)
|
||||
[![coverage report](https://gitlab.com/mojoio/kubernetes/badges/master/coverage.svg)](https://gitlab.com/mojoio/kubernetes/commits/master)
|
||||
[![npm downloads per month](https://img.shields.io/npm/dm/@mojoio/kubernetes.svg)](https://www.npmjs.com/package/@mojoio/kubernetes)
|
||||
[![Known Vulnerabilities](https://snyk.io/test/npm/@mojoio/kubernetes/badge.svg)](https://snyk.io/test/npm/@mojoio/kubernetes)
|
||||
|
10
test/test.ts
10
test/test.ts
@ -13,7 +13,7 @@ tap.test('first test', async () => {
|
||||
|
||||
tap.test('should init the client', async () => {
|
||||
await testClient.init();
|
||||
})
|
||||
});
|
||||
|
||||
tap.test('should be able to set a certificate', async () => {
|
||||
await testClient.setSslSecret('central.eu', {
|
||||
@ -23,12 +23,12 @@ tap.test('should be able to set a certificate', async () => {
|
||||
id: 'hu7e6rw',
|
||||
privateKey: 'wowza',
|
||||
publicKey: 'hellothere'
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
tap.test('should get a secret', async () => {
|
||||
const result = await testClient.getSslSecret('central.eu')
|
||||
const result = await testClient.getSslSecret('central.eu');
|
||||
console.log(result);
|
||||
})
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -1 +1 @@
|
||||
export * from './kubernetes.classes.kubeclient';
|
||||
export * from './kubernetes.classes.kubeclient';
|
||||
|
@ -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() {}
|
||||
}
|
||||
|
@ -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'
|
||||
);
|
||||
|
@ -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 };
|
||||
|
Loading…
Reference in New Issue
Block a user