@webda/kubernetes 4.0.0-beta.2 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -0
- package/lib/cron.d.ts +2 -3
- package/lib/cron.d.ts.map +1 -1
- package/lib/cron.js +3 -3
- package/lib/cron.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/services/cronexporter.service.d.ts +26 -0
- package/lib/services/cronexporter.service.d.ts.map +1 -0
- package/lib/services/cronexporter.service.js +130 -0
- package/lib/services/cronexporter.service.js.map +1 -0
- package/lib/services/{kuberunner.d.ts → kuberunner.service.d.ts} +22 -10
- package/lib/services/kuberunner.service.d.ts.map +1 -0
- package/lib/services/{kuberunner.js → kuberunner.service.js} +21 -20
- package/lib/services/kuberunner.service.js.map +1 -0
- package/lib/utils/client.d.ts +9 -5
- package/lib/utils/client.d.ts.map +1 -1
- package/lib/utils/client.js +7 -6
- package/lib/utils/client.js.map +1 -1
- package/package.json +32 -43
- package/webda.module.json +194 -186
- package/lib/cron.spec.d.ts +0 -2
- package/lib/cron.spec.d.ts.map +0 -1
- package/lib/cron.spec.js +0 -38
- package/lib/cron.spec.js.map +0 -1
- package/lib/services/kuberunner.d.ts.map +0 -1
- package/lib/services/kuberunner.js.map +0 -1
- package/lib/services/kuberunner.spec.d.ts +0 -2
- package/lib/services/kuberunner.spec.d.ts.map +0 -1
- package/lib/services/kuberunner.spec.js +0 -116
- package/lib/services/kuberunner.spec.js.map +0 -1
- package/lib/shell.d.ts +0 -13
- package/lib/shell.d.ts.map +0 -1
- package/lib/shell.js +0 -53
- package/lib/shell.js.map +0 -1
- package/lib/utils/client.spec.d.ts +0 -2
- package/lib/utils/client.spec.d.ts.map +0 -1
- package/lib/utils/client.spec.js +0 -37
- package/lib/utils/client.spec.js.map +0 -1
- package/webda.shell.json +0 -10
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import * as assert from "assert";
|
|
8
|
-
import { suite, test } from "@testdeck/mocha";
|
|
9
|
-
import { WebdaTest } from "@webda/core/lib/test.js";
|
|
10
|
-
import KubeRunner from "./kuberunner.js";
|
|
11
|
-
import { AsyncAction } from "@webda/async";
|
|
12
|
-
import { stub } from "sinon";
|
|
13
|
-
let KubeRunnerTest = class KubeRunnerTest extends WebdaTest {
|
|
14
|
-
cov() {
|
|
15
|
-
assert.throws(() => new KubeRunner(this.webda, "runner", {}), /Either jobImage or jobResources need/);
|
|
16
|
-
}
|
|
17
|
-
loadResource() {
|
|
18
|
-
const runner = new KubeRunner(this.webda, "runner", { jobResources: "./test/resource-fake.yml" });
|
|
19
|
-
runner.resolve();
|
|
20
|
-
assert.deepStrictEqual(runner.getParameters().jobResources, { fake: true });
|
|
21
|
-
}
|
|
22
|
-
getJobInfo(action) {
|
|
23
|
-
return {
|
|
24
|
-
JOB_HOOK: "hook",
|
|
25
|
-
JOB_ID: "uuid",
|
|
26
|
-
JOB_ORCHESTRATOR: "test",
|
|
27
|
-
JOB_SECRET_KEY: "mykey"
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
async launchAction() {
|
|
31
|
-
const runner = new KubeRunner(this.webda, "runner", { jobImage: "webda.io/runner" });
|
|
32
|
-
runner.resolve();
|
|
33
|
-
const kube = stub(runner.client, "create").returns({
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
body: {
|
|
36
|
-
spec: true,
|
|
37
|
-
metadata: "fake",
|
|
38
|
-
apiVersion: "1.0",
|
|
39
|
-
kind: "Job"
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
const action = new AsyncAction();
|
|
43
|
-
try {
|
|
44
|
-
let result = await runner.launchAction(action, this.getJobInfo(action));
|
|
45
|
-
assert.deepStrictEqual(result, {
|
|
46
|
-
metadata: "fake",
|
|
47
|
-
apiVersion: "1.0",
|
|
48
|
-
kind: "Job"
|
|
49
|
-
});
|
|
50
|
-
const envs = [
|
|
51
|
-
{ name: "JOB_HOOK", value: "hook" },
|
|
52
|
-
{ name: "JOB_ID", value: "uuid" },
|
|
53
|
-
{ name: "JOB_ORCHESTRATOR", value: "test" },
|
|
54
|
-
{ name: "JOB_SECRET_KEY", value: "mykey" }
|
|
55
|
-
];
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
assert.deepStrictEqual(kube.getCall(0).args[0].spec.template.spec.containers[0].env, envs);
|
|
58
|
-
kube.resetHistory();
|
|
59
|
-
runner.getParameters().jobResources = {
|
|
60
|
-
spec: {
|
|
61
|
-
template: {
|
|
62
|
-
spec: {
|
|
63
|
-
containers: [
|
|
64
|
-
{},
|
|
65
|
-
{
|
|
66
|
-
env: [
|
|
67
|
-
{
|
|
68
|
-
name: "TEST",
|
|
69
|
-
value: "test"
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
result = await runner.launchAction(action, this.getJobInfo(action));
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
assert.deepStrictEqual(kube.getCall(0).args[0].spec.template.spec.containers[0].env, envs);
|
|
81
|
-
// @ts-ignore
|
|
82
|
-
assert.deepStrictEqual(kube.getCall(0).args[0].spec.template.spec.containers[1].env, [
|
|
83
|
-
{
|
|
84
|
-
name: "TEST",
|
|
85
|
-
value: "test"
|
|
86
|
-
},
|
|
87
|
-
...envs
|
|
88
|
-
]);
|
|
89
|
-
// COV parts
|
|
90
|
-
runner.getParameters().jobResources = {};
|
|
91
|
-
await runner.launchAction(action, this.getJobInfo(action));
|
|
92
|
-
runner.getParameters().jobResources = { spec: {} };
|
|
93
|
-
await runner.launchAction(action, this.getJobInfo(action));
|
|
94
|
-
runner.getParameters().jobResources = { spec: { template: {} } };
|
|
95
|
-
await runner.launchAction(action, this.getJobInfo(action));
|
|
96
|
-
runner.getParameters().jobResources = { spec: { template: { spec: {} } } };
|
|
97
|
-
await runner.launchAction(action, this.getJobInfo(action));
|
|
98
|
-
}
|
|
99
|
-
finally {
|
|
100
|
-
kube.restore();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
__decorate([
|
|
105
|
-
test
|
|
106
|
-
], KubeRunnerTest.prototype, "cov", null);
|
|
107
|
-
__decorate([
|
|
108
|
-
test
|
|
109
|
-
], KubeRunnerTest.prototype, "loadResource", null);
|
|
110
|
-
__decorate([
|
|
111
|
-
test
|
|
112
|
-
], KubeRunnerTest.prototype, "launchAction", null);
|
|
113
|
-
KubeRunnerTest = __decorate([
|
|
114
|
-
suite
|
|
115
|
-
], KubeRunnerTest);
|
|
116
|
-
//# sourceMappingURL=kuberunner.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kuberunner.spec.js","sourceRoot":"","sources":["../../src/services/kuberunner.spec.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,IAAI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OAAO,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;CACF,CAAA;AA9FC;IADC,IAAI;yCAGJ;AAGD;IADC,IAAI;kDAMJ;AAYK;IADL,IAAI;kDAwEJ;AA/FG,cAAc;IADnB,KAAK;GACA,cAAc,CAgGnB"}
|
package/lib/shell.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare class KubernetesShell {
|
|
2
|
-
static shellCommand(Console: any, args: any): Promise<void>;
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Create the command line parser
|
|
6
|
-
*
|
|
7
|
-
* @param y
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
declare function yargs(y: any): any;
|
|
11
|
-
declare const ShellCommand: typeof KubernetesShell.shellCommand;
|
|
12
|
-
export { ShellCommand, yargs };
|
|
13
|
-
//# sourceMappingURL=shell.d.ts.map
|
package/lib/shell.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../src/shell.ts"],"names":[],"mappings":"AAKA,qBAAa,eAAe;WACb,YAAY,CAAC,OAAO,KAAA,EAAE,IAAI,KAAA;CA+BxC;AAED;;;;;GAKG;AACH,iBAAS,KAAK,CAAC,CAAC,KAAA,OAOf;AAED,QAAA,MAAM,YAAY,qCAA+B,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC"}
|
package/lib/shell.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { CronService } from "@webda/core";
|
|
2
|
-
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
3
|
-
import { extname, join } from "path";
|
|
4
|
-
import { CronReplace } from "./cron.js";
|
|
5
|
-
export class KubernetesShell {
|
|
6
|
-
static async shellCommand(Console, args) {
|
|
7
|
-
if (args.cronExport) {
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
const shellModule = await import("@webda/shell");
|
|
10
|
-
const target = args.target || "./crons";
|
|
11
|
-
let template = args.template;
|
|
12
|
-
const filenameTemplate = args.filenameTemplate || "${serviceName.toLowerCase()}.${method.toLowerCase()}-${cronId}.${ext}";
|
|
13
|
-
let ext;
|
|
14
|
-
if (template) {
|
|
15
|
-
ext = extname(template).substring(1);
|
|
16
|
-
template = readFileSync(template).toString();
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
template = shellModule.K8S_DEFAULT_CRON_DEFINITION;
|
|
20
|
-
ext = "yaml";
|
|
21
|
-
}
|
|
22
|
-
// Dynanically import
|
|
23
|
-
Console.webda = new shellModule.WebdaServer(Console.app);
|
|
24
|
-
Console.webda.initStatics();
|
|
25
|
-
mkdirSync(target, { recursive: true });
|
|
26
|
-
const crons = CronService.loadAnnotations(Console.webda.getServices());
|
|
27
|
-
crons.forEach((cron) => {
|
|
28
|
-
cron.cronId = CronService.getCronId(cron, "export");
|
|
29
|
-
const filename = join(target, Console.app.replaceVariables(filenameTemplate, { ...cron, ext }));
|
|
30
|
-
Console.log("DEBUG", `Exporting ${filename} cron with ${cron.toString()}`);
|
|
31
|
-
writeFileSync(filename, CronReplace(template, cron, Console.app));
|
|
32
|
-
});
|
|
33
|
-
Console.log("INFO", `Exported ${crons.length} crons`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Create the command line parser
|
|
39
|
-
*
|
|
40
|
-
* @param y
|
|
41
|
-
* @returns
|
|
42
|
-
*/
|
|
43
|
-
function yargs(y) {
|
|
44
|
-
return y.command("cronExport [template] [targetDir]", "Export all application Cron as template", yarg => {
|
|
45
|
-
yarg.option("filenameTemplate", {
|
|
46
|
-
default: "${serviceName}.${method}-${cronId}.${ext}",
|
|
47
|
-
description: "Filename template to use"
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
const ShellCommand = KubernetesShell.shellCommand;
|
|
52
|
-
export { ShellCommand, yargs };
|
|
53
|
-
//# sourceMapping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","sourceRoot":"","sources":["../../src/utils/client.spec.ts"],"names":[],"mappings":""}
|
package/lib/utils/client.spec.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import * as assert from "assert";
|
|
8
|
-
import { suite, test } from "@testdeck/mocha";
|
|
9
|
-
import { getKubernetesApiClient } from "./client.js";
|
|
10
|
-
import * as k8s from "@kubernetes/client-node";
|
|
11
|
-
/**
|
|
12
|
-
* This is mainly for COV
|
|
13
|
-
* We should inject true configuration to check more
|
|
14
|
-
*/
|
|
15
|
-
let GetKubernetesApiClient = class GetKubernetesApiClient {
|
|
16
|
-
withConfig() {
|
|
17
|
-
assert.throws(() => getKubernetesApiClient({
|
|
18
|
-
config: "./test/kubeconfig"
|
|
19
|
-
}), /Unknown format/);
|
|
20
|
-
assert.throws(() => getKubernetesApiClient({
|
|
21
|
-
config: {}
|
|
22
|
-
}), /No active cluster/);
|
|
23
|
-
}
|
|
24
|
-
withContext() {
|
|
25
|
-
assert.throws(() => getKubernetesApiClient({ context: "plop" }, k8s.AppsV1Api), /No active cluster/);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
__decorate([
|
|
29
|
-
test
|
|
30
|
-
], GetKubernetesApiClient.prototype, "withConfig", null);
|
|
31
|
-
__decorate([
|
|
32
|
-
test
|
|
33
|
-
], GetKubernetesApiClient.prototype, "withContext", null);
|
|
34
|
-
GetKubernetesApiClient = __decorate([
|
|
35
|
-
suite
|
|
36
|
-
], GetKubernetesApiClient);
|
|
37
|
-
//# sourceMappingURL=client.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.spec.js","sourceRoot":"","sources":["../../src/utils/client.spec.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,GAAG,MAAM,yBAAyB,CAAC;AAE/C;;;GAGG;AAEH,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAE1B,UAAU;QACR,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,CACH,sBAAsB,CAAC;YACrB,MAAM,EAAE,mBAAmB;SAC5B,CAAC,EACJ,gBAAgB,CACjB,CAAC;QACF,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,CACH,sBAAsB,CAAM;YAC1B,MAAM,EAAE,EAAE;SACX,CAAC,EACJ,mBAAmB,CACpB,CAAC;IACJ,CAAC;IAGD,WAAW;QACT,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACvG,CAAC;CACF,CAAA;AArBC;IADC,IAAI;wDAgBJ;AAGD;IADC,IAAI;yDAGJ;AAtBG,sBAAsB;IAD3B,KAAK;GACA,sBAAsB,CAuB3B"}
|