k6ctl 0.1.0

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 ADDED
@@ -0,0 +1,45 @@
1
+ # k6ctl
2
+
3
+ A CLI tool to simplify running k6 tests on Kubernetes using the k6-operator.
4
+
5
+ ## Overview
6
+
7
+ `k6ctl` eliminates the need to manually run `kubectl` commands to create ConfigMaps, apply TestRun manifests, and manage k6 tests in Kubernetes. Instead, you configure your test settings once and run tests with a simple command.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install -g k6ctl
13
+ ```
14
+
15
+ Or use it directly with npx:
16
+
17
+ ```bash
18
+ npx k6ctl run path/to/test.js
19
+ ```
20
+
21
+ ## Configuration
22
+
23
+ Create a `k6ctl.config.js` file in the root of your k6 scripts project:
24
+
25
+ ## Usage
26
+
27
+ Run a k6 test:
28
+
29
+ ```bash
30
+ k6ctl run large-test-1.js
31
+ ```
32
+
33
+ ### Options
34
+
35
+ ### Additional Commands
36
+
37
+ ## Requirements
38
+
39
+ - Node.js >= 18.0.0
40
+ - kubectl configured with access to your Kubernetes cluster
41
+ - k6-operator installed in your cluster
42
+
43
+ ## License
44
+
45
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const commander_1 = require("commander");
5
+ const run_1 = require("./commands/run");
6
+ const program = new commander_1.Command();
7
+ program
8
+ .name('k6ctl')
9
+ .description('CLI tool to run k6 tests on Kubernetes using k6-operator')
10
+ .version('0.1.0');
11
+ program
12
+ .command('run <script>')
13
+ .description('Run a k6 test script')
14
+ .option('-c, --config <path>', 'Path to config file', 'k6ctl.config.js')
15
+ .option('-n, --namespace <namespace>', 'Kubernetes namespace')
16
+ .option('-p, --parallelism <number>', 'Number of parallel test pods')
17
+ .action(run_1.runTest);
18
+ program.parse();
19
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,wCAAyC;AAEzC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,0DAA0D,CAAC;KACvE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,cAAc,CAAC;KACvB,WAAW,CAAC,sBAAsB,CAAC;KACnC,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,EAAE,iBAAiB,CAAC;KACvE,MAAM,CAAC,6BAA6B,EAAE,sBAAsB,CAAC;KAC7D,MAAM,CAAC,4BAA4B,EAAE,8BAA8B,CAAC;KACpE,MAAM,CAAC,aAAO,CAAC,CAAC;AAEnB,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ interface RunOptions {
2
+ config: string;
3
+ namespace?: string;
4
+ parallelism?: number;
5
+ }
6
+ export declare function runTest(scriptPath: string, options: RunOptions): Promise<void>;
7
+ export {};
8
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,iBAGpE"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runTest = runTest;
4
+ async function runTest(scriptPath, options) {
5
+ console.log(`Running k6 test: ${scriptPath}`);
6
+ console.log(`Using config: ${JSON.stringify(options.config, null, 2)}`);
7
+ }
8
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":";;AAMA,0BAGC;AAHM,KAAK,UAAU,OAAO,CAAC,UAAkB,EAAE,OAAmB;IACnE,OAAO,CAAC,GAAG,CAAC,oBAAoB,UAAU,EAAE,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,30 @@
1
+ export interface K6Config {
2
+ namespace?: string;
3
+ parallelism?: number;
4
+ arguments?: string[];
5
+ cleanup?: boolean;
6
+ quiet?: boolean;
7
+ separate?: boolean;
8
+ runner: {
9
+ image?: string;
10
+ resources?: {
11
+ limits: {
12
+ cpu: string;
13
+ memory: string;
14
+ };
15
+ requests: {
16
+ cpu: string;
17
+ memory: string;
18
+ };
19
+ };
20
+ env?: Array<{
21
+ name: string;
22
+ value: string;
23
+ }>;
24
+ };
25
+ prometheus?: {
26
+ serverUrl: string;
27
+ trendStats?: string[];
28
+ };
29
+ }
30
+ //# sourceMappingURL=config.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../src/types/config.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE;YACV,MAAM,EAAE;gBACN,GAAG,EAAE,MAAM,CAAC;gBACZ,MAAM,EAAE,MAAM,CAAC;aAChB,CAAC;YACF,QAAQ,EAAE;gBACR,GAAG,EAAE,MAAM,CAAC;gBACZ,MAAM,EAAE,MAAM,CAAC;aAChB,CAAC;SACH,CAAC;QACF,GAAG,CAAC,EAAE,KAAK,CAAC;YACV,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;SACf,CAAC,CAAC;KACJ,CAAA;IACD,UAAU,CAAC,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;KACvB,CAAA;CACF"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=config.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.types.js","sourceRoot":"","sources":["../../src/types/config.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ export interface TestRunManifest {
2
+ apiVersion: string;
3
+ kind: string;
4
+ metadata: {
5
+ name: string;
6
+ namespace: string;
7
+ };
8
+ spec: {
9
+ parallelism?: number;
10
+ arguments?: string;
11
+ quiet?: boolean;
12
+ cleanup?: boolean;
13
+ separate?: boolean;
14
+ runner?: {
15
+ image?: string;
16
+ env?: Array<{
17
+ name: string;
18
+ value: string;
19
+ }>;
20
+ resources?: {
21
+ limits: {
22
+ cpu: string;
23
+ memory: string;
24
+ };
25
+ requests: {
26
+ cpu: string;
27
+ memory: string;
28
+ };
29
+ };
30
+ };
31
+ script: {
32
+ configMap?: {
33
+ name: string;
34
+ file: string;
35
+ };
36
+ volumeClaim?: {
37
+ name: string;
38
+ file: string;
39
+ };
40
+ };
41
+ };
42
+ }
43
+ //# sourceMappingURL=testRunManifest.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testRunManifest.types.d.ts","sourceRoot":"","sources":["../../src/types/testRunManifest.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,IAAI,EAAE;QACJ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE;YACP,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,GAAG,CAAC,EAAE,KAAK,CAAC;gBACV,IAAI,EAAE,MAAM,CAAC;gBACb,KAAK,EAAE,MAAM,CAAC;aACf,CAAC,CAAC;YACH,SAAS,CAAC,EAAE;gBACV,MAAM,EAAE;oBACN,GAAG,EAAE,MAAM,CAAA;oBACX,MAAM,EAAE,MAAM,CAAA;iBACf,CAAA;gBACD,QAAQ,EAAE;oBACR,GAAG,EAAE,MAAM,CAAA;oBACX,MAAM,EAAE,MAAM,CAAA;iBACf,CAAA;aACF,CAAA;SACF,CAAC;QACF,MAAM,EAAE;YACN,SAAS,CAAC,EAAE;gBACV,IAAI,EAAE,MAAM,CAAC;gBACb,IAAI,EAAE,MAAM,CAAC;aACd,CAAC;YACF,WAAW,CAAC,EAAE;gBACZ,IAAI,EAAE,MAAM,CAAC;gBACb,IAAI,EAAE,MAAM,CAAC;aACd,CAAA;SACF,CAAC;KACH,CAAC;CACH"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=testRunManifest.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testRunManifest.types.js","sourceRoot":"","sources":["../../src/types/testRunManifest.types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "k6ctl",
3
+ "version": "0.1.0",
4
+ "description": "CLI tool to run k6 tests on Kubernetes using k6-operator",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "k6ctl": "dist/cli.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "dev": "tsc --watch",
12
+ "prepublishOnly": "npm run build",
13
+ "test": "echo \"Error: no test specified\" && exit 1"
14
+ },
15
+ "keywords": [
16
+ "k6",
17
+ "kubernetes",
18
+ "k6-operator",
19
+ "load-testing",
20
+ "performance-testing",
21
+ "cli"
22
+ ],
23
+ "author": "",
24
+ "license": "MIT",
25
+ "dependencies": {
26
+ "@kubernetes/client-node": "^1.4.0",
27
+ "commander": "^14.0.3",
28
+ "js-yaml": "^4.1.1"
29
+ },
30
+ "devDependencies": {
31
+ "@types/js-yaml": "^4.0.9",
32
+ "@types/node": "^25.2.3",
33
+ "typescript": "^5.9.3"
34
+ },
35
+ "engines": {
36
+ "node": ">=18.0.0"
37
+ }
38
+ }
package/src/cli.ts ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Command } from 'commander';
4
+ import { runTest } from './commands/run';
5
+
6
+ const program = new Command();
7
+
8
+ program
9
+ .name('k6ctl')
10
+ .description('CLI tool to run k6 tests on Kubernetes using k6-operator')
11
+ .version('0.1.0');
12
+
13
+ program
14
+ .command('run <script>')
15
+ .description('Run a k6 test script')
16
+ .option('-c, --config <path>', 'Path to config file', 'k6ctl.config.js')
17
+ .option('-n, --namespace <namespace>', 'Kubernetes namespace')
18
+ .option('-p, --parallelism <number>', 'Number of parallel test pods')
19
+ .action(runTest);
20
+
21
+ program.parse();
@@ -0,0 +1,10 @@
1
+ interface RunOptions {
2
+ config: string;
3
+ namespace?: string;
4
+ parallelism?: number;
5
+ }
6
+
7
+ export async function runTest(scriptPath: string, options: RunOptions) {
8
+ console.log(`Running k6 test: ${scriptPath}`);
9
+ console.log(`Using config: ${JSON.stringify(options.config, null, 2)}`);
10
+ }
@@ -0,0 +1,29 @@
1
+ export interface K6Config {
2
+ namespace?: string;
3
+ parallelism?: number;
4
+ arguments?: string[];
5
+ cleanup?: boolean;
6
+ quiet?: boolean;
7
+ separate?: boolean;
8
+ runner: {
9
+ image?: string;
10
+ resources?: {
11
+ limits: {
12
+ cpu: string;
13
+ memory: string;
14
+ };
15
+ requests: {
16
+ cpu: string;
17
+ memory: string;
18
+ };
19
+ };
20
+ env?: Array<{
21
+ name: string;
22
+ value: string;
23
+ }>;
24
+ }
25
+ prometheus?: {
26
+ serverUrl: string;
27
+ trendStats?: string[];
28
+ }
29
+ }
@@ -0,0 +1,42 @@
1
+ export interface TestRunManifest {
2
+ apiVersion: string;
3
+ kind: string;
4
+ metadata: {
5
+ name: string;
6
+ namespace: string;
7
+ };
8
+ spec: {
9
+ parallelism?: number;
10
+ arguments?: string;
11
+ quiet?: boolean;
12
+ cleanup?: boolean;
13
+ separate?: boolean;
14
+ runner?: {
15
+ image?: string;
16
+ env?: Array<{
17
+ name: string;
18
+ value: string;
19
+ }>;
20
+ resources?: {
21
+ limits: {
22
+ cpu: string
23
+ memory: string
24
+ }
25
+ requests: {
26
+ cpu: string
27
+ memory: string
28
+ }
29
+ }
30
+ };
31
+ script: {
32
+ configMap?: {
33
+ name: string;
34
+ file: string;
35
+ };
36
+ volumeClaim?: {
37
+ name: string;
38
+ file: string;
39
+ }
40
+ };
41
+ };
42
+ }
File without changes
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "commonjs",
5
+ "lib": ["ES2022"],
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "moduleResolution": "node",
13
+ "resolveJsonModule": true,
14
+ "declaration": true,
15
+ "declarationMap": true,
16
+ "sourceMap": true
17
+ },
18
+ "include": ["src/**/*"],
19
+ "exclude": ["node_modules", "dist"]
20
+ }