diff --git a/.vscode/settings.json b/.vscode/settings.json index 6763058..01d2b8d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,7 +11,13 @@ }, "gitzone": { "type": "object", - "description": "settings for gitzone" + "description": "settings for gitzone", + "properties": { + "projectType": { + "type": "string", + "enum": ["website", "element", "service", "npm"] + } + } } } } diff --git a/npmextra.json b/npmextra.json index 55c74ea..f46cc68 100644 --- a/npmextra.json +++ b/npmextra.json @@ -1,5 +1,6 @@ { "gitzone": { + "projectType": "npm", "module": { "githost": "gitlab.com", "gitscope": "mojoio", diff --git a/package.json b/package.json index dab6727..d74c2e7 100644 --- a/package.json +++ b/package.json @@ -37,4 +37,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/readme.md b/readme.md index badead7..f27f50e 100644 --- a/readme.md +++ b/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) diff --git a/test/test.ts b/test/test.ts index f175a66..557b671 100644 --- a/test/test.ts +++ b/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(); diff --git a/ts/index.ts b/ts/index.ts index f35cc4a..56a9c25 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1 +1 @@ -export * from './kubernetes.classes.kubeclient'; \ No newline at end of file +export * from './kubernetes.classes.kubeclient'; diff --git a/ts/kubernetes.classes.kubeclient.ts b/ts/kubernetes.classes.kubeclient.ts index a88aeb1..6eda896 100644 --- a/ts/kubernetes.classes.kubeclient.ts +++ b/ts/kubernetes.classes.kubeclient.ts @@ -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() {} } diff --git a/ts/kubernetes.paths.ts b/ts/kubernetes.paths.ts index ac3ab9f..9b31e6d 100644 --- a/ts/kubernetes.paths.ts +++ b/ts/kubernetes.paths.ts @@ -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' +); diff --git a/ts/kubernetes.plugins.ts b/ts/kubernetes.plugins.ts index f03ca36..a7133d7 100644 --- a/ts/kubernetes.plugins.ts +++ b/ts/kubernetes.plugins.ts @@ -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 };