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": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
}
}
"description": "settings for gitzone"
}
}
}

View File

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

2
package-lock.json generated
View File

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

View File

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

View File

@ -8,7 +8,7 @@ a simmplified kubernetes api abstraction
* [docs (typedoc)](https://mojoio.gitlab.io/kubernetes/)
## 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)
[![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)

View File

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

View File

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

View File

@ -4,29 +4,28 @@ 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',
@ -40,30 +39,24 @@ 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,6 +1,3 @@
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,20 +1,29 @@
// 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
};