Compare commits

..

No commits in common. "master" and "v1.0.9" have entirely different histories.

10 changed files with 43 additions and 55 deletions

View File

@ -11,13 +11,7 @@
}, },
"gitzone": { "gitzone": {
"type": "object", "type": "object",
"description": "settings for gitzone", "description": "settings for gitzone"
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
}
}
} }
} }
} }

View File

@ -1,6 +1,5 @@
{ {
"gitzone": { "gitzone": {
"projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "mojoio", "gitscope": "mojoio",

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@mojoio/kubernetes", "name": "@mojoio/kubernetes",
"version": "1.0.12", "version": "1.0.9",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@mojoio/kubernetes", "name": "@mojoio/kubernetes",
"version": "1.0.12", "version": "1.0.9",
"private": false, "private": false,
"description": "a simmplified kubernetes api abstraction", "description": "a simmplified kubernetes api abstraction",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -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
[![pipeline status](https://gitlab.com/mojoio/kubernetes/badges/master/pipeline.svg)](https://gitlab.com/mojoio/kubernetes/commits/master) [![build status](https://gitlab.com/mojoio/kubernetes/badges/master/build.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)

View File

@ -3,17 +3,13 @@ import * as kubernetes from '../ts/index';
let testClient: kubernetes.KubeClient; let testClient: kubernetes.KubeClient;
if (process.env.CI) {
process.exit(0);
}
tap.test('first test', async () => { tap.test('first test', async () => {
testClient = new kubernetes.KubeClient(); testClient = new kubernetes.KubeClient();
}); });
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 +19,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();

View File

@ -4,11 +4,11 @@ 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');
@ -16,17 +16,16 @@ export class KubeClient {
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( public async setSslSecret (domainNameArg: string, sslCertificateArg: plugins.tsclass.network.ICert) {
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',
@ -40,30 +39,24 @@ 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 this.client.api.v1.namespace('default').secrets(domainNameArg).get();
.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 this.client.api.v1.namespace('default').secrets(domainName).delete();
.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,6 +1,3 @@
import * as plugins from './kubernetes.plugins'; import * as plugins from './kubernetes.plugins';
export const defaultKubeConfigPath = plugins.path.join( export const defaultKubeConfigPath = plugins.path.join(plugins.smartpath.get.home(), '.kube/config')
plugins.smartpath.get.home(),
'.kube/config'
);

View File

@ -1,20 +1,29 @@
// node native scope // node native scope
import * as path from 'path'; import * as path from 'path';
export { path }; export {
path
}
// tsclass scope // tsclass scope
import * as tsclass from '@tsclass/tsclass'; import * as tsclass from '@tsclass/tsclass';
export { tsclass }; export {
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 { smartpath, smartstring }; export {
smartpath,
smartstring
}
// third party scope // third party scope
import * as kubeclient from 'kubernetes-client'; import * as kubeclient from 'kubernetes-client';
export { kubeclient as kubectl }; export {
kubeclient as kubectl
};