pepr 0.46.2 → 0.46.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/dist/cli/banner.d.ts.map +1 -0
- package/dist/cli/build.d.ts.map +1 -0
- package/dist/cli/build.helpers.d.ts.map +1 -0
- package/dist/cli/deploy.d.ts.map +1 -0
- package/dist/cli/dev.d.ts.map +1 -0
- package/dist/cli/format.d.ts.map +1 -0
- package/dist/cli/format.helpers.d.ts.map +1 -0
- package/dist/cli/init/enums.d.ts.map +1 -0
- package/dist/cli/init/index.d.ts.map +1 -0
- package/dist/{src/cli → cli}/init/templates.d.ts +2 -6
- package/dist/cli/init/templates.d.ts.map +1 -0
- package/dist/cli/init/utils.d.ts.map +1 -0
- package/dist/cli/init/walkthrough.d.ts.map +1 -0
- package/dist/cli/kfc.d.ts.map +1 -0
- package/dist/cli/monitor.d.ts.map +1 -0
- package/dist/cli/root.d.ts.map +1 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/update.d.ts.map +1 -0
- package/dist/cli/uuid.d.ts.map +1 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +79 -23
- package/dist/controller.js +1 -1
- package/dist/fixtures/loader.d.ts.map +1 -0
- package/dist/lib/assets/assets.d.ts.map +1 -0
- package/dist/lib/assets/defaultTestObjects.d.ts.map +1 -0
- package/dist/lib/assets/deploy.d.ts.map +1 -0
- package/dist/lib/assets/destroy.d.ts.map +1 -0
- package/dist/lib/assets/helm.d.ts.map +1 -0
- package/dist/lib/assets/index.d.ts.map +1 -0
- package/dist/lib/assets/loader.d.ts.map +1 -0
- package/dist/lib/assets/networking.d.ts.map +1 -0
- package/dist/lib/assets/pods.d.ts.map +1 -0
- package/dist/lib/assets/rbac.d.ts.map +1 -0
- package/dist/lib/assets/store.d.ts.map +1 -0
- package/dist/lib/assets/webhooks.d.ts.map +1 -0
- package/dist/lib/assets/yaml/generateAllYaml.d.ts.map +1 -0
- package/dist/lib/assets/yaml/generateZarfYaml.d.ts.map +1 -0
- package/dist/lib/assets/yaml/overridesFile.d.ts.map +1 -0
- package/dist/lib/common-types.d.ts.map +1 -0
- package/dist/lib/controller/index.d.ts.map +1 -0
- package/dist/lib/controller/index.util.d.ts.map +1 -0
- package/dist/lib/controller/store.d.ts.map +1 -0
- package/dist/lib/controller/storeCache.d.ts.map +1 -0
- package/dist/lib/core/capability.d.ts.map +1 -0
- package/dist/lib/core/envChecks.d.ts.map +1 -0
- package/dist/lib/core/module.d.ts.map +1 -0
- package/dist/lib/core/queue.d.ts.map +1 -0
- package/dist/lib/core/schedule.d.ts.map +1 -0
- package/dist/lib/core/storage.d.ts.map +1 -0
- package/dist/lib/deploymentChecks.d.ts.map +1 -0
- package/dist/lib/enums.d.ts.map +1 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/filesystemService.d.ts.map +1 -0
- package/dist/lib/filter/adjudicators/admissionRequest.d.ts.map +1 -0
- package/dist/lib/filter/adjudicators/binding.d.ts.map +1 -0
- package/dist/lib/filter/adjudicators/defaultTestObjects.d.ts.map +1 -0
- package/dist/lib/filter/adjudicators/kubernetesObject.d.ts.map +1 -0
- package/dist/lib/filter/adjudicators/mismatch.d.ts.map +1 -0
- package/dist/lib/filter/adjudicators/postCollection.d.ts.map +1 -0
- package/dist/lib/filter/filter.d.ts.map +1 -0
- package/dist/lib/finalizer.d.ts.map +1 -0
- package/dist/lib/helpers.d.ts.map +1 -0
- package/dist/lib/included-files.d.ts.map +1 -0
- package/dist/lib/k8s.d.ts.map +1 -0
- package/dist/lib/mutate-request.d.ts.map +1 -0
- package/dist/lib/processors/decode-utils.d.ts.map +1 -0
- package/dist/lib/processors/mutate-processor.d.ts.map +1 -0
- package/dist/lib/processors/validate-processor.d.ts.map +1 -0
- package/dist/lib/processors/watch-processor.d.ts.map +1 -0
- package/dist/lib/telemetry/logger.d.ts.map +1 -0
- package/dist/lib/telemetry/metrics.d.ts.map +1 -0
- package/dist/lib/telemetry/timeUtils.d.ts.map +1 -0
- package/dist/lib/telemetry/webhookTimeouts.d.ts.map +1 -0
- package/dist/lib/tls.d.ts.map +1 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/validate-request.d.ts.map +1 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +124 -38
- package/dist/lib.js.map +2 -2
- package/dist/{src/runtime → runtime}/controller.d.ts.map +1 -1
- package/dist/sdk/heredoc.d.ts.map +1 -0
- package/dist/sdk/sdk.d.ts.map +1 -0
- package/package.json +7 -12
- package/src/lib/assets/assets.ts +46 -11
- package/src/lib/assets/defaultTestObjects.ts +13 -2
- package/src/lib/assets/deploy.ts +25 -5
- package/src/lib/assets/index.ts +8 -2
- package/src/lib/assets/pods.ts +5 -1
- package/src/lib/assets/webhooks.ts +12 -3
- package/src/lib/assets/yaml/generateAllYaml.ts +12 -2
- package/src/lib/controller/index.ts +9 -3
- package/src/lib/core/capability.ts +32 -8
- package/src/lib/core/module.ts +5 -1
- package/src/lib/core/storage.ts +3 -1
- package/src/lib/deploymentChecks.ts +3 -1
- package/src/lib/filter/adjudicators/admissionRequest.ts +4 -1
- package/src/lib/filter/adjudicators/binding.ts +17 -4
- package/src/lib/filter/adjudicators/kubernetesObject.ts +4 -2
- package/src/lib/filter/adjudicators/mismatch.ts +25 -6
- package/src/lib/filter/adjudicators/postCollection.ts +15 -3
- package/src/lib/filter/filter.ts +63 -15
- package/src/lib/helpers.ts +36 -10
- package/src/lib/included-files.ts +5 -1
- package/src/lib/processors/decode-utils.ts +4 -1
- package/src/lib/processors/mutate-processor.ts +4 -1
- package/src/lib/processors/validate-processor.ts +4 -1
- package/src/lib/processors/watch-processor.ts +49 -19
- package/src/lib/telemetry/metrics.ts +6 -2
- package/src/lib/telemetry/webhookTimeouts.ts +4 -1
- package/src/templates/.prettierrc.json +3 -2
- package/src/templates/capabilities/hello-pepr.ts +2 -8
- package/dist/.github/workflows/pepr-excellent-examples-matrix.d.ts +0 -2
- package/dist/.github/workflows/pepr-excellent-examples-matrix.d.ts.map +0 -1
- package/dist/commitlint.config.d.ts +0 -4
- package/dist/commitlint.config.d.ts.map +0 -1
- package/dist/integration/helpers/cmd.d.ts +0 -22
- package/dist/integration/helpers/cmd.d.ts.map +0 -1
- package/dist/integration/helpers/pepr.d.ts +0 -5
- package/dist/integration/helpers/pepr.d.ts.map +0 -1
- package/dist/integration/helpers/resource.d.ts +0 -18
- package/dist/integration/helpers/resource.d.ts.map +0 -1
- package/dist/integration/helpers/time.d.ts +0 -4
- package/dist/integration/helpers/time.d.ts.map +0 -1
- package/dist/integration/helpers/workdir.d.ts +0 -12
- package/dist/integration/helpers/workdir.d.ts.map +0 -1
- package/dist/scripts/set-version.d.ts +0 -2
- package/dist/scripts/set-version.d.ts.map +0 -1
- package/dist/src/cli/banner.d.ts.map +0 -1
- package/dist/src/cli/build.d.ts.map +0 -1
- package/dist/src/cli/build.helpers.d.ts.map +0 -1
- package/dist/src/cli/deploy.d.ts.map +0 -1
- package/dist/src/cli/dev.d.ts.map +0 -1
- package/dist/src/cli/format.d.ts.map +0 -1
- package/dist/src/cli/format.helpers.d.ts.map +0 -1
- package/dist/src/cli/init/enums.d.ts.map +0 -1
- package/dist/src/cli/init/index.d.ts.map +0 -1
- package/dist/src/cli/init/templates.d.ts.map +0 -1
- package/dist/src/cli/init/utils.d.ts.map +0 -1
- package/dist/src/cli/init/walkthrough.d.ts.map +0 -1
- package/dist/src/cli/kfc.d.ts.map +0 -1
- package/dist/src/cli/monitor.d.ts.map +0 -1
- package/dist/src/cli/root.d.ts.map +0 -1
- package/dist/src/cli/types.d.ts.map +0 -1
- package/dist/src/cli/update.d.ts.map +0 -1
- package/dist/src/cli/uuid.d.ts.map +0 -1
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/fixtures/loader.d.ts.map +0 -1
- package/dist/src/lib/assets/assets.d.ts.map +0 -1
- package/dist/src/lib/assets/defaultTestObjects.d.ts.map +0 -1
- package/dist/src/lib/assets/deploy.d.ts.map +0 -1
- package/dist/src/lib/assets/destroy.d.ts.map +0 -1
- package/dist/src/lib/assets/helm.d.ts.map +0 -1
- package/dist/src/lib/assets/index.d.ts.map +0 -1
- package/dist/src/lib/assets/loader.d.ts.map +0 -1
- package/dist/src/lib/assets/networking.d.ts.map +0 -1
- package/dist/src/lib/assets/pods.d.ts.map +0 -1
- package/dist/src/lib/assets/rbac.d.ts.map +0 -1
- package/dist/src/lib/assets/store.d.ts.map +0 -1
- package/dist/src/lib/assets/webhooks.d.ts.map +0 -1
- package/dist/src/lib/assets/yaml/generateAllYaml.d.ts.map +0 -1
- package/dist/src/lib/assets/yaml/generateZarfYaml.d.ts.map +0 -1
- package/dist/src/lib/assets/yaml/overridesFile.d.ts.map +0 -1
- package/dist/src/lib/common-types.d.ts.map +0 -1
- package/dist/src/lib/controller/index.d.ts.map +0 -1
- package/dist/src/lib/controller/index.util.d.ts.map +0 -1
- package/dist/src/lib/controller/store.d.ts.map +0 -1
- package/dist/src/lib/controller/storeCache.d.ts.map +0 -1
- package/dist/src/lib/core/capability.d.ts.map +0 -1
- package/dist/src/lib/core/envChecks.d.ts.map +0 -1
- package/dist/src/lib/core/module.d.ts.map +0 -1
- package/dist/src/lib/core/queue.d.ts.map +0 -1
- package/dist/src/lib/core/schedule.d.ts.map +0 -1
- package/dist/src/lib/core/storage.d.ts.map +0 -1
- package/dist/src/lib/deploymentChecks.d.ts.map +0 -1
- package/dist/src/lib/enums.d.ts.map +0 -1
- package/dist/src/lib/errors.d.ts.map +0 -1
- package/dist/src/lib/filesystemService.d.ts.map +0 -1
- package/dist/src/lib/filter/adjudicators/admissionRequest.d.ts.map +0 -1
- package/dist/src/lib/filter/adjudicators/binding.d.ts.map +0 -1
- package/dist/src/lib/filter/adjudicators/defaultTestObjects.d.ts.map +0 -1
- package/dist/src/lib/filter/adjudicators/kubernetesObject.d.ts.map +0 -1
- package/dist/src/lib/filter/adjudicators/mismatch.d.ts.map +0 -1
- package/dist/src/lib/filter/adjudicators/postCollection.d.ts.map +0 -1
- package/dist/src/lib/filter/filter.d.ts.map +0 -1
- package/dist/src/lib/finalizer.d.ts.map +0 -1
- package/dist/src/lib/helpers.d.ts.map +0 -1
- package/dist/src/lib/included-files.d.ts.map +0 -1
- package/dist/src/lib/k8s.d.ts.map +0 -1
- package/dist/src/lib/mutate-request.d.ts.map +0 -1
- package/dist/src/lib/processors/decode-utils.d.ts.map +0 -1
- package/dist/src/lib/processors/mutate-processor.d.ts.map +0 -1
- package/dist/src/lib/processors/validate-processor.d.ts.map +0 -1
- package/dist/src/lib/processors/watch-processor.d.ts.map +0 -1
- package/dist/src/lib/telemetry/logger.d.ts.map +0 -1
- package/dist/src/lib/telemetry/metrics.d.ts.map +0 -1
- package/dist/src/lib/telemetry/timeUtils.d.ts.map +0 -1
- package/dist/src/lib/telemetry/webhookTimeouts.d.ts.map +0 -1
- package/dist/src/lib/tls.d.ts.map +0 -1
- package/dist/src/lib/types.d.ts.map +0 -1
- package/dist/src/lib/utils.d.ts.map +0 -1
- package/dist/src/lib/validate-request.d.ts.map +0 -1
- package/dist/src/lib.d.ts.map +0 -1
- package/dist/src/sdk/cosign.d.ts +0 -18
- package/dist/src/sdk/cosign.d.ts.map +0 -1
- package/dist/src/sdk/heredoc.d.ts.map +0 -1
- package/dist/src/sdk/sdk.d.ts.map +0 -1
- package/src/lib/.prettierrc +0 -14
- package/src/sdk/cosign.ts +0 -327
- /package/dist/{src/cli → cli}/banner.d.ts +0 -0
- /package/dist/{src/cli → cli}/build.d.ts +0 -0
- /package/dist/{src/cli → cli}/build.helpers.d.ts +0 -0
- /package/dist/{src/cli → cli}/deploy.d.ts +0 -0
- /package/dist/{src/cli → cli}/dev.d.ts +0 -0
- /package/dist/{src/cli → cli}/format.d.ts +0 -0
- /package/dist/{src/cli → cli}/format.helpers.d.ts +0 -0
- /package/dist/{src/cli → cli}/init/enums.d.ts +0 -0
- /package/dist/{src/cli → cli}/init/index.d.ts +0 -0
- /package/dist/{src/cli → cli}/init/utils.d.ts +0 -0
- /package/dist/{src/cli → cli}/init/walkthrough.d.ts +0 -0
- /package/dist/{src/cli → cli}/kfc.d.ts +0 -0
- /package/dist/{src/cli → cli}/monitor.d.ts +0 -0
- /package/dist/{src/cli → cli}/root.d.ts +0 -0
- /package/dist/{src/cli → cli}/types.d.ts +0 -0
- /package/dist/{src/cli → cli}/update.d.ts +0 -0
- /package/dist/{src/cli → cli}/uuid.d.ts +0 -0
- /package/dist/{src/cli.d.ts → cli.d.ts} +0 -0
- /package/dist/{src/fixtures → fixtures}/loader.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/assets.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/defaultTestObjects.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/deploy.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/destroy.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/helm.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/index.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/loader.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/networking.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/pods.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/rbac.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/store.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/webhooks.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/yaml/generateAllYaml.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/yaml/generateZarfYaml.d.ts +0 -0
- /package/dist/{src/lib → lib}/assets/yaml/overridesFile.d.ts +0 -0
- /package/dist/{src/lib → lib}/common-types.d.ts +0 -0
- /package/dist/{src/lib → lib}/controller/index.d.ts +0 -0
- /package/dist/{src/lib → lib}/controller/index.util.d.ts +0 -0
- /package/dist/{src/lib → lib}/controller/store.d.ts +0 -0
- /package/dist/{src/lib → lib}/controller/storeCache.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/capability.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/envChecks.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/module.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/queue.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/schedule.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/storage.d.ts +0 -0
- /package/dist/{src/lib → lib}/deploymentChecks.d.ts +0 -0
- /package/dist/{src/lib → lib}/enums.d.ts +0 -0
- /package/dist/{src/lib → lib}/errors.d.ts +0 -0
- /package/dist/{src/lib → lib}/filesystemService.d.ts +0 -0
- /package/dist/{src/lib → lib}/filter/adjudicators/admissionRequest.d.ts +0 -0
- /package/dist/{src/lib → lib}/filter/adjudicators/binding.d.ts +0 -0
- /package/dist/{src/lib → lib}/filter/adjudicators/defaultTestObjects.d.ts +0 -0
- /package/dist/{src/lib → lib}/filter/adjudicators/kubernetesObject.d.ts +0 -0
- /package/dist/{src/lib → lib}/filter/adjudicators/mismatch.d.ts +0 -0
- /package/dist/{src/lib → lib}/filter/adjudicators/postCollection.d.ts +0 -0
- /package/dist/{src/lib → lib}/filter/filter.d.ts +0 -0
- /package/dist/{src/lib → lib}/finalizer.d.ts +0 -0
- /package/dist/{src/lib → lib}/helpers.d.ts +0 -0
- /package/dist/{src/lib → lib}/included-files.d.ts +0 -0
- /package/dist/{src/lib → lib}/k8s.d.ts +0 -0
- /package/dist/{src/lib → lib}/mutate-request.d.ts +0 -0
- /package/dist/{src/lib → lib}/processors/decode-utils.d.ts +0 -0
- /package/dist/{src/lib → lib}/processors/mutate-processor.d.ts +0 -0
- /package/dist/{src/lib → lib}/processors/validate-processor.d.ts +0 -0
- /package/dist/{src/lib → lib}/processors/watch-processor.d.ts +0 -0
- /package/dist/{src/lib → lib}/telemetry/logger.d.ts +0 -0
- /package/dist/{src/lib → lib}/telemetry/metrics.d.ts +0 -0
- /package/dist/{src/lib → lib}/telemetry/timeUtils.d.ts +0 -0
- /package/dist/{src/lib → lib}/telemetry/webhookTimeouts.d.ts +0 -0
- /package/dist/{src/lib → lib}/tls.d.ts +0 -0
- /package/dist/{src/lib → lib}/types.d.ts +0 -0
- /package/dist/{src/lib → lib}/utils.d.ts +0 -0
- /package/dist/{src/lib → lib}/validate-request.d.ts +0 -0
- /package/dist/{src/lib.d.ts → lib.d.ts} +0 -0
- /package/dist/{src/runtime → runtime}/controller.d.ts +0 -0
- /package/dist/{src/sdk → sdk}/heredoc.d.ts +0 -0
- /package/dist/{src/sdk → sdk}/sdk.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/runtime/controller.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heredoc.d.ts","sourceRoot":"","sources":["../../src/sdk/heredoc.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAgClF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk/sdk.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAO,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EACpE,aAAa,CAAC,EAAE,YAAY,GAAG,gBAAgB,GAAG,qBAAqB,GACtE,WAAW,EAAE,CAef;AAED;;;;;;;;;GASG;AAEH,wBAAsB,UAAU,CAC9B,EAAE,EAAE,WAAW,EACf,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAC9B,OAAO,EAAE;IACP,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GACA,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,WAAW,EAC3B,kBAAkB,CAAC,EAAE,OAAO,EAC5B,UAAU,CAAC,EAAE,OAAO,GACnB,gBAAgB,EAAE,CAcpB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYzD"}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"!src/**/*.test.ts",
|
|
16
16
|
"!dist/**/*.test.d.ts*"
|
|
17
17
|
],
|
|
18
|
-
"version": "0.46.
|
|
18
|
+
"version": "0.46.3",
|
|
19
19
|
"main": "dist/lib.js",
|
|
20
20
|
"types": "dist/lib.d.ts",
|
|
21
21
|
"scripts": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"prebuild": "rm -fr dist/* && npm run gen-data-json",
|
|
25
25
|
"build": "tsc && node build.mjs && npm pack",
|
|
26
26
|
"build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .",
|
|
27
|
-
"build:image:unicorn": "npm run build && docker buildx build
|
|
27
|
+
"build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr:dev $(node scripts/read-unicorn-build-args.mjs) .",
|
|
28
28
|
"set:version": "node scripts/set-version.js",
|
|
29
29
|
"test": "npm run test:unit && npm run test:journey && npm run test:journey-wasm",
|
|
30
30
|
"test:unit": "npm run gen-data-json && jest src --coverage --detectOpenHandles --coverageDirectory=./coverage --testPathIgnorePatterns='cosign.e2e.test.ts'",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"test:journey-wasm:unicorn": "npm run test:journey:k3d && npm run build && npm run test:journey:image:unicorn && npm run test:journey:run-wasm",
|
|
38
38
|
"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",
|
|
39
39
|
"test:journey:image": "docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev",
|
|
40
|
-
"test:journey:image:unicorn": "docker buildx build
|
|
40
|
+
"test:journey:image:unicorn": "docker buildx build --output type=docker --tag pepr:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr:dev -c pepr-dev",
|
|
41
41
|
"test:journey:run": "jest --detectOpenHandles journey/entrypoint.test.ts && npm run test:journey:upgrade",
|
|
42
42
|
"test:journey:run-wasm": "jest --detectOpenHandles journey/entrypoint-wasm.test.ts",
|
|
43
43
|
"test:journey:upgrade": "npm run test:journey:k3d && npm run test:journey:image && jest --detectOpenHandles journey/pepr-upgrade.test.ts",
|
|
44
|
-
"format:check": "eslint src && prettier src --check",
|
|
45
|
-
"format:fix": "eslint src --fix && prettier src --write",
|
|
44
|
+
"format:check": "eslint src && prettier --config .prettierrc src --check",
|
|
45
|
+
"format:fix": "eslint src --fix && prettier --config .prettierrc src --write",
|
|
46
46
|
"prepare": "if [ \"$NODE_ENV\" != 'production' ]; then husky; fi"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@types/ramda": "0.30.2",
|
|
50
50
|
"express": "4.21.2",
|
|
51
51
|
"fast-json-patch": "3.1.1",
|
|
52
|
-
"
|
|
52
|
+
"heredoc": "^1.3.1",
|
|
53
53
|
"http-status-codes": "^2.3.0",
|
|
54
54
|
"json-pointer": "^0.6.2",
|
|
55
55
|
"kubernetes-fluent-client": "3.4.5",
|
|
@@ -62,18 +62,14 @@
|
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@commitlint/cli": "19.8.0",
|
|
64
64
|
"@commitlint/config-conventional": "19.8.0",
|
|
65
|
-
"@eslint/eslintrc": "^3.3.0",
|
|
66
|
-
"@eslint/js": "^9.21.0",
|
|
67
65
|
"@fast-check/jest": "^2.0.1",
|
|
68
66
|
"@jest/globals": "29.7.0",
|
|
69
67
|
"@types/eslint": "9.6.1",
|
|
70
|
-
"@types/express": "5.0.
|
|
71
|
-
"@types/follow-redirects": "1.14.4",
|
|
68
|
+
"@types/express": "5.0.1",
|
|
72
69
|
"@types/json-pointer": "^1.0.34",
|
|
73
70
|
"@types/node": "22.x.x",
|
|
74
71
|
"@types/node-forge": "1.3.11",
|
|
75
72
|
"@types/uuid": "10.0.0",
|
|
76
|
-
"eslint": "^9.21.0",
|
|
77
73
|
"fast-check": "^4.0.0",
|
|
78
74
|
"globals": "^16.0.0",
|
|
79
75
|
"husky": "^9.1.6",
|
|
@@ -81,7 +77,6 @@
|
|
|
81
77
|
"js-yaml": "^4.1.0",
|
|
82
78
|
"shellcheck": "^3.0.0",
|
|
83
79
|
"ts-jest": "29.2.6",
|
|
84
|
-
"typescript-eslint": "^8.26.0",
|
|
85
80
|
"undici": "^7.0.1"
|
|
86
81
|
},
|
|
87
82
|
"overrides": {
|
package/src/lib/assets/assets.ts
CHANGED
|
@@ -110,16 +110,28 @@ export class Assets {
|
|
|
110
110
|
helm: Record<string, Record<string, string>>,
|
|
111
111
|
): Promise<void> => {
|
|
112
112
|
if (validateWebhook || mutateWebhook) {
|
|
113
|
-
await fs.writeFile(
|
|
114
|
-
|
|
113
|
+
await fs.writeFile(
|
|
114
|
+
helm.files.admissionDeploymentYaml,
|
|
115
|
+
dedent(admissionDeployTemplate(this.buildTimestamp)),
|
|
116
|
+
);
|
|
117
|
+
await fs.writeFile(
|
|
118
|
+
helm.files.admissionServiceMonitorYaml,
|
|
119
|
+
dedent(serviceMonitorTemplate("admission")),
|
|
120
|
+
);
|
|
115
121
|
}
|
|
116
122
|
|
|
117
123
|
if (mutateWebhook) {
|
|
118
|
-
await fs.writeFile(
|
|
124
|
+
await fs.writeFile(
|
|
125
|
+
helm.files.mutationWebhookYaml,
|
|
126
|
+
createWebhookYaml(this.name, this.config, mutateWebhook),
|
|
127
|
+
);
|
|
119
128
|
}
|
|
120
129
|
|
|
121
130
|
if (validateWebhook) {
|
|
122
|
-
await fs.writeFile(
|
|
131
|
+
await fs.writeFile(
|
|
132
|
+
helm.files.validationWebhookYaml,
|
|
133
|
+
createWebhookYaml(this.name, this.config, validateWebhook),
|
|
134
|
+
);
|
|
123
135
|
}
|
|
124
136
|
};
|
|
125
137
|
|
|
@@ -144,18 +156,27 @@ export class Assets {
|
|
|
144
156
|
const moduleHash = crypto.createHash("sha256").update(code).digest("hex");
|
|
145
157
|
|
|
146
158
|
const pairs: [string, () => string][] = [
|
|
147
|
-
[
|
|
159
|
+
[
|
|
160
|
+
helm.files.chartYaml,
|
|
161
|
+
(): string => dedent(chartYaml(this.config.uuid, this.config.description || "")),
|
|
162
|
+
],
|
|
148
163
|
[helm.files.namespaceYaml, (): string => dedent(namespaceTemplate())],
|
|
149
164
|
[helm.files.watcherServiceYaml, (): string => toYaml(watcherService(this.name))],
|
|
150
165
|
[helm.files.admissionServiceYaml, (): string => toYaml(service(this.name))],
|
|
151
166
|
[helm.files.tlsSecretYaml, (): string => toYaml(tlsSecret(this.name, this.tls))],
|
|
152
|
-
[
|
|
167
|
+
[
|
|
168
|
+
helm.files.apiPathSecretYaml,
|
|
169
|
+
(): string => toYaml(apiPathSecret(this.name, this.apiPath)),
|
|
170
|
+
],
|
|
153
171
|
[helm.files.storeRoleYaml, (): string => toYaml(storeRole(this.name))],
|
|
154
172
|
[helm.files.storeRoleBindingYaml, (): string => toYaml(storeRoleBinding(this.name))],
|
|
155
173
|
[helm.files.clusterRoleYaml, (): string => dedent(clusterRoleTemplate())],
|
|
156
174
|
[helm.files.clusterRoleBindingYaml, (): string => toYaml(clusterRoleBinding(this.name))],
|
|
157
175
|
[helm.files.serviceAccountYaml, (): string => toYaml(serviceAccount(this.name))],
|
|
158
|
-
[
|
|
176
|
+
[
|
|
177
|
+
helm.files.moduleSecretYaml,
|
|
178
|
+
(): string => toYaml(getModuleSecret(this.name, code, moduleHash)),
|
|
179
|
+
],
|
|
159
180
|
];
|
|
160
181
|
await Promise.all(pairs.map(async ([file, content]) => await fs.writeFile(file, content())));
|
|
161
182
|
|
|
@@ -170,16 +191,30 @@ export class Assets {
|
|
|
170
191
|
await overridesFile(overrideData, helm.files.valuesYaml, this.imagePullSecrets);
|
|
171
192
|
|
|
172
193
|
const webhooks = {
|
|
173
|
-
mutate: await webhookGeneratorFunction(
|
|
174
|
-
|
|
194
|
+
mutate: await webhookGeneratorFunction(
|
|
195
|
+
this,
|
|
196
|
+
WebhookType.MUTATE,
|
|
197
|
+
this.config.webhookTimeout,
|
|
198
|
+
),
|
|
199
|
+
validate: await webhookGeneratorFunction(
|
|
200
|
+
this,
|
|
201
|
+
WebhookType.VALIDATE,
|
|
202
|
+
this.config.webhookTimeout,
|
|
203
|
+
),
|
|
175
204
|
};
|
|
176
205
|
|
|
177
206
|
await this.writeWebhookFiles(webhooks.validate, webhooks.mutate, helm);
|
|
178
207
|
|
|
179
208
|
const watchDeployment = getWatcher(this, moduleHash, this.buildTimestamp);
|
|
180
209
|
if (watchDeployment) {
|
|
181
|
-
await fs.writeFile(
|
|
182
|
-
|
|
210
|
+
await fs.writeFile(
|
|
211
|
+
helm.files.watcherDeploymentYaml,
|
|
212
|
+
dedent(watcherDeployTemplate(this.buildTimestamp)),
|
|
213
|
+
);
|
|
214
|
+
await fs.writeFile(
|
|
215
|
+
helm.files.watcherServiceMonitorYaml,
|
|
216
|
+
dedent(serviceMonitorTemplate("watcher")),
|
|
217
|
+
);
|
|
183
218
|
}
|
|
184
219
|
} catch (err) {
|
|
185
220
|
console.error(`Error generating helm chart: ${err.message}`);
|
|
@@ -35,7 +35,12 @@ export const createMockBinding = (
|
|
|
35
35
|
kindDetails: { group?: string; version?: string; kind?: string; plural?: string } = {},
|
|
36
36
|
options: { isWatch?: boolean; event?: Event; isFinalize?: boolean } = {},
|
|
37
37
|
): Binding => {
|
|
38
|
-
const {
|
|
38
|
+
const {
|
|
39
|
+
group = "pepr.dev",
|
|
40
|
+
version = "v1",
|
|
41
|
+
kind = "peprstore",
|
|
42
|
+
plural = "peprstores",
|
|
43
|
+
} = kindDetails;
|
|
39
44
|
|
|
40
45
|
const { isWatch = false, event = Event.CREATE, isFinalize } = options;
|
|
41
46
|
|
|
@@ -63,7 +68,13 @@ export const createMockCapability = (
|
|
|
63
68
|
export const mockCapabilities: CapabilityExport[] = [
|
|
64
69
|
createMockCapability(),
|
|
65
70
|
createMockCapability(
|
|
66
|
-
[
|
|
71
|
+
[
|
|
72
|
+
createMockRbacRule(
|
|
73
|
+
["apiextensions.k8s.io"],
|
|
74
|
+
["customresourcedefinitions"],
|
|
75
|
+
["patch", "create"],
|
|
76
|
+
),
|
|
77
|
+
],
|
|
67
78
|
[
|
|
68
79
|
createMockBinding(
|
|
69
80
|
{
|
package/src/lib/assets/deploy.ts
CHANGED
|
@@ -10,13 +10,22 @@ import { Assets } from "./assets";
|
|
|
10
10
|
import Log from "../telemetry/logger";
|
|
11
11
|
import { apiPathSecret, service, tlsSecret, watcherService } from "./networking";
|
|
12
12
|
import { getDeployment, getModuleSecret, getNamespace, getWatcher } from "./pods";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
clusterRole,
|
|
15
|
+
clusterRoleBinding,
|
|
16
|
+
serviceAccount,
|
|
17
|
+
storeRole,
|
|
18
|
+
storeRoleBinding,
|
|
19
|
+
} from "./rbac";
|
|
14
20
|
import { peprStoreCRD } from "./store";
|
|
15
21
|
import { webhookConfigGenerator } from "./webhooks";
|
|
16
22
|
import { CapabilityExport, ImagePullSecret } from "../types";
|
|
17
23
|
import { WebhookType } from "../enums";
|
|
18
24
|
|
|
19
|
-
export async function deployImagePullSecret(
|
|
25
|
+
export async function deployImagePullSecret(
|
|
26
|
+
imagePullSecret: ImagePullSecret,
|
|
27
|
+
name: string,
|
|
28
|
+
): Promise<void> {
|
|
20
29
|
try {
|
|
21
30
|
await K8s(kind.Namespace).Get("pepr-system");
|
|
22
31
|
} catch {
|
|
@@ -61,12 +70,18 @@ async function handleWebhookConfiguration(
|
|
|
61
70
|
Log.info(`Applying ${type} webhook`);
|
|
62
71
|
await K8s(kindMap[type]).Apply(webhookConfig, { force });
|
|
63
72
|
} else {
|
|
64
|
-
Log.info(
|
|
73
|
+
Log.info(
|
|
74
|
+
`${type.charAt(0).toUpperCase() + type.slice(1)} webhook not needed, removing if it exists`,
|
|
75
|
+
);
|
|
65
76
|
await K8s(kindMap[type]).Delete(assets.name);
|
|
66
77
|
}
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
export async function deployWebhook(
|
|
80
|
+
export async function deployWebhook(
|
|
81
|
+
assets: Assets,
|
|
82
|
+
force: boolean,
|
|
83
|
+
webhookTimeout: number,
|
|
84
|
+
): Promise<void> {
|
|
70
85
|
Log.info("Establishing connection to Kubernetes");
|
|
71
86
|
|
|
72
87
|
Log.info("Applying pepr-system namespace");
|
|
@@ -121,7 +136,12 @@ async function setupRBAC(
|
|
|
121
136
|
await K8s(kind.RoleBinding).Apply(roleBinding, { force });
|
|
122
137
|
}
|
|
123
138
|
|
|
124
|
-
async function setupController(
|
|
139
|
+
async function setupController(
|
|
140
|
+
assets: Assets,
|
|
141
|
+
code: Buffer,
|
|
142
|
+
hash: string,
|
|
143
|
+
force: boolean,
|
|
144
|
+
): Promise<void> {
|
|
125
145
|
const { name } = assets;
|
|
126
146
|
|
|
127
147
|
Log.info("Applying module secret");
|
package/src/lib/assets/index.ts
CHANGED
|
@@ -49,10 +49,16 @@ export function createWebhookYaml(
|
|
|
49
49
|
},
|
|
50
50
|
];
|
|
51
51
|
|
|
52
|
-
return replacements.reduce(
|
|
52
|
+
return replacements.reduce(
|
|
53
|
+
(updatedYaml, { search, replace }) => replaceString(updatedYaml, search, replace),
|
|
54
|
+
yaml,
|
|
55
|
+
);
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
export function helmLayout(
|
|
58
|
+
export function helmLayout(
|
|
59
|
+
basePath: string,
|
|
60
|
+
unique: string,
|
|
61
|
+
): Record<string, Record<string, string>> {
|
|
56
62
|
const helm: Record<string, Record<string, string>> = {
|
|
57
63
|
dirs: {
|
|
58
64
|
chart: resolve(`${basePath}/${unique}-chart`),
|
package/src/lib/assets/pods.ts
CHANGED
|
@@ -366,7 +366,11 @@ export function getModuleSecret(name: string, data: Buffer, hash: string): kind.
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
export function genEnv(
|
|
369
|
+
export function genEnv(
|
|
370
|
+
config: ModuleConfig,
|
|
371
|
+
watchMode = false,
|
|
372
|
+
ignoreWatchMode = false,
|
|
373
|
+
): V1EnvVar[] {
|
|
370
374
|
const noWatchDef = {
|
|
371
375
|
PEPR_PRETTY_LOG: "false",
|
|
372
376
|
LOG_LEVEL: config.logLevel || "info",
|
|
@@ -15,7 +15,10 @@ import { Binding } from "../types";
|
|
|
15
15
|
|
|
16
16
|
export const peprIgnoreNamespaces: string[] = ["kube-system", "pepr-system"];
|
|
17
17
|
|
|
18
|
-
export const validateRule = (
|
|
18
|
+
export const validateRule = (
|
|
19
|
+
binding: Binding,
|
|
20
|
+
isMutateWebhook: boolean,
|
|
21
|
+
): V1RuleWithOperations | undefined => {
|
|
19
22
|
const { event, kind, isMutate, isValidate } = binding;
|
|
20
23
|
|
|
21
24
|
// Skip invalid bindings based on webhook type
|
|
@@ -54,7 +57,10 @@ export function resolveIgnoreNamespaces(ignoredNSConfig: string[] = []): string[
|
|
|
54
57
|
return namespaces.filter(ns => ns.length > 0);
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
export async function generateWebhookRules(
|
|
60
|
+
export async function generateWebhookRules(
|
|
61
|
+
assets: Assets,
|
|
62
|
+
isMutateWebhook: boolean,
|
|
63
|
+
): Promise<V1RuleWithOperations[]> {
|
|
58
64
|
const { config, capabilities } = assets;
|
|
59
65
|
|
|
60
66
|
const rules = capabilities.flatMap(capability => {
|
|
@@ -76,7 +82,10 @@ export async function webhookConfigGenerator(
|
|
|
76
82
|
const ignore: V1LabelSelectorRequirement[] = [];
|
|
77
83
|
|
|
78
84
|
const { name, tls, config, apiPath, host } = assets;
|
|
79
|
-
const ignoreNS = concat(
|
|
85
|
+
const ignoreNS = concat(
|
|
86
|
+
peprIgnoreNamespaces,
|
|
87
|
+
resolveIgnoreNamespaces(config?.alwaysIgnore?.namespaces),
|
|
88
|
+
);
|
|
80
89
|
|
|
81
90
|
// Add any namespaces to ignore
|
|
82
91
|
if (ignoreNS) {
|
|
@@ -5,7 +5,13 @@ import crypto from "crypto";
|
|
|
5
5
|
import { Assets } from "../assets";
|
|
6
6
|
import { WebhookType } from "../../enums";
|
|
7
7
|
import { apiPathSecret, service, tlsSecret, watcherService } from "../networking";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
clusterRole,
|
|
10
|
+
clusterRoleBinding,
|
|
11
|
+
serviceAccount,
|
|
12
|
+
storeRole,
|
|
13
|
+
storeRoleBinding,
|
|
14
|
+
} from "../rbac";
|
|
9
15
|
import { dumpYaml, V1Deployment } from "@kubernetes/client-node";
|
|
10
16
|
import { getModuleSecret, getNamespace } from "../pods";
|
|
11
17
|
import { promises as fs } from "fs";
|
|
@@ -35,7 +41,11 @@ export async function generateAllYaml(assets: Assets, deployments: deployments):
|
|
|
35
41
|
|
|
36
42
|
const webhooks = {
|
|
37
43
|
mutate: await webhookConfigGenerator(assets, WebhookType.MUTATE, assets.config.webhookTimeout),
|
|
38
|
-
validate: await webhookConfigGenerator(
|
|
44
|
+
validate: await webhookConfigGenerator(
|
|
45
|
+
assets,
|
|
46
|
+
WebhookType.VALIDATE,
|
|
47
|
+
assets.config.webhookTimeout,
|
|
48
|
+
),
|
|
39
49
|
};
|
|
40
50
|
|
|
41
51
|
// Add webhooks and watch deployment if they exist
|
|
@@ -84,7 +84,9 @@ export class Controller {
|
|
|
84
84
|
/** Start the webhook server */
|
|
85
85
|
startServer = (port: number): void => {
|
|
86
86
|
if (this.#running) {
|
|
87
|
-
throw new Error(
|
|
87
|
+
throw new Error(
|
|
88
|
+
"Cannot start Pepr module: Pepr module was not instantiated with deferStart=true",
|
|
89
|
+
);
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
// Load SSL certificate and key
|
|
@@ -96,7 +98,8 @@ export class Controller {
|
|
|
96
98
|
// Get the API path if not in watch mode
|
|
97
99
|
if (!isWatchMode()) {
|
|
98
100
|
// Get the API path from the environment variable or the mounted secret
|
|
99
|
-
this.#path =
|
|
101
|
+
this.#path =
|
|
102
|
+
process.env.PEPR_API_PATH || fs.readFileSync("/app/api-path/value").toString().trim();
|
|
100
103
|
Log.info(`Using API path: ${this.#path}`);
|
|
101
104
|
|
|
102
105
|
if (!this.#path) {
|
|
@@ -223,7 +226,10 @@ export class Controller {
|
|
|
223
226
|
};
|
|
224
227
|
|
|
225
228
|
const reqMetadata = { uid: request.uid, namespace, name };
|
|
226
|
-
Log.info(
|
|
229
|
+
Log.info(
|
|
230
|
+
{ ...reqMetadata, gvk, operation: request.operation, admissionKind },
|
|
231
|
+
"Incoming request",
|
|
232
|
+
);
|
|
227
233
|
Log.debug({ ...reqMetadata, request }, "Incoming request body");
|
|
228
234
|
|
|
229
235
|
// Run the before hook if it exists
|
|
@@ -206,7 +206,16 @@ export class Capability implements CapabilityExport {
|
|
|
206
206
|
|
|
207
207
|
const bindings = this.#bindings;
|
|
208
208
|
const prefix = `${this.#name}: ${model.name}`;
|
|
209
|
-
const commonChain = {
|
|
209
|
+
const commonChain = {
|
|
210
|
+
WithLabel,
|
|
211
|
+
WithAnnotation,
|
|
212
|
+
WithDeletionTimestamp,
|
|
213
|
+
Mutate,
|
|
214
|
+
Validate,
|
|
215
|
+
Watch,
|
|
216
|
+
Reconcile,
|
|
217
|
+
Alias,
|
|
218
|
+
};
|
|
210
219
|
|
|
211
220
|
type CommonChainType = typeof commonChain;
|
|
212
221
|
type ExtendedCommonChainType = CommonChainType & {
|
|
@@ -240,7 +249,9 @@ export class Capability implements CapabilityExport {
|
|
|
240
249
|
...binding,
|
|
241
250
|
isValidate: true,
|
|
242
251
|
validateCallback: async (req, logger = aliasLogger) => {
|
|
243
|
-
Log.info(
|
|
252
|
+
Log.info(
|
|
253
|
+
`Executing validate action with alias: ${binding.alias || "no alias provided"}`,
|
|
254
|
+
);
|
|
244
255
|
return await validateCallback(req, logger);
|
|
245
256
|
},
|
|
246
257
|
});
|
|
@@ -262,7 +273,9 @@ export class Capability implements CapabilityExport {
|
|
|
262
273
|
...binding,
|
|
263
274
|
isMutate: true,
|
|
264
275
|
mutateCallback: async (req, logger = aliasLogger) => {
|
|
265
|
-
Log.info(
|
|
276
|
+
Log.info(
|
|
277
|
+
`Executing mutation action with alias: ${binding.alias || "no alias provided"}`,
|
|
278
|
+
);
|
|
266
279
|
await mutateCallback(req, logger);
|
|
267
280
|
},
|
|
268
281
|
});
|
|
@@ -277,7 +290,9 @@ export class Capability implements CapabilityExport {
|
|
|
277
290
|
log("Watch Action", watchCallback.toString());
|
|
278
291
|
|
|
279
292
|
// Create the child logger and cast it to the expected type
|
|
280
|
-
const aliasLogger = Log.child({
|
|
293
|
+
const aliasLogger = Log.child({
|
|
294
|
+
alias: binding.alias || "no alias provided",
|
|
295
|
+
}) as typeof Log;
|
|
281
296
|
|
|
282
297
|
// Push the binding to the list of bindings for this capability as a new BindingAction
|
|
283
298
|
// with the callback function to preserve
|
|
@@ -298,7 +313,9 @@ export class Capability implements CapabilityExport {
|
|
|
298
313
|
log("Reconcile Action", reconcileCallback.toString());
|
|
299
314
|
|
|
300
315
|
// Create the child logger and cast it to the expected type
|
|
301
|
-
const aliasLogger = Log.child({
|
|
316
|
+
const aliasLogger = Log.child({
|
|
317
|
+
alias: binding.alias || "no alias provided",
|
|
318
|
+
}) as typeof Log;
|
|
302
319
|
|
|
303
320
|
// Push the binding to the list of bindings for this capability as a new BindingAction
|
|
304
321
|
// with the callback function to preserve
|
|
@@ -307,7 +324,9 @@ export class Capability implements CapabilityExport {
|
|
|
307
324
|
isWatch: true,
|
|
308
325
|
isQueue: true,
|
|
309
326
|
watchCallback: async (update, phase, logger = aliasLogger) => {
|
|
310
|
-
Log.info(
|
|
327
|
+
Log.info(
|
|
328
|
+
`Executing reconcile action with alias: ${binding.alias || "no alias provided"}`,
|
|
329
|
+
);
|
|
311
330
|
await reconcileCallback(update, phase, logger);
|
|
312
331
|
},
|
|
313
332
|
});
|
|
@@ -340,8 +359,13 @@ export class Capability implements CapabilityExport {
|
|
|
340
359
|
isWatch: true,
|
|
341
360
|
isFinalize: true,
|
|
342
361
|
event: Event.UPDATE,
|
|
343
|
-
finalizeCallback: async (
|
|
344
|
-
|
|
362
|
+
finalizeCallback: async (
|
|
363
|
+
update: InstanceType<T>,
|
|
364
|
+
logger = aliasLogger,
|
|
365
|
+
): Promise<boolean | void> => {
|
|
366
|
+
Log.info(
|
|
367
|
+
`Executing finalize action with alias: ${binding.alias || "no alias provided"}`,
|
|
368
|
+
);
|
|
345
369
|
return await finalizeCallback(update, logger);
|
|
346
370
|
},
|
|
347
371
|
};
|
package/src/lib/core/module.ts
CHANGED
|
@@ -21,7 +21,11 @@ export class PeprModule {
|
|
|
21
21
|
* @param capabilities The capabilities to be loaded into the Pepr runtime
|
|
22
22
|
* @param opts Options for the Pepr runtime
|
|
23
23
|
*/
|
|
24
|
-
constructor(
|
|
24
|
+
constructor(
|
|
25
|
+
{ description, pepr }: PackageJSON,
|
|
26
|
+
capabilities: Capability[] = [],
|
|
27
|
+
opts: PeprModuleOptions = {},
|
|
28
|
+
) {
|
|
25
29
|
const config: ModuleConfig = clone(pepr);
|
|
26
30
|
config.description = description;
|
|
27
31
|
|
package/src/lib/core/storage.ts
CHANGED
|
@@ -169,7 +169,9 @@ export class Storage implements PeprStore {
|
|
|
169
169
|
// If promise has not resolved before MAX_WAIT_TIME reject
|
|
170
170
|
record.timeout = setTimeout(() => {
|
|
171
171
|
record.unsubscribe!();
|
|
172
|
-
return reject(
|
|
172
|
+
return reject(
|
|
173
|
+
`MAX_WAIT_TIME elapsed: Key ${key} still seen after ${MAX_WAIT_TIME / 1000}s`,
|
|
174
|
+
);
|
|
173
175
|
}, MAX_WAIT_TIME);
|
|
174
176
|
|
|
175
177
|
record.unsubscribe = this.subscribe(data => {
|
|
@@ -29,7 +29,9 @@ export async function checkDeploymentStatus(namespace: string): Promise<boolean>
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// wait for all deployments in the pepr-system namespace to be ready
|
|
32
|
-
export async function namespaceDeploymentsReady(
|
|
32
|
+
export async function namespaceDeploymentsReady(
|
|
33
|
+
namespace: string = "pepr-system",
|
|
34
|
+
): Promise<true | undefined> {
|
|
33
35
|
Log.info(`Checking ${namespace} deployments status...`);
|
|
34
36
|
let ready = false;
|
|
35
37
|
while (!ready) {
|
|
@@ -22,4 +22,7 @@ export const declaredKind = pipe(
|
|
|
22
22
|
(request: AdmissionRequest<KubernetesObject>): string => request?.kind?.kind,
|
|
23
23
|
defaultTo(""),
|
|
24
24
|
);
|
|
25
|
-
export const declaredUid = pipe(
|
|
25
|
+
export const declaredUid = pipe(
|
|
26
|
+
(request: AdmissionRequest<KubernetesObject>): string => request?.uid,
|
|
27
|
+
defaultTo(""),
|
|
28
|
+
);
|
|
@@ -27,13 +27,22 @@ export const definesNameRegex = pipe(definedNameRegex, equals(""), not);
|
|
|
27
27
|
export const definedNamespaces = pipe(binding => binding?.filters?.namespaces, defaultTo([]));
|
|
28
28
|
export const definesNamespaces = pipe(definedNamespaces, equals([]), not);
|
|
29
29
|
|
|
30
|
-
export const definedNamespaceRegexes = pipe(
|
|
30
|
+
export const definedNamespaceRegexes = pipe(
|
|
31
|
+
binding => binding?.filters?.regexNamespaces,
|
|
32
|
+
defaultTo([]),
|
|
33
|
+
);
|
|
31
34
|
export const definesNamespaceRegexes = pipe(definedNamespaceRegexes, equals([]), not);
|
|
32
35
|
|
|
33
|
-
export const definedAnnotations = pipe(
|
|
36
|
+
export const definedAnnotations = pipe(
|
|
37
|
+
(binding: Partial<Binding>) => binding?.filters?.annotations,
|
|
38
|
+
defaultTo({}),
|
|
39
|
+
);
|
|
34
40
|
export const definesAnnotations = pipe(definedAnnotations, equals({}), not);
|
|
35
41
|
|
|
36
|
-
export const definedLabels = pipe(
|
|
42
|
+
export const definedLabels = pipe(
|
|
43
|
+
(binding: Partial<Binding>) => binding?.filters?.labels,
|
|
44
|
+
defaultTo({}),
|
|
45
|
+
);
|
|
37
46
|
export const definesLabels = pipe(definedLabels, equals({}), not);
|
|
38
47
|
|
|
39
48
|
export const definedEvent = (binding: Binding): Event => {
|
|
@@ -82,4 +91,8 @@ export const definedCallback = (binding: Partial<Binding>): DefinedCallbackRetur
|
|
|
82
91
|
binding.isValidate ? binding.validateCallback :
|
|
83
92
|
null;
|
|
84
93
|
};
|
|
85
|
-
export const definedCallbackName = pipe(
|
|
94
|
+
export const definedCallbackName = pipe(
|
|
95
|
+
definedCallback,
|
|
96
|
+
defaultTo({ name: "" }),
|
|
97
|
+
callback => callback.name,
|
|
98
|
+
);
|
|
@@ -15,7 +15,8 @@ export const carriedKind = pipe(
|
|
|
15
15
|
defaultTo("not set"),
|
|
16
16
|
);
|
|
17
17
|
export const carriedVersion = pipe(
|
|
18
|
-
(kubernetesObject: KubernetesObject): string | undefined =>
|
|
18
|
+
(kubernetesObject: KubernetesObject): string | undefined =>
|
|
19
|
+
kubernetesObject?.metadata?.resourceVersion,
|
|
19
20
|
defaultTo("not set"),
|
|
20
21
|
);
|
|
21
22
|
export const carriedName = pipe(
|
|
@@ -40,7 +41,8 @@ export const carriedAnnotations = pipe(
|
|
|
40
41
|
export const carriesAnnotations = pipe(carriedAnnotations, equals({}), not);
|
|
41
42
|
|
|
42
43
|
export const carriedLabels = pipe(
|
|
43
|
-
(kubernetesObject: KubernetesObject): { [key: string]: string } | undefined =>
|
|
44
|
+
(kubernetesObject: KubernetesObject): { [key: string]: string } | undefined =>
|
|
45
|
+
kubernetesObject?.metadata?.labels,
|
|
44
46
|
defaultTo({}),
|
|
45
47
|
);
|
|
46
48
|
export const carriesLabels = pipe(carriedLabels, equals({}), not);
|
|
@@ -32,7 +32,12 @@ import {
|
|
|
32
32
|
carriedNamespace,
|
|
33
33
|
missingDeletionTimestamp,
|
|
34
34
|
} from "./kubernetesObject";
|
|
35
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
declaredOperation,
|
|
37
|
+
declaredGroup,
|
|
38
|
+
declaredVersion,
|
|
39
|
+
declaredKind,
|
|
40
|
+
} from "./admissionRequest";
|
|
36
41
|
import { Event, Operation } from "../../enums";
|
|
37
42
|
import { AdmissionRequest } from "../../common-types";
|
|
38
43
|
|
|
@@ -48,12 +53,20 @@ export const mismatchedName = allPass([
|
|
|
48
53
|
|
|
49
54
|
export const mismatchedNameRegex = allPass([
|
|
50
55
|
pipe(nthArg(0), definesNameRegex),
|
|
51
|
-
pipe(
|
|
56
|
+
pipe(
|
|
57
|
+
(binding, kubernetesObject) =>
|
|
58
|
+
new RegExp(definedNameRegex(binding)).test(carriedName(kubernetesObject)),
|
|
59
|
+
not,
|
|
60
|
+
),
|
|
52
61
|
]);
|
|
53
62
|
|
|
54
63
|
export const mismatchedNamespace = allPass([
|
|
55
64
|
pipe(nthArg(0), definesNamespaces),
|
|
56
|
-
pipe(
|
|
65
|
+
pipe(
|
|
66
|
+
(binding, kubernetesObject) =>
|
|
67
|
+
definedNamespaces(binding).includes(carriedNamespace(kubernetesObject)),
|
|
68
|
+
not,
|
|
69
|
+
),
|
|
57
70
|
]);
|
|
58
71
|
|
|
59
72
|
export const mismatchedNamespaceRegex = allPass([
|
|
@@ -95,12 +108,16 @@ export const metasMismatch = pipe(
|
|
|
95
108
|
|
|
96
109
|
export const mismatchedAnnotations = allPass([
|
|
97
110
|
pipe(nthArg(0), definesAnnotations),
|
|
98
|
-
pipe((binding, kubernetesObject) =>
|
|
111
|
+
pipe((binding, kubernetesObject) =>
|
|
112
|
+
metasMismatch(definedAnnotations(binding), carriedAnnotations(kubernetesObject)),
|
|
113
|
+
),
|
|
99
114
|
]);
|
|
100
115
|
|
|
101
116
|
export const mismatchedLabels = allPass([
|
|
102
117
|
pipe(nthArg(0), definesLabels),
|
|
103
|
-
pipe((binding, kubernetesObject) =>
|
|
118
|
+
pipe((binding, kubernetesObject) =>
|
|
119
|
+
metasMismatch(definedLabels(binding), carriedLabels(kubernetesObject)),
|
|
120
|
+
),
|
|
104
121
|
]);
|
|
105
122
|
|
|
106
123
|
export const mismatchedEvent = pipe(
|
|
@@ -126,5 +143,7 @@ export const mismatchedKind = allPass([
|
|
|
126
143
|
export const operationMatchesEvent = anyPass([
|
|
127
144
|
pipe(nthArg(1), equals(Event.ANY)),
|
|
128
145
|
pipe((operation: Operation, event: Event): boolean => operation.valueOf() === event.valueOf()),
|
|
129
|
-
pipe((operation: Operation, event: Event): boolean =>
|
|
146
|
+
pipe((operation: Operation, event: Event): boolean =>
|
|
147
|
+
operation ? event.includes(operation) : false,
|
|
148
|
+
),
|
|
130
149
|
]);
|