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": {
|
"gitzone": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"description": "settings for gitzone"
|
"description": "settings for gitzone",
|
||||||
|
"properties": {
|
||||||
|
"projectType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["website", "element", "service", "npm"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"gitzone": {
|
"gitzone": {
|
||||||
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "mojoio",
|
"gitscope": "mojoio",
|
||||||
|
@ -37,4 +37,4 @@
|
|||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -8,7 +8,7 @@ a simmplified kubernetes api abstraction
|
|||||||
* [docs (typedoc)](https://mojoio.gitlab.io/kubernetes/)
|
* [docs (typedoc)](https://mojoio.gitlab.io/kubernetes/)
|
||||||
|
|
||||||
## Status for master
|
## 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)
|
[![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)
|
[![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)
|
[![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 () => {
|
tap.test('should init the client', async () => {
|
||||||
await testClient.init();
|
await testClient.init();
|
||||||
})
|
});
|
||||||
|
|
||||||
tap.test('should be able to set a certificate', async () => {
|
tap.test('should be able to set a certificate', async () => {
|
||||||
await testClient.setSslSecret('central.eu', {
|
await testClient.setSslSecret('central.eu', {
|
||||||
@ -23,12 +23,12 @@ tap.test('should be able to set a certificate', async () => {
|
|||||||
id: 'hu7e6rw',
|
id: 'hu7e6rw',
|
||||||
privateKey: 'wowza',
|
privateKey: 'wowza',
|
||||||
publicKey: 'hellothere'
|
publicKey: 'hellothere'
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
tap.test('should get a secret', async () => {
|
tap.test('should get a secret', async () => {
|
||||||
const result = await testClient.getSslSecret('central.eu')
|
const result = await testClient.getSslSecret('central.eu');
|
||||||
console.log(result);
|
console.log(result);
|
||||||
})
|
});
|
||||||
|
|
||||||
tap.start();
|
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 {
|
export class KubeClient {
|
||||||
public client: plugins.kubectl.ApiRoot;
|
public client: plugins.kubectl.ApiRoot;
|
||||||
|
|
||||||
constructor() {};
|
constructor() {}
|
||||||
|
|
||||||
public async init () {
|
public async init() {
|
||||||
const { KubeConfig } = require('kubernetes-client')
|
const { KubeConfig } = require('kubernetes-client');
|
||||||
const kubeconfig = new KubeConfig()
|
const kubeconfig = new KubeConfig();
|
||||||
kubeconfig.loadFromFile(paths.defaultKubeConfigPath);
|
kubeconfig.loadFromFile(paths.defaultKubeConfigPath);
|
||||||
const Request = require('kubernetes-client/backends/request');
|
const Request = require('kubernetes-client/backends/request');
|
||||||
|
|
||||||
const backend = new Request({ kubeconfig });
|
const backend = new Request({ kubeconfig });
|
||||||
this.client = new plugins.kubectl.Client1_13({ backend, version: '1.13' });
|
this.client = new plugins.kubectl.Client1_13({ backend, version: '1.13' });
|
||||||
}
|
}
|
||||||
|
|
||||||
public async setRegistry () {
|
public async setRegistry() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets an ssl secret
|
* sets an ssl secret
|
||||||
* @param domainNameArg
|
* @param domainNameArg
|
||||||
* @param sslCertificateArg
|
* @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({
|
this.client.api.v1.namespace('default').secret.post({
|
||||||
body: {
|
body: {
|
||||||
apiVersion: 'v1',
|
apiVersion: 'v1',
|
||||||
@ -39,24 +40,30 @@ export class KubeClient {
|
|||||||
'tls.key': plugins.smartstring.base64.encode(sslCertificateArg.privateKey)
|
'tls.key': plugins.smartstring.base64.encode(sslCertificateArg.privateKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getSslSecret (domainNameArg: string) {
|
public async getSslSecret(domainNameArg: string) {
|
||||||
this.client.api.v1.namespace('default').secrets(domainNameArg).get();
|
this.client.api.v1
|
||||||
|
.namespace('default')
|
||||||
|
.secrets(domainNameArg)
|
||||||
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* removes an ssl secret
|
* removes an ssl secret
|
||||||
* @param domainName
|
* @param domainName
|
||||||
*/
|
*/
|
||||||
public async removeSslSecret (domainName: string) {
|
public async removeSslSecret(domainName: string) {
|
||||||
this.client.api.v1.namespace('default').secrets(domainName).delete();
|
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';
|
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
|
// node native scope
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export {
|
export { path };
|
||||||
path
|
|
||||||
}
|
|
||||||
|
|
||||||
// tsclass scope
|
// tsclass scope
|
||||||
import * as tsclass from '@tsclass/tsclass';
|
import * as tsclass from '@tsclass/tsclass';
|
||||||
|
|
||||||
export {
|
export { tsclass };
|
||||||
tsclass
|
|
||||||
}
|
|
||||||
|
|
||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
import * as smartpath from '@pushrocks/smartpath';
|
import * as smartpath from '@pushrocks/smartpath';
|
||||||
import * as smartstring from '@pushrocks/smartstring';
|
import * as smartstring from '@pushrocks/smartstring';
|
||||||
|
|
||||||
export {
|
export { smartpath, smartstring };
|
||||||
smartpath,
|
|
||||||
smartstring
|
|
||||||
}
|
|
||||||
|
|
||||||
// third party scope
|
// third party scope
|
||||||
import * as kubeclient from 'kubernetes-client';
|
import * as kubeclient from 'kubernetes-client';
|
||||||
|
|
||||||
export {
|
export { kubeclient as kubectl };
|
||||||
kubeclient as kubectl
|
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user