pepr 0.42.3 → 0.44.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/dist/cli/build.d.ts +25 -11
- package/dist/cli/build.d.ts.map +1 -1
- package/dist/cli/build.helpers.d.ts +0 -7
- package/dist/cli/build.helpers.d.ts.map +1 -1
- package/dist/cli/deploy.d.ts.map +1 -1
- package/dist/cli/dev.d.ts.map +1 -1
- package/dist/cli/init/templates.d.ts +3 -0
- package/dist/cli/init/templates.d.ts.map +1 -1
- package/dist/cli.js +742 -710
- package/dist/controller.js +1 -1
- package/dist/fixtures/loader.d.ts.map +1 -1
- package/dist/lib/assets/assets.d.ts +15 -12
- package/dist/lib/assets/assets.d.ts.map +1 -1
- package/dist/lib/assets/deploy.d.ts +1 -1
- package/dist/lib/assets/deploy.d.ts.map +1 -1
- package/dist/lib/assets/helm.d.ts.map +1 -1
- package/dist/lib/assets/index.d.ts.map +1 -1
- package/dist/lib/assets/webhooks.d.ts +4 -1
- package/dist/lib/assets/webhooks.d.ts.map +1 -1
- package/dist/lib/assets/yaml/generateAllYaml.d.ts +9 -0
- package/dist/lib/assets/yaml/generateAllYaml.d.ts.map +1 -0
- package/dist/lib/assets/yaml/generateZarfYaml.d.ts +5 -0
- package/dist/lib/assets/yaml/generateZarfYaml.d.ts.map +1 -0
- package/dist/lib/assets/yaml/overridesFile.d.ts +15 -0
- package/dist/lib/assets/yaml/overridesFile.d.ts.map +1 -0
- package/dist/lib/core/module.d.ts.map +1 -1
- package/dist/lib/enums.d.ts +4 -0
- package/dist/lib/enums.d.ts.map +1 -1
- package/dist/lib/processors/mutate-processor.d.ts +2 -0
- package/dist/lib/processors/mutate-processor.d.ts.map +1 -1
- package/dist/lib/processors/validate-processor.d.ts.map +1 -1
- package/dist/lib/telemetry/timeUtils.d.ts +2 -0
- package/dist/lib/telemetry/timeUtils.d.ts.map +1 -0
- package/dist/lib/telemetry/webhookTimeouts.d.ts +9 -0
- package/dist/lib/telemetry/webhookTimeouts.d.ts.map +1 -0
- package/dist/lib.js +79 -22
- package/dist/lib.js.map +4 -4
- package/package.json +5 -2
- package/src/cli/build.helpers.ts +7 -22
- package/src/cli/build.ts +72 -16
- package/src/cli/deploy.ts +7 -6
- package/src/cli/dev.ts +9 -6
- package/src/fixtures/loader.ts +2 -2
- package/src/lib/assets/assets.ts +66 -53
- package/src/lib/assets/deploy.ts +32 -30
- package/src/lib/assets/helm.ts +22 -4
- package/src/lib/assets/index.ts +33 -9
- package/src/lib/assets/pods.ts +2 -2
- package/src/lib/assets/webhooks.ts +21 -6
- package/src/lib/assets/yaml/generateAllYaml.ts +50 -0
- package/src/lib/assets/yaml/generateZarfYaml.ts +38 -0
- package/src/lib/assets/{yaml.ts → yaml/overridesFile.ts} +8 -120
- package/src/lib/core/module.ts +2 -1
- package/src/lib/enums.ts +6 -0
- package/src/lib/processors/mutate-processor.ts +15 -7
- package/src/lib/processors/validate-processor.ts +13 -4
- package/src/lib/telemetry/timeUtils.ts +1 -0
- package/src/lib/telemetry/webhookTimeouts.ts +34 -0
- package/dist/lib/assets/yaml.d.ts +0 -32
- package/dist/lib/assets/yaml.d.ts.map +0 -1
package/dist/controller.js
CHANGED
|
@@ -51,7 +51,7 @@ if (process.env.LOG_LEVEL) {
|
|
|
51
51
|
var logger_default = Log;
|
|
52
52
|
|
|
53
53
|
// src/templates/data.json
|
|
54
|
-
var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, files: ["/dist", "/src", "!src/**/*.test.ts", "!dist/**/*.test.d.ts*"], version: "0.
|
|
54
|
+
var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, files: ["/dist", "/src", "!src/**/*.test.ts", "!dist/**/*.test.d.ts*"], version: "0.44.0", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { ci: "npm ci", "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", version: "node scripts/set-version.js", build: "tsc && node build.mjs && npm pack", "build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .", test: "npm run test:unit && npm run test:journey", "test:unit": "npm run gen-data-json && jest src --coverage --detectOpenHandles --coverageDirectory=./coverage --testPathIgnorePatterns='cosign.e2e.test.ts'", "test:integration": "npm run test:integration:prep && npm run test:integration:run", "test:integration:prep": "./integration/prep.sh", "test:integration:run": "jest --maxWorkers=4 integration", "test:journey": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run", "test:journey:prep": "if [ ! -d ./pepr-upgrade-test ]; then git clone https://github.com/defenseunicorns/pepr-upgrade-test.git ; fi", "test:journey-wasm": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run-wasm", "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", "test:journey:image": "docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:run": "jest --detectOpenHandles journey/entrypoint.test.ts && npm run test:journey:prep && npm run test:journey:upgrade", "test:journey:run-wasm": "jest --detectOpenHandles journey/entrypoint-wasm.test.ts", "test:journey:upgrade": "npm run test:journey:k3d && npm run test:journey:image && jest --detectOpenHandles journey/pepr-upgrade.test.ts", "format:check": "eslint src && prettier src --check", "format:fix": "eslint src --fix && prettier src --write", prepare: `if [ "$NODE_ENV" != 'production' ]; then husky; fi` }, dependencies: { "@types/ramda": "0.30.2", express: "4.21.2", "fast-json-patch": "3.1.1", "follow-redirects": "1.15.9", "http-status-codes": "^2.3.0", "json-pointer": "^0.6.2", "kubernetes-fluent-client": "3.3.8", pino: "9.6.0", "pino-pretty": "13.0.0", "prom-client": "15.1.3", ramda: "0.30.1", sigstore: "3.0.0" }, devDependencies: { "@commitlint/cli": "19.6.1", "@commitlint/config-conventional": "19.6.0", "@fast-check/jest": "^2.0.1", "@jest/globals": "29.7.0", "@types/eslint": "9.6.1", "@types/express": "5.0.0", "@types/follow-redirects": "1.14.4", "@types/json-pointer": "^1.0.34", "@types/node": "22.x.x", "@types/node-forge": "1.3.11", "@types/uuid": "10.0.0", "fast-check": "^3.19.0", husky: "^9.1.6", jest: "29.7.0", "js-yaml": "^4.1.0", "ts-jest": "29.2.5", undici: "^7.0.1" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "7.18.0", "@typescript-eslint/parser": "7.18.0", "@types/prompts": "2.4.9", eslint: "8.57.0", commander: "12.1.0", esbuild: "0.24.0", "node-forge": "1.3.1", prettier: "3.4.2", prompts: "2.4.2", typescript: "^5.3.3", uuid: "11.0.3" } };
|
|
55
55
|
|
|
56
56
|
// src/lib/k8s.ts
|
|
57
57
|
var import_kubernetes_fluent_client = require("kubernetes-fluent-client");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/fixtures/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMhD,wBAAgB,gCAAgC,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/fixtures/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMhD,wBAAgB,gCAAgC,IAAI,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAEpF;AAED,wBAAgB,yBAAyB,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAEtE;AAED,wBAAgB,yBAAyB,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAEtE;AAED,wBAAgB,iCAAiC,IAAI,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAEtF"}
|
|
@@ -2,26 +2,29 @@ import { CapabilityExport } from "../types";
|
|
|
2
2
|
import { ModuleConfig } from "../core/module";
|
|
3
3
|
import { TLSOut } from "../tls";
|
|
4
4
|
import { WebhookIgnore } from "../k8s";
|
|
5
|
-
import { V1MutatingWebhookConfiguration, V1ValidatingWebhookConfiguration } from "@kubernetes/client-node/dist/gen";
|
|
5
|
+
import { V1Deployment, V1MutatingWebhookConfiguration, V1ValidatingWebhookConfiguration } from "@kubernetes/client-node/dist/gen";
|
|
6
|
+
import { WebhookType } from "../enums";
|
|
6
7
|
export declare class Assets {
|
|
7
|
-
readonly config: ModuleConfig;
|
|
8
|
-
readonly path: string;
|
|
9
|
-
readonly host?: string | undefined;
|
|
10
8
|
readonly name: string;
|
|
11
9
|
readonly tls: TLSOut;
|
|
12
10
|
readonly apiToken: string;
|
|
11
|
+
readonly config: ModuleConfig;
|
|
12
|
+
readonly path: string;
|
|
13
13
|
readonly alwaysIgnore: WebhookIgnore;
|
|
14
|
+
readonly imagePullSecrets: string[];
|
|
14
15
|
capabilities: CapabilityExport[];
|
|
15
16
|
image: string;
|
|
16
17
|
buildTimestamp: string;
|
|
17
|
-
|
|
18
|
-
constructor(config: ModuleConfig, path: string, host?: string
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
readonly host?: string;
|
|
19
|
+
constructor(config: ModuleConfig, path: string, imagePullSecrets: string[], host?: string);
|
|
20
|
+
deploy(deployFunction: (assets: Assets, force: boolean, webhookTimeout: number) => Promise<void>, force: boolean, webhookTimeout?: number): Promise<void>;
|
|
21
|
+
zarfYaml: (zarfYamlGenerator: (assets: Assets, path: string, type: "manifests" | "charts") => string, path: string) => string;
|
|
22
|
+
zarfYamlChart: (zarfYamlGenerator: (assets: Assets, path: string, type: "manifests" | "charts") => string, path: string) => string;
|
|
23
|
+
allYaml: (yamlGenerationFunction: (assyts: Assets, deployments: {
|
|
24
|
+
default: V1Deployment;
|
|
25
|
+
watch: V1Deployment | null;
|
|
26
|
+
}) => Promise<string>, imagePullSecret?: string) => Promise<string>;
|
|
24
27
|
writeWebhookFiles: (validateWebhook: V1MutatingWebhookConfiguration | V1ValidatingWebhookConfiguration | null, mutateWebhook: V1MutatingWebhookConfiguration | V1ValidatingWebhookConfiguration | null, helm: Record<string, Record<string, string>>) => Promise<void>;
|
|
25
|
-
generateHelmChart: (basePath: string) => Promise<void>;
|
|
28
|
+
generateHelmChart: (webhookGeneratorFunction: (assets: Assets, mutateOrValidate: WebhookType, timeoutSeconds: number | undefined) => Promise<V1MutatingWebhookConfiguration | V1ValidatingWebhookConfiguration | null>, basePath: string) => Promise<void>;
|
|
26
29
|
}
|
|
27
30
|
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/assets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/assets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AASvC,OAAO,EACL,YAAY,EACZ,8BAA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EAAE,MAAM,EACd,WAAW,EAAE;QAAE,OAAO,EAAE,YAAY,CAAC;QAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAA;KAAE,KAC/D,OAAO,CAAC,MAAM,CAAC,oBACF,MAAM,KACvB,OAAO,CAAC,MAAM,CAAC,CAiBhB;IAEF,iBAAiB,oBACE,8BAA8B,GAAG,gCAAgC,GAAG,IAAI,iBAC1E,8BAA8B,GAAG,gCAAgC,GAAG,IAAI,QACjF,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAC3C,OAAO,CAAC,IAAI,CAAC,CAad;IAEF,iBAAiB,6BACW,CACxB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,WAAW,EAC7B,cAAc,EAAE,MAAM,GAAG,SAAS,KAC/B,OAAO,CAAC,8BAA8B,GAAG,gCAAgC,GAAG,IAAI,CAAC,YAC5E,MAAM,KACf,OAAO,CAAC,IAAI,CAAC,CAuDd;CACH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Assets } from "./assets";
|
|
2
2
|
import { ImagePullSecret } from "../types";
|
|
3
3
|
export declare function deployImagePullSecret(imagePullSecret: ImagePullSecret, name: string): Promise<void>;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function deployWebhook(assets: Assets, force: boolean, webhookTimeout: number): Promise<void>;
|
|
5
5
|
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/deploy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAOlC,OAAO,EAAoB,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/deploy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAOlC,OAAO,EAAoB,eAAe,EAAE,MAAM,UAAU,CAAC;AAG7D,wBAAsB,qBAAqB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BzG;AAwBD,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBzG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helm.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/helm.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,IAAI,MAAM,CAY5C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAe1C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CA2BpE;AAED,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"helm.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/helm.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,IAAI,MAAM,CAY5C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAe1C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CA2BpE;AAED,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAwFpE;AAED,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CA6FtE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAyB3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAEvC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAEvC;AAGD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,EACpB,oBAAoB,EAAE,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC,8BAA8B,GAC5F,MAAM,CAkCR;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAsCnG"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { V1RuleWithOperations } from "@kubernetes/client-node";
|
|
2
2
|
import { kind } from "kubernetes-fluent-client";
|
|
3
3
|
import { Assets } from "./assets";
|
|
4
|
+
import { WebhookType } from "../enums";
|
|
5
|
+
export declare const peprIgnoreNamespaces: string[];
|
|
6
|
+
export declare function resolveIgnoreNamespaces(ignoredNSConfig?: string[]): string[];
|
|
4
7
|
export declare function generateWebhookRules(assets: Assets, isMutateWebhook: boolean): Promise<V1RuleWithOperations[]>;
|
|
5
|
-
export declare function
|
|
8
|
+
export declare function webhookConfigGenerator(assets: Assets, mutateOrValidate: WebhookType, timeoutSeconds?: number): Promise<kind.MutatingWebhookConfiguration | kind.ValidatingWebhookConfiguration | null>;
|
|
6
9
|
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/webhooks.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/webhooks.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAS,WAAW,EAAE,MAAM,UAAU,CAAC;AAG9C,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAAmC,CAAC;AA0B7E,wBAAgB,uBAAuB,CAAC,eAAe,GAAE,MAAM,EAAO,GAAG,MAAM,EAAE,CAahF;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAYpH;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,WAAW,EAC7B,cAAc,SAAK,GAClB,OAAO,CAAC,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC,8BAA8B,GAAG,IAAI,CAAC,CA+DzF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Assets } from "../assets";
|
|
2
|
+
import { V1Deployment } from "@kubernetes/client-node";
|
|
3
|
+
type deployments = {
|
|
4
|
+
default: V1Deployment;
|
|
5
|
+
watch: V1Deployment | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function generateAllYaml(assets: Assets, deployments: deployments): Promise<string>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=generateAllYaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateAllYaml.d.ts","sourceRoot":"","sources":["../../../../src/lib/assets/yaml/generateAllYaml.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,OAAO,EAAY,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAKjE,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE,CAAC;AAEzE,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAkC/F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateZarfYaml.d.ts","sourceRoot":"","sources":["../../../../src/lib/assets/yaml/generateZarfYaml.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,KAAK,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEzC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAgC9F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ModuleConfig } from "../../core/module";
|
|
2
|
+
import { CapabilityExport } from "../../types";
|
|
3
|
+
type CommonOverrideValues = {
|
|
4
|
+
apiToken: string;
|
|
5
|
+
capabilities: CapabilityExport[];
|
|
6
|
+
config: ModuleConfig;
|
|
7
|
+
hash: string;
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
type ChartOverrides = CommonOverrideValues & {
|
|
11
|
+
image: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function overridesFile({ hash, name, image, config, apiToken, capabilities }: ChartOverrides, path: string, imagePullSecrets: string[]): Promise<void>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=overridesFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overridesFile.d.ts","sourceRoot":"","sources":["../../../../src/lib/assets/yaml/overridesFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAK/C,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,cAAc,GAAG,oBAAoB,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAsB,aAAa,CACjC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,cAAc,EACrE,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,IAAI,CAAC,CA2Jf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/lib/core/module.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAoB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG9D,OAAO,EAAE,YAAY,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/lib/core/module.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAA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GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAE7C,6GAA6G;IAC7G,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,GAAG,gBAAgB,KAAK,IAAI,CAAC;CAC9D,CAAC;AAGF,eAAO,MAAM,WAAW,QAAO,OAAiD,CAAC;AAGjF,eAAO,MAAM,WAAW,QAAO,OAA4C,CAAC;AAE5E,eAAO,MAAM,SAAS,QAAO,OAA0C,CAAC;AAExE,qBAAa,UAAU;;IAGrB;;;;;;OAMG;gBACS,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,YAAY,GAAE,UAAU,EAAO,EAAE,IAAI,GAAE,iBAAsB;IAsD7G;;;;;OAKG;IACH,KAAK,qBAAkB,IAAI,CAEzB;CACH"}
|
package/dist/lib/enums.d.ts
CHANGED
package/dist/lib/enums.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/lib/enums.ts"],"names":[],"mappings":"AAIA,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,oBAAY,KAAK;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,gBAAgB,mBAAmB;IACnC,GAAG,MAAM;CACV"}
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/lib/enums.ts"],"names":[],"mappings":"AAIA,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,oBAAY,KAAK;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,gBAAgB,mBAAmB;IACnC,GAAG,MAAM;CACV;AAGD,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB"}
|
|
@@ -4,6 +4,7 @@ import { MutateResponse } from "../k8s";
|
|
|
4
4
|
import { AdmissionRequest, Binding } from "../types";
|
|
5
5
|
import { ModuleConfig } from "../core/module";
|
|
6
6
|
import { PeprMutateRequest } from "../mutate-request";
|
|
7
|
+
import { Operation } from "fast-json-patch";
|
|
7
8
|
export interface Bindable {
|
|
8
9
|
req: AdmissionRequest;
|
|
9
10
|
config: ModuleConfig;
|
|
@@ -25,4 +26,5 @@ export declare function decodeData(wrapped: PeprMutateRequest<KubernetesObject>)
|
|
|
25
26
|
export declare function reencodeData(wrapped: PeprMutateRequest<KubernetesObject>, skipped: string[]): KubernetesObject;
|
|
26
27
|
export declare function processRequest(bindable: Bindable, wrapped: PeprMutateRequest<KubernetesObject>, response: MutateResponse): Promise<Result>;
|
|
27
28
|
export declare function mutateProcessor(config: ModuleConfig, capabilities: Capability[], req: AdmissionRequest, reqMetadata: Record<string, string>): Promise<MutateResponse>;
|
|
29
|
+
export declare function updateResponsePatchAndWarnings(patches: Operation[], response: MutateResponse): void;
|
|
28
30
|
//# sourceMappingURL=mutate-processor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutate-processor.d.ts","sourceRoot":"","sources":["../../../src/lib/processors/mutate-processor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAQ,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAItD,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,gBAAgB,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,IAA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B,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAU9G;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,EAC5C,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,CAwCjB;AAGD,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,UAAU,EAAE,EAC1B,GAAG,EAAE,gBAAgB,EACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,OAAO,CAAC,cAAc,CAAC,CA4EzB;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI,CAanG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-processor.d.ts","sourceRoot":"","sources":["../../../src/lib/processors/validate-processor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-processor.d.ts","sourceRoot":"","sources":["../../../src/lib/processors/validate-processor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK9C,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,mBAAmB,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,GACzD,OAAO,CAAC,gBAAgB,CAAC,CAkC3B;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,UAAU,EAAE,EAC1B,GAAG,EAAE,gBAAgB,EACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAwC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeUtils.d.ts","sourceRoot":"","sources":["../../../src/lib/telemetry/timeUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,QAAO,MAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhookTimeouts.d.ts","sourceRoot":"","sources":["../../../src/lib/telemetry/webhookTimeouts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,qBAAa,qBAAqB;;IAGhC,OAAO,EAAE,MAAM,CAAK;gBAER,WAAW,EAAE,WAAW;IAKpC,KAAK,CAAC,OAAO,GAAE,MAAW,GAAG,IAAI;IAMjC,IAAI,IAAI,IAAI;CAab"}
|
package/dist/lib.js
CHANGED
|
@@ -51,7 +51,7 @@ var R = __toESM(require("ramda"));
|
|
|
51
51
|
|
|
52
52
|
// src/lib/core/capability.ts
|
|
53
53
|
var import_kubernetes_fluent_client6 = require("kubernetes-fluent-client");
|
|
54
|
-
var
|
|
54
|
+
var import_ramda9 = require("ramda");
|
|
55
55
|
|
|
56
56
|
// src/lib/telemetry/logger.ts
|
|
57
57
|
var import_pino = require("pino");
|
|
@@ -102,7 +102,7 @@ function redactedPatch(patch = {}) {
|
|
|
102
102
|
var logger_default = Log;
|
|
103
103
|
|
|
104
104
|
// src/lib/core/module.ts
|
|
105
|
-
var
|
|
105
|
+
var import_ramda7 = require("ramda");
|
|
106
106
|
|
|
107
107
|
// src/lib/controller/index.ts
|
|
108
108
|
var import_express = __toESM(require("express"));
|
|
@@ -240,7 +240,37 @@ var metricsCollector = new MetricsCollector("pepr");
|
|
|
240
240
|
|
|
241
241
|
// src/lib/processors/mutate-processor.ts
|
|
242
242
|
var import_fast_json_patch = __toESM(require("fast-json-patch"));
|
|
243
|
-
var
|
|
243
|
+
var import_ramda4 = require("ramda");
|
|
244
|
+
|
|
245
|
+
// src/lib/telemetry/timeUtils.ts
|
|
246
|
+
var getNow = () => performance.now();
|
|
247
|
+
|
|
248
|
+
// src/lib/telemetry/webhookTimeouts.ts
|
|
249
|
+
var MeasureWebhookTimeout = class {
|
|
250
|
+
#startTime = null;
|
|
251
|
+
#webhookType;
|
|
252
|
+
timeout = 0;
|
|
253
|
+
constructor(webhookType) {
|
|
254
|
+
this.#webhookType = webhookType;
|
|
255
|
+
metricsCollector.addCounter(`${webhookType}_timeouts`, `Number of ${webhookType} webhook timeouts`);
|
|
256
|
+
}
|
|
257
|
+
start(timeout = 10) {
|
|
258
|
+
this.#startTime = getNow();
|
|
259
|
+
this.timeout = timeout;
|
|
260
|
+
logger_default.info(`Starting timer at ${this.#startTime}`);
|
|
261
|
+
}
|
|
262
|
+
stop() {
|
|
263
|
+
if (this.#startTime === null) {
|
|
264
|
+
throw new Error("Timer was not started before calling stop.");
|
|
265
|
+
}
|
|
266
|
+
const elapsedTime = getNow() - this.#startTime;
|
|
267
|
+
logger_default.info(`Webhook ${this.#startTime} took ${elapsedTime}ms`);
|
|
268
|
+
this.#startTime = null;
|
|
269
|
+
if (elapsedTime > this.timeout) {
|
|
270
|
+
metricsCollector.incCounter(`${this.#webhookType}_timeouts`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
};
|
|
244
274
|
|
|
245
275
|
// src/lib/filter/adjudicators/adjudicators.ts
|
|
246
276
|
var import_ramda = require("ramda");
|
|
@@ -671,6 +701,20 @@ var OnError = /* @__PURE__ */ ((OnError2) => {
|
|
|
671
701
|
return OnError2;
|
|
672
702
|
})(OnError || {});
|
|
673
703
|
|
|
704
|
+
// src/lib/assets/webhooks.ts
|
|
705
|
+
var import_ramda3 = require("ramda");
|
|
706
|
+
function resolveIgnoreNamespaces(ignoredNSConfig = []) {
|
|
707
|
+
const ignoredNSEnv = process.env.PEPR_ADDITIONAL_IGNORED_NAMESPACES;
|
|
708
|
+
if (!ignoredNSEnv) {
|
|
709
|
+
return ignoredNSConfig;
|
|
710
|
+
}
|
|
711
|
+
const namespaces = ignoredNSEnv.split(",").map((ns) => ns.trim());
|
|
712
|
+
if (ignoredNSConfig) {
|
|
713
|
+
namespaces.push(...ignoredNSConfig);
|
|
714
|
+
}
|
|
715
|
+
return namespaces.filter((ns) => ns.length > 0);
|
|
716
|
+
}
|
|
717
|
+
|
|
674
718
|
// src/lib/processors/mutate-processor.ts
|
|
675
719
|
function updateStatus(config, name2, wrapped, status) {
|
|
676
720
|
if (wrapped.Request.operation === "DELETE") {
|
|
@@ -699,7 +743,7 @@ function decodeData(wrapped) {
|
|
|
699
743
|
return { skipped, wrapped };
|
|
700
744
|
}
|
|
701
745
|
function reencodeData(wrapped, skipped) {
|
|
702
|
-
const transformed = (0,
|
|
746
|
+
const transformed = (0, import_ramda4.clone)(wrapped.Raw);
|
|
703
747
|
const isSecret = wrapped.Request.kind.version === "v1" && wrapped.Request.kind.kind === "Secret";
|
|
704
748
|
if (isSecret) {
|
|
705
749
|
convertToBase64Map(transformed, skipped);
|
|
@@ -734,6 +778,8 @@ async function processRequest(bindable, wrapped, response) {
|
|
|
734
778
|
return { wrapped, response };
|
|
735
779
|
}
|
|
736
780
|
async function mutateProcessor(config, capabilities, req, reqMetadata) {
|
|
781
|
+
const webhookTimer = new MeasureWebhookTimeout("mutate" /* MUTATE */);
|
|
782
|
+
webhookTimer.start(config.webhookTimeout);
|
|
737
783
|
let response = {
|
|
738
784
|
uid: req.uid,
|
|
739
785
|
warnings: [],
|
|
@@ -760,7 +806,7 @@ async function mutateProcessor(config, capabilities, req, reqMetadata) {
|
|
|
760
806
|
bind.binding,
|
|
761
807
|
bind.req,
|
|
762
808
|
bind.namespaces,
|
|
763
|
-
bind.config?.alwaysIgnore?.namespaces
|
|
809
|
+
resolveIgnoreNamespaces(bind.config?.alwaysIgnore?.namespaces)
|
|
764
810
|
);
|
|
765
811
|
if (shouldSkip !== "") {
|
|
766
812
|
logger_default.debug(shouldSkip);
|
|
@@ -784,6 +830,12 @@ async function mutateProcessor(config, capabilities, req, reqMetadata) {
|
|
|
784
830
|
}
|
|
785
831
|
const transformed = reencodeData(wrapped, decoded.skipped);
|
|
786
832
|
const patches = import_fast_json_patch.default.compare(req.object, transformed);
|
|
833
|
+
updateResponsePatchAndWarnings(patches, response);
|
|
834
|
+
logger_default.debug({ ...reqMetadata, patches }, `Patches generated`);
|
|
835
|
+
webhookTimer.stop();
|
|
836
|
+
return response;
|
|
837
|
+
}
|
|
838
|
+
function updateResponsePatchAndWarnings(patches, response) {
|
|
787
839
|
if (patches.length > 0) {
|
|
788
840
|
response.patchType = "JSONPatch";
|
|
789
841
|
response.patch = base64Encode(JSON.stringify(patches));
|
|
@@ -791,12 +843,10 @@ async function mutateProcessor(config, capabilities, req, reqMetadata) {
|
|
|
791
843
|
if (response.warnings && response.warnings.length < 1) {
|
|
792
844
|
delete response.warnings;
|
|
793
845
|
}
|
|
794
|
-
logger_default.debug({ ...reqMetadata, patches }, `Patches generated`);
|
|
795
|
-
return response;
|
|
796
846
|
}
|
|
797
847
|
|
|
798
848
|
// src/lib/validate-request.ts
|
|
799
|
-
var
|
|
849
|
+
var import_ramda5 = require("ramda");
|
|
800
850
|
var PeprValidateRequest = class {
|
|
801
851
|
Raw;
|
|
802
852
|
#input;
|
|
@@ -821,9 +871,9 @@ var PeprValidateRequest = class {
|
|
|
821
871
|
constructor(input) {
|
|
822
872
|
this.#input = input;
|
|
823
873
|
if (input.operation.toUpperCase() === "DELETE" /* DELETE */) {
|
|
824
|
-
this.Raw = (0,
|
|
874
|
+
this.Raw = (0, import_ramda5.clone)(input.oldObject);
|
|
825
875
|
} else {
|
|
826
|
-
this.Raw = (0,
|
|
876
|
+
this.Raw = (0, import_ramda5.clone)(input.object);
|
|
827
877
|
}
|
|
828
878
|
if (!this.Raw) {
|
|
829
879
|
throw new Error("unable to load the request object into PeprRequest.Raw");
|
|
@@ -904,10 +954,11 @@ async function processRequest2(binding, actionMetadata, peprValidateRequest) {
|
|
|
904
954
|
}
|
|
905
955
|
}
|
|
906
956
|
async function validateProcessor(config, capabilities, req, reqMetadata) {
|
|
957
|
+
const webhookTimer = new MeasureWebhookTimeout("validate" /* VALIDATE */);
|
|
958
|
+
webhookTimer.start(config.webhookTimeout);
|
|
907
959
|
const wrapped = new PeprValidateRequest(req);
|
|
908
960
|
const response = [];
|
|
909
|
-
|
|
910
|
-
if (isSecret) {
|
|
961
|
+
if (req.kind.version === "v1" && req.kind.kind === "Secret") {
|
|
911
962
|
convertFromBase64Map(wrapped.Raw);
|
|
912
963
|
}
|
|
913
964
|
logger_default.info(reqMetadata, `Processing validation request`);
|
|
@@ -917,7 +968,12 @@ async function validateProcessor(config, capabilities, req, reqMetadata) {
|
|
|
917
968
|
if (!binding.validateCallback) {
|
|
918
969
|
continue;
|
|
919
970
|
}
|
|
920
|
-
const shouldSkip = shouldSkipRequest(
|
|
971
|
+
const shouldSkip = shouldSkipRequest(
|
|
972
|
+
binding,
|
|
973
|
+
req,
|
|
974
|
+
namespaces,
|
|
975
|
+
resolveIgnoreNamespaces(config?.alwaysIgnore?.namespaces)
|
|
976
|
+
);
|
|
921
977
|
if (shouldSkip !== "") {
|
|
922
978
|
logger_default.debug(shouldSkip);
|
|
923
979
|
continue;
|
|
@@ -926,12 +982,13 @@ async function validateProcessor(config, capabilities, req, reqMetadata) {
|
|
|
926
982
|
response.push(resp);
|
|
927
983
|
}
|
|
928
984
|
}
|
|
985
|
+
webhookTimer.stop();
|
|
929
986
|
return response;
|
|
930
987
|
}
|
|
931
988
|
|
|
932
989
|
// src/lib/controller/store.ts
|
|
933
990
|
var import_kubernetes_fluent_client3 = require("kubernetes-fluent-client");
|
|
934
|
-
var
|
|
991
|
+
var import_ramda6 = require("ramda");
|
|
935
992
|
|
|
936
993
|
// src/lib/k8s.ts
|
|
937
994
|
var import_kubernetes_fluent_client = require("kubernetes-fluent-client");
|
|
@@ -1045,7 +1102,7 @@ var StoreController = class {
|
|
|
1045
1102
|
for (const name2 of Object.keys(this.#stores)) {
|
|
1046
1103
|
const offset = `${name2}-`.length;
|
|
1047
1104
|
for (const key of Object.keys(data)) {
|
|
1048
|
-
if ((0,
|
|
1105
|
+
if ((0, import_ramda6.startsWith)(name2, key) && !(0, import_ramda6.startsWith)(`${name2}-v2`, key)) {
|
|
1049
1106
|
storeCache = fillStoreCache(storeCache, name2, "remove", {
|
|
1050
1107
|
key: [key.slice(offset)],
|
|
1051
1108
|
value: data[key]
|
|
@@ -1069,7 +1126,7 @@ var StoreController = class {
|
|
|
1069
1126
|
const offset = `${name2}-`.length;
|
|
1070
1127
|
const filtered = {};
|
|
1071
1128
|
for (const key of Object.keys(data)) {
|
|
1072
|
-
if ((0,
|
|
1129
|
+
if ((0, import_ramda6.startsWith)(name2, key)) {
|
|
1073
1130
|
filtered[key.slice(offset)] = data[key];
|
|
1074
1131
|
}
|
|
1075
1132
|
}
|
|
@@ -1638,7 +1695,7 @@ var PeprModule = class {
|
|
|
1638
1695
|
* @param opts Options for the Pepr runtime
|
|
1639
1696
|
*/
|
|
1640
1697
|
constructor({ description, pepr }, capabilities = [], opts = {}) {
|
|
1641
|
-
const config = (0,
|
|
1698
|
+
const config = (0, import_ramda7.clone)(pepr);
|
|
1642
1699
|
config.description = description;
|
|
1643
1700
|
ValidateError(config.onError);
|
|
1644
1701
|
if (isBuildMode()) {
|
|
@@ -1661,7 +1718,7 @@ var PeprModule = class {
|
|
|
1661
1718
|
this.#controller = new Controller(config, capabilities, opts.beforeHook, opts.afterHook, () => {
|
|
1662
1719
|
if (isWatchMode() || isDevMode()) {
|
|
1663
1720
|
try {
|
|
1664
|
-
setupWatch(capabilities, pepr?.alwaysIgnore?.namespaces);
|
|
1721
|
+
setupWatch(capabilities, resolveIgnoreNamespaces(pepr?.alwaysIgnore?.namespaces));
|
|
1665
1722
|
} catch (e) {
|
|
1666
1723
|
logger_default.error(e, "Error setting up watch");
|
|
1667
1724
|
process.exit(1);
|
|
@@ -1685,7 +1742,7 @@ var PeprModule = class {
|
|
|
1685
1742
|
};
|
|
1686
1743
|
|
|
1687
1744
|
// src/lib/core/storage.ts
|
|
1688
|
-
var
|
|
1745
|
+
var import_ramda8 = require("ramda");
|
|
1689
1746
|
var import_json_pointer = __toESM(require("json-pointer"));
|
|
1690
1747
|
var MAX_WAIT_TIME = 15e3;
|
|
1691
1748
|
var STORE_VERSION_PREFIX = "v2";
|
|
@@ -1708,7 +1765,7 @@ var Storage = class {
|
|
|
1708
1765
|
this.#store = data || {};
|
|
1709
1766
|
this.#onReady();
|
|
1710
1767
|
for (const idx in this.#subscribers) {
|
|
1711
|
-
this.#subscribers[idx]((0,
|
|
1768
|
+
this.#subscribers[idx]((0, import_ramda8.clone)(this.#store));
|
|
1712
1769
|
}
|
|
1713
1770
|
};
|
|
1714
1771
|
getItem = (key) => {
|
|
@@ -1796,7 +1853,7 @@ var Storage = class {
|
|
|
1796
1853
|
};
|
|
1797
1854
|
#onReady = () => {
|
|
1798
1855
|
for (const handler of this.#readyHandlers) {
|
|
1799
|
-
handler((0,
|
|
1856
|
+
handler((0, import_ramda8.clone)(this.#store));
|
|
1800
1857
|
}
|
|
1801
1858
|
this.#onReady = () => {
|
|
1802
1859
|
};
|
|
@@ -2091,7 +2148,7 @@ var Capability = class {
|
|
|
2091
2148
|
const commonChain = { WithLabel, WithAnnotation, WithDeletionTimestamp, Mutate, Validate, Watch, Reconcile, Alias };
|
|
2092
2149
|
const isNotEmpty = (value) => Object.keys(value).length > 0;
|
|
2093
2150
|
const log = (message, cbString) => {
|
|
2094
|
-
const filteredObj = (0,
|
|
2151
|
+
const filteredObj = (0, import_ramda9.pickBy)(isNotEmpty, binding.filters);
|
|
2095
2152
|
logger_default.info(`${message} configured for ${binding.event}`, prefix);
|
|
2096
2153
|
logger_default.info(filteredObj, prefix);
|
|
2097
2154
|
logger_default.debug(cbString, prefix);
|