pepr 0.51.4 → 0.51.5-nightly.1
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/dist/cli/init/templates.d.ts +12 -6
- package/dist/cli/init/templates.d.ts.map +1 -1
- package/dist/cli.js +5 -3
- package/dist/controller.js +1 -2
- package/dist/lib/assets/webhooks.d.ts.map +1 -1
- package/dist/lib/core/queue.d.ts +1 -1
- package/dist/lib/core/queue.d.ts.map +1 -1
- package/dist/lib/processors/watch-processor.d.ts.map +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib.d.ts +2 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +10 -9
- package/dist/lib.js.map +2 -2
- package/package.json +29 -23
- package/src/cli/init/templates.ts +3 -0
- package/src/lib/assets/webhooks.ts +2 -1
- package/src/lib/core/queue.ts +1 -1
- package/src/lib/processors/watch-processor.ts +2 -1
- package/src/lib/telemetry/webhookTimeouts.ts +2 -2
- package/src/lib/types.ts +1 -1
- package/src/lib.ts +2 -0
- package/dist/cli/docs/cli.helper.d.ts +0 -12
- package/dist/cli/docs/cli.helper.d.ts.map +0 -1
- package/dist/cli/docs/markdown.helper.d.ts +0 -8
- package/dist/cli/docs/markdown.helper.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -14,39 +14,43 @@
|
|
|
14
14
|
"/src",
|
|
15
15
|
"!src/**/*.test.ts",
|
|
16
16
|
"!src/fixtures/**",
|
|
17
|
-
"!dist/**/*.test.d.ts*"
|
|
18
|
-
"!src/cli/docs/**"
|
|
17
|
+
"!dist/**/*.test.d.ts*"
|
|
19
18
|
],
|
|
20
|
-
"version": "0.51.
|
|
19
|
+
"version": "0.51.5-nightly.1",
|
|
21
20
|
"main": "dist/lib.js",
|
|
22
21
|
"types": "dist/lib.d.ts",
|
|
23
22
|
"scripts": {
|
|
24
23
|
"ci": "npm ci",
|
|
25
24
|
"gen-data-json": "node hack/build-template-data.js",
|
|
26
25
|
"prebuild": "rm -fr dist/* && npm run gen-data-json",
|
|
27
|
-
"build": "tsc && node build.mjs && npm pack",
|
|
26
|
+
"build": "tsc -p config/tsconfig.root.json && node build.mjs && npm pack",
|
|
28
27
|
"build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .",
|
|
29
28
|
"build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .",
|
|
30
29
|
"set:version": "node scripts/set-version.js",
|
|
31
30
|
"test": "npm run test:unit && npm run test:journey && npm run test:journey-wasm",
|
|
32
|
-
"test:artifacts": "npm run build &&
|
|
33
|
-
"test:docs": "
|
|
31
|
+
"test:artifacts": "npm run build && vitest run src/build-artifact.test.ts",
|
|
32
|
+
"test:docs": "vitest run --config=config/vitest.integration.config.ts integration/cli/docs/*.test.ts",
|
|
34
33
|
"test:integration": "npm run test:integration:prep && npm run test:integration:run",
|
|
35
34
|
"test:integration:prep": "./integration/prep.sh",
|
|
36
|
-
"test:integration:run": "
|
|
35
|
+
"test:integration:run": "vitest run --config=config/vitest.integration.config.ts integration",
|
|
37
36
|
"test:journey": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run",
|
|
38
37
|
"test:journey-wasm": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run-wasm",
|
|
39
38
|
"test:journey-wasm:unicorn": "npm run test:journey:k3d && npm run build && npm run test:journey:image:unicorn && npm run test:journey:run-wasm",
|
|
40
39
|
"test:journey:image": "docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev",
|
|
41
40
|
"test:journey:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev",
|
|
42
41
|
"test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system",
|
|
43
|
-
"test:journey:run": "
|
|
44
|
-
"test:journey:run-wasm": "
|
|
42
|
+
"test:journey:run": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint.test.ts && npm run test:journey:upgrade",
|
|
43
|
+
"test:journey:run-wasm": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint-wasm.test.ts",
|
|
45
44
|
"test:journey:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && npm run test:journey:run",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"format:
|
|
49
|
-
"format:
|
|
45
|
+
"format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check",
|
|
46
|
+
"format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write",
|
|
47
|
+
"format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers",
|
|
48
|
+
"format:markdown": "npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore pepr-upgrade-test --ignore node_modules \"**/*.md\"",
|
|
49
|
+
"format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts",
|
|
50
|
+
"format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'",
|
|
51
|
+
"format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'",
|
|
52
|
+
"test:journey:upgrade": "npm run test:journey:k3d && npm run test:journey:image && vitest run --config=config/vitest.journey.config.ts journey/pepr-upgrade.test.ts",
|
|
53
|
+
"test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage",
|
|
50
54
|
"prepare": "if [ \"$NODE_ENV\" != 'production' ]; then husky; fi"
|
|
51
55
|
},
|
|
52
56
|
"dependencies": {
|
|
@@ -57,36 +61,38 @@
|
|
|
57
61
|
"heredoc": "^1.3.1",
|
|
58
62
|
"http-status-codes": "^2.3.0",
|
|
59
63
|
"json-pointer": "^0.6.2",
|
|
60
|
-
"kubernetes-fluent-client": "3.
|
|
64
|
+
"kubernetes-fluent-client": "3.6.4",
|
|
61
65
|
"pino": "9.7.0",
|
|
62
66
|
"pino-pretty": "13.0.0",
|
|
63
67
|
"prom-client": "15.1.3",
|
|
64
|
-
"ramda": "0.
|
|
68
|
+
"ramda": "0.31.3",
|
|
65
69
|
"sigstore": "3.1.0",
|
|
66
70
|
"ts-morph": "^26.0.0"
|
|
67
71
|
},
|
|
68
72
|
"devDependencies": {
|
|
69
73
|
"@commitlint/cli": "19.8.1",
|
|
70
74
|
"@commitlint/config-conventional": "19.8.1",
|
|
71
|
-
"@fast-check/
|
|
72
|
-
"@jest/globals": "29.7.0",
|
|
75
|
+
"@fast-check/vitest": "^0.2.1",
|
|
73
76
|
"@types/eslint": "9.6.1",
|
|
74
77
|
"@types/express": "5.0.3",
|
|
75
78
|
"@types/json-pointer": "^1.0.34",
|
|
76
|
-
"@types/node": "
|
|
79
|
+
"@types/node": "24.x.x",
|
|
77
80
|
"@types/node-forge": "1.3.11",
|
|
78
81
|
"@types/uuid": "10.0.0",
|
|
82
|
+
"@types/ws": "^8.18.1",
|
|
83
|
+
"@vitest/coverage-v8": "^3.2.3",
|
|
79
84
|
"fast-check": "^4.0.0",
|
|
80
85
|
"globals": "^16.0.0",
|
|
81
86
|
"husky": "^9.1.6",
|
|
82
|
-
"jest": "29.7.0",
|
|
83
87
|
"js-yaml": "^4.1.0",
|
|
84
88
|
"shellcheck": "^3.0.0",
|
|
85
|
-
"
|
|
86
|
-
"undici": "^7.0.1"
|
|
89
|
+
"tsx": "^4.20.3",
|
|
90
|
+
"undici": "^7.0.1",
|
|
91
|
+
"vitest": "^3.2.3"
|
|
87
92
|
},
|
|
88
93
|
"overrides": {
|
|
89
|
-
"glob": "^9.0.0"
|
|
94
|
+
"glob": "^9.0.0",
|
|
95
|
+
"brace-expansion": "1.1.11"
|
|
90
96
|
},
|
|
91
97
|
"peerDependencies": {
|
|
92
98
|
"@types/prompts": "2.4.9",
|
|
@@ -100,4 +106,4 @@
|
|
|
100
106
|
"typescript": "5.8.3",
|
|
101
107
|
"uuid": "11.1.0"
|
|
102
108
|
}
|
|
103
|
-
}
|
|
109
|
+
}
|
|
@@ -12,6 +12,7 @@ import { resolveIgnoreNamespaces } from "./ignoredNamespaces";
|
|
|
12
12
|
import { Assets } from "./assets";
|
|
13
13
|
import { Event, WebhookType } from "../enums";
|
|
14
14
|
import { Binding } from "../types";
|
|
15
|
+
import Log from "../telemetry/logger";
|
|
15
16
|
|
|
16
17
|
export const peprIgnoreNamespaces: string[] = ["kube-system", "pepr-system"];
|
|
17
18
|
|
|
@@ -49,7 +50,7 @@ export async function generateWebhookRules(
|
|
|
49
50
|
const { config, capabilities } = assets;
|
|
50
51
|
|
|
51
52
|
const rules = capabilities.flatMap(capability => {
|
|
52
|
-
|
|
53
|
+
Log.info(`Module ${config.uuid} has capability: ${capability.name}`);
|
|
53
54
|
|
|
54
55
|
return capability.bindings
|
|
55
56
|
.map(binding => validateRule(binding, isMutateWebhook))
|
package/src/lib/core/queue.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
3
3
|
import { KubernetesObject } from "@kubernetes/client-node";
|
|
4
|
-
import { WatchPhase } from "kubernetes-fluent-client/dist/fluent/types";
|
|
4
|
+
import { WatchPhase } from "kubernetes-fluent-client/dist/fluent/shared-types";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
6
6
|
import Log from "../telemetry/logger";
|
|
7
7
|
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
GenericClass,
|
|
13
13
|
} from "kubernetes-fluent-client";
|
|
14
14
|
import { Queue } from "../core/queue";
|
|
15
|
-
import {
|
|
15
|
+
import { WatcherType } from "kubernetes-fluent-client/dist/fluent/types";
|
|
16
|
+
import { WatchPhase } from "kubernetes-fluent-client/dist/fluent/shared-types";
|
|
16
17
|
import { KubernetesListObject } from "kubernetes-fluent-client/dist/types";
|
|
17
18
|
import { filterNoMatchReason } from "../filter/filter";
|
|
18
19
|
import { metricsCollector, MetricsCollectorInstance } from "../telemetry/metrics";
|
|
@@ -18,7 +18,7 @@ export class MeasureWebhookTimeout {
|
|
|
18
18
|
start(timeout: number = 10): void {
|
|
19
19
|
this.#startTime = getNow();
|
|
20
20
|
this.timeout = timeout;
|
|
21
|
-
Log.
|
|
21
|
+
Log.debug(`Starting timer at ${this.#startTime}`);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
stop(): void {
|
|
@@ -27,7 +27,7 @@ export class MeasureWebhookTimeout {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const elapsedTime = getNow() - this.#startTime;
|
|
30
|
-
Log.
|
|
30
|
+
Log.debug(`Webhook ${this.#startTime} took ${elapsedTime}ms`);
|
|
31
31
|
this.#startTime = null;
|
|
32
32
|
|
|
33
33
|
if (elapsedTime > this.timeout) {
|
package/src/lib/types.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { GenericClass, GroupVersionKind, KubernetesObject } from "kubernetes-fluent-client";
|
|
5
5
|
import { Event } from "./enums";
|
|
6
|
-
import { WatchPhase } from "kubernetes-fluent-client/dist/fluent/types";
|
|
6
|
+
import { WatchPhase } from "kubernetes-fluent-client/dist/fluent/shared-types";
|
|
7
7
|
import { Logger } from "pino";
|
|
8
8
|
import { PeprMutateRequest } from "./mutate-request";
|
|
9
9
|
import { PeprValidateRequest } from "./validate-request";
|
package/src/lib.ts
CHANGED
|
@@ -8,8 +8,10 @@ import { PeprMutateRequest } from "./lib/mutate-request";
|
|
|
8
8
|
import * as PeprUtils from "./lib/utils";
|
|
9
9
|
import { PeprValidateRequest } from "./lib/validate-request";
|
|
10
10
|
import * as sdk from "./sdk/sdk";
|
|
11
|
+
import { metricsCollector } from "./lib/telemetry/metrics";
|
|
11
12
|
|
|
12
13
|
export {
|
|
14
|
+
metricsCollector,
|
|
13
15
|
Capability,
|
|
14
16
|
K8s,
|
|
15
17
|
Log,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse CLI output into options and commands
|
|
3
|
-
*/
|
|
4
|
-
export declare const parseCLIOutput: (cliOutput: string) => {
|
|
5
|
-
options: string[];
|
|
6
|
-
commands: string[];
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Normalize whitespace between CLI options and their descriptions to be exactly two spaces
|
|
10
|
-
*/
|
|
11
|
-
export declare const normalizeOptionWhitespace: (option: string) => string;
|
|
12
|
-
//# sourceMappingURL=cli.helper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.helper.d.ts","sourceRoot":"","sources":["../../../src/cli/docs/cli.helper.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,KAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CASzF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,KAAG,MAW1D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.helper.d.ts","sourceRoot":"","sources":["../../../src/cli/docs/markdown.helper.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAK,MAAW,KAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAoB3F,CAAC"}
|