pepr 0.35.0 → 0.36.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.js +1 -1
- package/dist/controller.js +1 -1
- package/dist/lib/capability.d.ts.map +1 -1
- package/dist/lib/filter.d.ts.map +1 -1
- package/dist/lib/helpers.d.ts.map +1 -1
- package/dist/lib/logger.d.ts +1 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/queue.d.ts +19 -3
- package/dist/lib/queue.d.ts.map +1 -1
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/watch-processor.d.ts +7 -5
- package/dist/lib/watch-processor.d.ts.map +1 -1
- package/dist/lib.js +97 -42
- package/dist/lib.js.map +3 -3
- package/dist/sdk/sdk.d.ts +5 -3
- package/dist/sdk/sdk.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/lib/capability.ts +9 -1
- package/src/lib/filter.test.ts +85 -1
- package/src/lib/filter.ts +9 -0
- package/src/lib/helpers.test.ts +34 -0
- package/src/lib/helpers.ts +5 -0
- package/src/lib/queue.test.ts +138 -44
- package/src/lib/queue.ts +48 -13
- package/src/lib/types.ts +3 -0
- package/src/lib/watch-processor.test.ts +89 -124
- package/src/lib/watch-processor.ts +34 -31
- package/src/sdk/sdk.test.ts +46 -13
- package/src/sdk/sdk.ts +15 -6
package/dist/cli.js
CHANGED
|
@@ -1987,7 +1987,7 @@ var gitIgnore = "# Ignore node_modules and Pepr build artifacts\nnode_modules\nd
|
|
|
1987
1987
|
var readmeMd = '# Pepr Module\n\nThis is a Pepr Module. [Pepr](https://github.com/defenseunicorns/pepr) is a type-safe Kubernetes middleware system.\n\nThe `capabilities` directory contains all the capabilities for this module. By default,\na capability is a single typescript file in the format of `capability-name.ts` that is\nimported in the root `pepr.ts` file as `import { HelloPepr } from "./capabilities/hello-pepr";`.\nBecause this is typescript, you can organize this however you choose, e.g. creating a sub-folder\nper-capability or common logic in shared files or folders.\n\nExample Structure:\n\n```\nModule Root\n\u251C\u2500\u2500 package.json\n\u251C\u2500\u2500 pepr.ts\n\u2514\u2500\u2500 capabilities\n \u251C\u2500\u2500 example-one.ts\n \u251C\u2500\u2500 example-three.ts\n \u2514\u2500\u2500 example-two.ts\n```\n';
|
|
1988
1988
|
var peprTS = 'import { PeprModule } from "pepr";\n// cfg loads your pepr configuration from package.json\nimport cfg from "./package.json";\n\n// HelloPepr is a demo capability that is included with Pepr. Comment or delete the line below to remove it.\nimport { HelloPepr } from "./capabilities/hello-pepr";\n\n/**\n * This is the main entrypoint for this Pepr module. It is run when the module is started.\n * This is where you register your Pepr configurations and capabilities.\n */\nnew PeprModule(cfg, [\n // "HelloPepr" is a demo capability that is included with Pepr. Comment or delete the line below to remove it.\n HelloPepr,\n\n // Your additional capabilities go here\n]);\n';
|
|
1989
1989
|
var helloPeprTS = 'import {\n Capability,\n K8s,\n Log,\n PeprMutateRequest,\n RegisterKind,\n a,\n fetch,\n fetchStatus,\n kind,\n} from "pepr";\nimport nock from "nock";\n\n/**\n * The HelloPepr Capability is an example capability to demonstrate some general concepts of Pepr.\n * To test this capability you run `pepr dev`and then run the following command:\n * `kubectl apply -f capabilities/hello-pepr.samples.yaml`\n */\nexport const HelloPepr = new Capability({\n name: "hello-pepr",\n description: "A simple example capability to show how things work.",\n namespaces: ["pepr-demo", "pepr-demo-2"],\n});\n\n// Use the \'When\' function to create a new action, use \'Store\' to persist data\nconst { When, Store } = HelloPepr;\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Namespace) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action removes the label `remove-me` when a Namespace is created.\n * Note we don\'t need to specify the namespace here, because we\'ve already specified\n * it in the Capability definition above.\n */\nWhen(a.Namespace)\n .IsCreated()\n .Mutate(ns => ns.RemoveLabel("remove-me"));\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Watch Action with K8s SSA (Namespace) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action watches for the `pepr-demo-2` namespace to be created, then creates a ConfigMap with\n * the name `pepr-ssa-demo` and adds the namespace UID to the ConfigMap data. Because Pepr uses\n * server-side apply for this operation, the ConfigMap will be created or updated if it already exists.\n */\nWhen(a.Namespace)\n .IsCreated()\n .WithName("pepr-demo-2")\n .Watch(async ns => {\n Log.info("Namespace pepr-demo-2 was created.");\n\n try {\n // Apply the ConfigMap using K8s server-side apply\n await K8s(kind.ConfigMap).Apply({\n metadata: {\n name: "pepr-ssa-demo",\n namespace: "pepr-demo-2",\n },\n data: {\n "ns-uid": ns.metadata.uid,\n },\n });\n } catch (error) {\n // You can use the Log object to log messages to the Pepr controller pod\n Log.error(error, "Failed to apply ConfigMap using server-side apply.");\n }\n\n // You can share data between actions using the Store, including between different types of actions\n Store.setItem("watch-data", "This data was stored by a Watch Action.");\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 1) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This is a single action. They can be in the same file or put imported from other files.\n * In this example, when a ConfigMap is created with the name `example-1`, then add a label and annotation.\n *\n * Equivalent to manually running:\n * `kubectl label configmap example-1 pepr=was-here`\n * `kubectl annotate configmap example-1 pepr.dev=annotations-work-too`\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .WithName("example-1")\n .Mutate(request => {\n request\n .SetLabel("pepr", "was-here")\n .SetAnnotation("pepr.dev", "annotations-work-too");\n\n // Use the Store to persist data between requests and Pepr controller pods\n Store.setItem("example-1", "was-here");\n\n // This data is written asynchronously and can be read back via `Store.getItem()` or `Store.subscribe()`\n Store.setItem("example-1-data", JSON.stringify(request.Raw.data));\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate & Validate Actions (CM Example 2) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This combines 3 different types of actions: \'Mutate\', \'Validate\', and \'Watch\'. The order\n * of the actions is required, but each action is optional. In this example, when a ConfigMap is created\n * with the name `example-2`, then add a label and annotation, validate that the ConfigMap has the label\n * `pepr`, and log the request.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .WithName("example-2")\n .Mutate(request => {\n // This Mutate Action will mutate the request before it is persisted to the cluster\n\n // Use `request.Merge()` to merge the new data with the existing data\n request.Merge({\n metadata: {\n labels: {\n pepr: "was-here",\n },\n annotations: {\n "pepr.dev": "annotations-work-too",\n },\n },\n });\n })\n .Validate(request => {\n // This Validate Action will validate the request before it is persisted to the cluster\n\n // Approve the request if the ConfigMap has the label \'pepr\'\n if (request.HasLabel("pepr")) {\n return request.Approve();\n }\n\n // Otherwise, deny the request with an error message (optional)\n return request.Deny("ConfigMap must have label \'pepr\'");\n })\n .Watch((cm, phase) => {\n // This Watch Action will watch the ConfigMap after it has been persisted to the cluster\n Log.info(cm, `ConfigMap was ${phase} with the name example-2`);\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 2a) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action shows a simple validation that will deny any ConfigMap that has the\n * annotation `evil`. Note that the `Deny()` function takes an optional second parameter that is a\n * user-defined status code to return.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .Validate(request => {\n if (request.HasAnnotation("evil")) {\n return request.Deny("No evil CM annotations allowed.", 400);\n }\n\n return request.Approve();\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 3) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action combines different styles. Unlike the previous actions, this one will look\n * for any ConfigMap in the `pepr-demo` namespace that has the label `change=by-label` during either\n * CREATE or UPDATE. Note that all conditions added such as `WithName()`, `WithLabel()`, `InNamespace()`,\n * are ANDs so all conditions must be true for the request to be processed.\n */\nWhen(a.ConfigMap)\n .IsCreatedOrUpdated()\n .WithLabel("change", "by-label")\n .Mutate(request => {\n // The K8s object e are going to mutate\n const cm = request.Raw;\n\n // Get the username and uid of the K8s request\n const { username, uid } = request.Request.userInfo;\n\n // Store some data about the request in the configmap\n cm.data["username"] = username;\n cm.data["uid"] = uid;\n\n // You can still mix other ways of making changes too\n request.SetAnnotation("pepr.dev", "making-waves");\n });\n\n// This action validates the label `change=by-label` is deleted\nWhen(a.ConfigMap)\n .IsDeleted()\n .WithLabel("change", "by-label")\n .Validate(request => {\n // Log and then always approve the request\n Log.info("CM with label \'change=by-label\' was deleted.");\n return request.Approve();\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 4) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action show how you can use the `Mutate()` function without an inline function.\n * This is useful if you want to keep your actions small and focused on a single task,\n * or if you want to reuse the same function in multiple actions.\n */\nWhen(a.ConfigMap).IsCreated().WithName("example-4").Mutate(example4Cb);\n\n// This function uses the complete type definition, but is not required.\nfunction example4Cb(cm: PeprMutateRequest<a.ConfigMap>) {\n cm.SetLabel("pepr.dev/first", "true");\n cm.SetLabel("pepr.dev/second", "true");\n cm.SetLabel("pepr.dev/third", "true");\n}\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 4a) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This is the same as Example 4, except this only operates on a CM in the `pepr-demo-2` namespace.\n * Note because the Capability defines namespaces, the namespace specified here must be one of those.\n * Alternatively, you can remove the namespace from the Capability definition and specify it here.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .InNamespace("pepr-demo-2")\n .WithName("example-4a")\n .Mutate(example4Cb);\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 5) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action is a bit more complex. It will look for any ConfigMap in the `pepr-demo`\n * namespace that has the label `chuck-norris` during CREATE. When it finds one, it will fetch a\n * random Chuck Norris joke from the API and add it to the ConfigMap. This is a great example of how\n * you can use Pepr to make changes to your K8s objects based on external data.\n *\n * Note the use of the `async` keyword. This is required for any action that uses `await` or `fetch()`.\n *\n * Also note we are passing a type to the `fetch()` function. This is optional, but it will help you\n * avoid mistakes when working with the data returned from the API. You can also use the `as` keyword to\n * cast the data returned from the API.\n *\n * These are equivalent:\n * ```ts\n * const joke = await fetch<TheChuckNorrisJoke>("https://icanhazdadjoke.com/");\n * const joke = await fetch("https://icanhazdadjoke.com/") as TheChuckNorrisJoke;\n * ```\n *\n * Alternatively, you can drop the type completely:\n *\n * ```ts\n * fetch("https://icanhazdadjoke.com")\n * ```\n */\ninterface TheChuckNorrisJoke {\n id: string;\n joke: string;\n status: number;\n}\n\nWhen(a.ConfigMap)\n .IsCreatedOrUpdated()\n .WithLabel("chuck-norris")\n .Mutate(cm => cm.SetLabel("got-jokes", "true"))\n .Watch(async cm => {\n const jokeURL = "https://icanhazdadjoke.com/";\n\n // Set up Nock to mock the API calls globally with header matching\n nock(jokeURL).get("/").reply(200, {\n id: "R7UfaahVfFd",\n joke: "Funny joke goes here.",\n status: 200,\n });\n\n // Try/catch is not needed as a response object will always be returned\n const response = await fetch<TheChuckNorrisJoke>(jokeURL, {\n headers: {\n Accept: "application/json",\n },\n });\n\n // Instead, check the `response.ok` field\n if (response.ok) {\n const { joke } = response.data;\n // Add Joke to the Store\n await Store.setItemAndWait(jokeURL, joke);\n // Add the Chuck Norris joke to the configmap\n try {\n await K8s(kind.ConfigMap).Apply({\n metadata: {\n name: cm.metadata.name,\n namespace: cm.metadata.namespace,\n },\n data: {\n "chuck-says": Store.getItem(jokeURL),\n },\n });\n } catch (error) {\n Log.error(error, "Failed to apply ConfigMap using server-side apply.", {\n cm,\n });\n }\n }\n\n // You can also assert on different HTTP response codes\n if (response.status === fetchStatus.NOT_FOUND) {\n // Do something else\n return;\n }\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Secret Base64 Handling) *\n * ---------------------------------------------------------------------------------------------------\n *\n * The K8s JS client provides incomplete support for base64 encoding/decoding handling for secrets,\n * unlike the GO client. To make this less painful, Pepr automatically handles base64 encoding/decoding\n * secret data before and after the action is executed.\n */\nWhen(a.Secret)\n .IsCreated()\n .WithName("secret-1")\n .Mutate(request => {\n const secret = request.Raw;\n\n // This will be encoded at the end of all processing back to base64: "Y2hhbmdlLXdpdGhvdXQtZW5jb2Rpbmc="\n secret.data.magic = "change-without-encoding";\n\n // You can modify the data directly, and it will be encoded at the end of all processing\n secret.data.example += " - modified by Pepr";\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Untyped Custom Resource) *\n * ---------------------------------------------------------------------------------------------------\n *\n * Out of the box, Pepr supports all the standard Kubernetes objects. However, you can also create\n * your own types. This is useful if you are working with an Operator that creates custom resources.\n * There are two ways to do this, the first is to use the `When()` function with a `GenericKind`,\n * the second is to create a new class that extends `GenericKind` and use the `RegisterKind()` function.\n *\n * This example shows how to use the `When()` function with a `GenericKind`. Note that you\n * must specify the `group`, `version`, and `kind` of the object (if applicable). This is how Pepr knows\n * if the action should be triggered or not. Since we are using a `GenericKind`,\n * Pepr will not be able to provide any intellisense for the object, so you will need to refer to the\n * Kubernetes API documentation for the object you are working with.\n *\n * You will need to wait for the CRD in `hello-pepr.samples.yaml` to be created, then you can apply\n *\n * ```yaml\n * apiVersion: pepr.dev/v1\n * kind: Unicorn\n * metadata:\n * name: example-1\n * namespace: pepr-demo\n * spec:\n * message: replace-me\n * counter: 0\n * ```\n */\nWhen(a.GenericKind, {\n group: "pepr.dev",\n version: "v1",\n kind: "Unicorn",\n})\n .IsCreated()\n .WithName("example-1")\n .Mutate(request => {\n request.Merge({\n spec: {\n message: "Hello Pepr without type data!",\n counter: Math.random(),\n },\n });\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Typed Custom Resource) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This example shows how to use the `RegisterKind()` function to create a new type. This is useful\n * if you are working with an Operator that creates custom resources and you want to have intellisense\n * for the object. Note that you must specify the `group`, `version`, and `kind` of the object (if applicable)\n * as this is how Pepr knows if the action should be triggered or not.\n *\n * Once you register a new Kind with Pepr, you can use the `When()` function with the new Kind. Ideally,\n * you should register custom Kinds at the top of your Capability file or Pepr Module so they are available\n * to all actions, but we are putting it here for demonstration purposes.\n *\n * You will need to wait for the CRD in `hello-pepr.samples.yaml` to be created, then you can apply\n *\n * ```yaml\n * apiVersion: pepr.dev/v1\n * kind: Unicorn\n * metadata:\n * name: example-2\n * namespace: pepr-demo\n * spec:\n * message: replace-me\n * counter: 0\n * ```*\n */\nclass UnicornKind extends a.GenericKind {\n spec: {\n /**\n * JSDoc comments can be added to explain more details about the field.\n *\n * @example\n * ```ts\n * request.Raw.spec.message = "Hello Pepr!";\n * ```\n * */\n message: string;\n counter: number;\n };\n}\n\nRegisterKind(UnicornKind, {\n group: "pepr.dev",\n version: "v1",\n kind: "Unicorn",\n});\n\nWhen(UnicornKind)\n .IsCreated()\n .WithName("example-2")\n .Mutate(request => {\n request.Merge({\n spec: {\n message: "Hello Pepr with type data!",\n counter: Math.random(),\n },\n });\n });\n\n/**\n * A callback function that is called once the Pepr Store is fully loaded.\n */\nStore.onReady(data => {\n Log.info(data, "Pepr Store Ready");\n});\n';
|
|
1990
|
-
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"], version: "0.
|
|
1990
|
+
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"], version: "0.36.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", "build:image": "npm run build && docker buildx build --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", "test:journey": "npm run test:journey:k3d && npm run test:journey: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 test:journey: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:build": "npm run build && npm pack", "test:journey:image": "docker buildx build --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" }, dependencies: { "@types/ramda": "0.30.2", express: "4.21.0", "fast-json-patch": "3.1.1", "json-pointer": "^0.6.2", "kubernetes-fluent-client": "3.0.3", pino: "9.4.0", "pino-pretty": "11.2.2", "prom-client": "15.1.3", ramda: "0.30.1" }, devDependencies: { "@commitlint/cli": "19.5.0", "@commitlint/config-conventional": "19.5.0", "@fast-check/jest": "^2.0.1", "@jest/globals": "29.7.0", "@types/eslint": "9.6.1", "@types/express": "4.17.21", "@types/json-pointer": "^1.0.34", "@types/node": "22.x.x", "@types/node-forge": "1.3.11", "@types/prompts": "2.4.9", "@types/uuid": "10.0.0", "fast-check": "^3.19.0", jest: "29.7.0", "js-yaml": "^4.1.0", nock: "^13.5.4", "ts-jest": "29.2.5" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "7.18.0", "@typescript-eslint/parser": "7.18.0", commander: "12.1.0", esbuild: "0.23.0", eslint: "8.57.0", "node-forge": "1.3.1", prettier: "3.3.3", prompts: "2.4.2", typescript: "5.3.3", uuid: "10.0.0" } };
|
|
1991
1991
|
|
|
1992
1992
|
// src/templates/pepr.code-snippets.json
|
|
1993
1993
|
var pepr_code_snippets_default = {
|
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"], 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"], version: "0.36.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", "build:image": "npm run build && docker buildx build --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", "test:journey": "npm run test:journey:k3d && npm run test:journey: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 test:journey: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:build": "npm run build && npm pack", "test:journey:image": "docker buildx build --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" }, dependencies: { "@types/ramda": "0.30.2", express: "4.21.0", "fast-json-patch": "3.1.1", "json-pointer": "^0.6.2", "kubernetes-fluent-client": "3.0.3", pino: "9.4.0", "pino-pretty": "11.2.2", "prom-client": "15.1.3", ramda: "0.30.1" }, devDependencies: { "@commitlint/cli": "19.5.0", "@commitlint/config-conventional": "19.5.0", "@fast-check/jest": "^2.0.1", "@jest/globals": "29.7.0", "@types/eslint": "9.6.1", "@types/express": "4.17.21", "@types/json-pointer": "^1.0.34", "@types/node": "22.x.x", "@types/node-forge": "1.3.11", "@types/prompts": "2.4.9", "@types/uuid": "10.0.0", "fast-check": "^3.19.0", jest: "29.7.0", "js-yaml": "^4.1.0", nock: "^13.5.4", "ts-jest": "29.2.5" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "7.18.0", "@typescript-eslint/parser": "7.18.0", commander: "12.1.0", esbuild: "0.23.0", eslint: "8.57.0", "node-forge": "1.3.1", prettier: "3.3.3", prompts: "2.4.2", typescript: "5.3.3", uuid: "10.0.0" } };
|
|
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":"capability.d.ts","sourceRoot":"","sources":["../../src/lib/capability.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAA2B,MAAM,0BAA0B,CAAC;AAMnG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAc,QAAQ,E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,WAEP;IAED,IAAI,WAAW,WAEd;IAED,IAAI,UAAU,aAEb;gBAEW,GAAG,EAAE,aAAa;IAU9B;;;;OAIG;IACH,qBAAqB;;MAanB;IAEF;;;;OAIG;IACH,aAAa;;MAaX;IAEF;;;;;;;;OAQG;IACH,IAAI,4CAA6C,gBAAgB,qBA0I/D;CACH"}
|
package/dist/lib/filter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/lib/filter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAa,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAS,MAAM,SAAS,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/lib/filter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAa,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAS,MAAM,SAAS,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,EAAE,WAwGxG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/lib/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAO,gBAAgB,EAAQ,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGpD,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAE7C,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,SAAS,GAAG,IAAI,CAQ1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W/D,CAAC;AAGF,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,UAelC;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAK1E"}
|
package/dist/lib/logger.d.ts
CHANGED
package/dist/lib/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,GAAG,uCAGP,CAAC;AAKH,eAAe,GAAG,CAAC"}
|
package/dist/lib/queue.d.ts
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import { KubernetesObject } from "@kubernetes/client-node";
|
|
2
2
|
import { WatchPhase } from "kubernetes-fluent-client/dist/fluent/types";
|
|
3
|
+
type WatchCallback = (obj: KubernetesObject, phase: WatchPhase) => Promise<void>;
|
|
3
4
|
/**
|
|
4
5
|
* Queue is a FIFO queue for reconciling
|
|
5
6
|
*/
|
|
6
7
|
export declare class Queue<K extends KubernetesObject> {
|
|
7
8
|
#private;
|
|
8
|
-
constructor();
|
|
9
|
-
|
|
9
|
+
constructor(name: string);
|
|
10
|
+
label(): {
|
|
11
|
+
name: string;
|
|
12
|
+
uid: string;
|
|
13
|
+
};
|
|
14
|
+
stats(): {
|
|
15
|
+
queue: {
|
|
16
|
+
name: string;
|
|
17
|
+
uid: string;
|
|
18
|
+
};
|
|
19
|
+
stats: {
|
|
20
|
+
length: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
10
23
|
/**
|
|
11
24
|
* Enqueue adds an item to the queue and returns a promise that resolves when the item is
|
|
12
25
|
* reconciled.
|
|
13
26
|
*
|
|
14
27
|
* @param item The object to reconcile
|
|
28
|
+
* @param type The watch phase requested for reconcile
|
|
29
|
+
* @param reconcile The callback to enqueue for reconcile
|
|
15
30
|
* @returns A promise that resolves when the object is reconciled
|
|
16
31
|
*/
|
|
17
|
-
enqueue(item: K,
|
|
32
|
+
enqueue(item: K, phase: WatchPhase, reconcile: WatchCallback): Promise<void>;
|
|
18
33
|
}
|
|
34
|
+
export {};
|
|
19
35
|
//# sourceMappingURL=queue.d.ts.map
|
package/dist/lib/queue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/lib/queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/lib/queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAIxE,KAAK,aAAa,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAUjF;;GAEG;AACH,qBAAa,KAAK,CAAC,CAAC,SAAS,gBAAgB;;gBAM/B,IAAI,EAAE,MAAM;IAKxB,KAAK;;;;IAIL,KAAK;;;;;;;;;IASL;;;;;;;;OAQG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa;CAsE7D"}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ export type Binding = {
|
|
|
83
83
|
namespaces: string[];
|
|
84
84
|
labels: Record<string, string>;
|
|
85
85
|
annotations: Record<string, string>;
|
|
86
|
+
deletionTimestamp: boolean;
|
|
86
87
|
};
|
|
87
88
|
readonly mutateCallback?: MutateAction<GenericClass, InstanceType<GenericClass>>;
|
|
88
89
|
readonly validateCallback?: ValidateAction<GenericClass, InstanceType<GenericClass>>;
|
|
@@ -125,6 +126,8 @@ export type BindingFilter<T extends GenericClass> = CommonActionChain<T> & {
|
|
|
125
126
|
* @param value
|
|
126
127
|
*/
|
|
127
128
|
WithAnnotation: (key: string, value?: string) => BindingFilter<T>;
|
|
129
|
+
/** Only apply the action if the resource has a deletionTimestamp. */
|
|
130
|
+
WithDeletionTimestamp: () => BindingFilter<T>;
|
|
128
131
|
};
|
|
129
132
|
export type BindingWithName<T extends GenericClass> = BindingFilter<T> & {
|
|
130
133
|
/** Only apply the action if the resource name matches the specified name. */
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE;QACL,CAAC,MAAM,EAAE,MAAM,GAAG;YAChB,QAAQ,EAAE,MAAM,CAAC;YACjB,QAAQ,EAAE,MAAM,CAAC;YACjB,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AACD;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC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,KACxB,OAAO,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { KubernetesObject, WatchEvent } from "kubernetes-fluent-client";
|
|
2
2
|
import { Capability } from "./capability";
|
|
3
|
+
import { Queue } from "./queue";
|
|
3
4
|
/**
|
|
4
|
-
* Get the key for
|
|
5
|
+
* Get the key for an entry in the queues
|
|
5
6
|
*
|
|
6
|
-
* @param obj The object to
|
|
7
|
-
* @returns The key
|
|
7
|
+
* @param obj The object to derive a key from
|
|
8
|
+
* @returns The key to a Queue in the list of queues
|
|
8
9
|
*/
|
|
9
|
-
export declare function
|
|
10
|
+
export declare function queueKey(obj: KubernetesObject): string;
|
|
11
|
+
export declare function getOrCreateQueue(obj: KubernetesObject): Queue<KubernetesObject>;
|
|
10
12
|
/**
|
|
11
13
|
* Entrypoint for setting up watches for all capabilities
|
|
12
14
|
*
|
|
13
15
|
* @param capabilities The capabilities to load watches for
|
|
14
16
|
*/
|
|
15
17
|
export declare function setupWatch(capabilities: Capability[]): void;
|
|
16
|
-
export declare function logEvent(
|
|
18
|
+
export declare function logEvent(event: WatchEvent, message?: string, obj?: KubernetesObject): void;
|
|
17
19
|
//# sourceMappingURL=watch-processor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch-processor.d.ts","sourceRoot":"","sources":["../../src/lib/watch-processor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAO,gBAAgB,EAAY,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEvF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"watch-processor.d.ts","sourceRoot":"","sources":["../../src/lib/watch-processor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAO,gBAAgB,EAAY,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEvF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAOhC;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,gBAAgB,UAkB7C;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,2BAMrD;AAuBD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,UAAU,EAAE,QAMpD;AAqFD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,GAAE,MAAW,EAAE,GAAG,CAAC,EAAE,gBAAgB,QAOvF"}
|
package/dist/lib.js
CHANGED
|
@@ -244,6 +244,12 @@ function shouldSkipRequest(binding, req, capabilityNamespaces) {
|
|
|
244
244
|
const srcObject = operation === "DELETE" /* DELETE */ ? req.oldObject : req.object;
|
|
245
245
|
const { metadata } = srcObject || {};
|
|
246
246
|
const combinedNamespaces = [...namespaces, ...capabilityNamespaces];
|
|
247
|
+
if (binding.event.includes("DELETE" /* Delete */) && binding.filters?.deletionTimestamp) {
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
if (binding.filters?.deletionTimestamp && !req.object.metadata?.deletionTimestamp) {
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
247
253
|
if (!binding.event.includes(operation) && !binding.event.includes("*" /* Any */)) {
|
|
248
254
|
return true;
|
|
249
255
|
}
|
|
@@ -1154,14 +1160,17 @@ async function writeEvent(cr, event, eventType, eventReason, reportingComponent,
|
|
|
1154
1160
|
reportingInstance
|
|
1155
1161
|
});
|
|
1156
1162
|
}
|
|
1157
|
-
function getOwnerRefFrom(
|
|
1158
|
-
const {
|
|
1163
|
+
function getOwnerRefFrom(customResource, blockOwnerDeletion, controller) {
|
|
1164
|
+
const { apiVersion, kind: kind4, metadata } = customResource;
|
|
1165
|
+
const { name, uid } = metadata;
|
|
1159
1166
|
return [
|
|
1160
1167
|
{
|
|
1161
|
-
apiVersion
|
|
1162
|
-
kind:
|
|
1168
|
+
apiVersion,
|
|
1169
|
+
kind: kind4,
|
|
1163
1170
|
uid,
|
|
1164
|
-
name
|
|
1171
|
+
name,
|
|
1172
|
+
...blockOwnerDeletion !== void 0 && { blockOwnerDeletion },
|
|
1173
|
+
...controller !== void 0 && { controller }
|
|
1165
1174
|
}
|
|
1166
1175
|
];
|
|
1167
1176
|
}
|
|
@@ -1189,6 +1198,9 @@ function checkOverlap(bindingFilters, objectFilters) {
|
|
|
1189
1198
|
return matchCount === Object.keys(bindingFilters).length;
|
|
1190
1199
|
}
|
|
1191
1200
|
function filterNoMatchReason(binding, obj, capabilityNamespaces) {
|
|
1201
|
+
if (binding.filters?.deletionTimestamp && !obj.metadata?.deletionTimestamp) {
|
|
1202
|
+
return `Ignoring Watch Callback: Object does not have a deletion timestamp.`;
|
|
1203
|
+
}
|
|
1192
1204
|
if (binding.kind && binding.kind.kind === "Namespace" && binding.filters && binding.filters.namespaces.length !== 0) {
|
|
1193
1205
|
return `Ignoring Watch Callback: Cannot use a namespace filter in a namespace object.`;
|
|
1194
1206
|
}
|
|
@@ -1223,27 +1235,49 @@ function filterNoMatchReason(binding, obj, capabilityNamespaces) {
|
|
|
1223
1235
|
}
|
|
1224
1236
|
|
|
1225
1237
|
// src/lib/queue.ts
|
|
1238
|
+
var import_node_crypto = require("node:crypto");
|
|
1226
1239
|
var Queue = class {
|
|
1240
|
+
#name;
|
|
1241
|
+
#uid;
|
|
1227
1242
|
#queue = [];
|
|
1228
1243
|
#pendingPromise = false;
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
this.#
|
|
1244
|
+
constructor(name) {
|
|
1245
|
+
this.#name = name;
|
|
1246
|
+
this.#uid = `${Date.now()}-${(0, import_node_crypto.randomBytes)(2).toString("hex")}`;
|
|
1247
|
+
}
|
|
1248
|
+
label() {
|
|
1249
|
+
return { name: this.#name, uid: this.#uid };
|
|
1232
1250
|
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1251
|
+
stats() {
|
|
1252
|
+
return {
|
|
1253
|
+
queue: this.label(),
|
|
1254
|
+
stats: {
|
|
1255
|
+
length: this.#queue.length
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1235
1258
|
}
|
|
1236
1259
|
/**
|
|
1237
1260
|
* Enqueue adds an item to the queue and returns a promise that resolves when the item is
|
|
1238
1261
|
* reconciled.
|
|
1239
1262
|
*
|
|
1240
1263
|
* @param item The object to reconcile
|
|
1264
|
+
* @param type The watch phase requested for reconcile
|
|
1265
|
+
* @param reconcile The callback to enqueue for reconcile
|
|
1241
1266
|
* @returns A promise that resolves when the object is reconciled
|
|
1242
1267
|
*/
|
|
1243
|
-
enqueue(item,
|
|
1244
|
-
|
|
1268
|
+
enqueue(item, phase, reconcile) {
|
|
1269
|
+
const note = {
|
|
1270
|
+
queue: this.label(),
|
|
1271
|
+
item: {
|
|
1272
|
+
name: item.metadata?.name,
|
|
1273
|
+
namespace: item.metadata?.namespace,
|
|
1274
|
+
resourceVersion: item.metadata?.resourceVersion
|
|
1275
|
+
}
|
|
1276
|
+
};
|
|
1277
|
+
logger_default.debug(note, "Enqueueing");
|
|
1245
1278
|
return new Promise((resolve, reject) => {
|
|
1246
|
-
this.#queue.push({ item,
|
|
1279
|
+
this.#queue.push({ item, phase, callback: reconcile, resolve, reject });
|
|
1280
|
+
logger_default.debug(this.stats(), "Queue stats - push");
|
|
1247
1281
|
return this.#dequeue();
|
|
1248
1282
|
});
|
|
1249
1283
|
}
|
|
@@ -1264,15 +1298,23 @@ var Queue = class {
|
|
|
1264
1298
|
}
|
|
1265
1299
|
try {
|
|
1266
1300
|
this.#pendingPromise = true;
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1301
|
+
const note = {
|
|
1302
|
+
queue: this.label(),
|
|
1303
|
+
item: {
|
|
1304
|
+
name: element.item.metadata?.name,
|
|
1305
|
+
namespace: element.item.metadata?.namespace,
|
|
1306
|
+
resourceVersion: element.item.metadata?.resourceVersion
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
logger_default.debug(note, "Reconciling");
|
|
1310
|
+
await element.callback(element.item, element.phase);
|
|
1311
|
+
logger_default.debug(note, "Reconciled");
|
|
1271
1312
|
element.resolve();
|
|
1272
1313
|
} catch (e) {
|
|
1273
1314
|
logger_default.debug(`Error reconciling ${element.item.metadata.name}`, { error: e });
|
|
1274
1315
|
element.reject(e);
|
|
1275
1316
|
} finally {
|
|
1317
|
+
logger_default.debug(this.stats(), "Queue stats - shift");
|
|
1276
1318
|
logger_default.debug("Resetting pending promise and dequeuing");
|
|
1277
1319
|
this.#pendingPromise = false;
|
|
1278
1320
|
await this.#dequeue();
|
|
@@ -1281,16 +1323,29 @@ var Queue = class {
|
|
|
1281
1323
|
};
|
|
1282
1324
|
|
|
1283
1325
|
// src/lib/watch-processor.ts
|
|
1284
|
-
var
|
|
1285
|
-
function
|
|
1286
|
-
const options = ["
|
|
1287
|
-
const d3fault = "
|
|
1326
|
+
var queues = {};
|
|
1327
|
+
function queueKey(obj) {
|
|
1328
|
+
const options = ["kind", "kindNs", "kindNsName", "global"];
|
|
1329
|
+
const d3fault = "kind";
|
|
1288
1330
|
let strat = process.env.PEPR_RECONCILE_STRATEGY || d3fault;
|
|
1289
1331
|
strat = options.includes(strat) ? strat : d3fault;
|
|
1290
1332
|
const ns = obj.metadata?.namespace ?? "cluster-scoped";
|
|
1291
1333
|
const kind4 = obj.kind ?? "UnknownKind";
|
|
1292
1334
|
const name = obj.metadata?.name ?? "Unnamed";
|
|
1293
|
-
|
|
1335
|
+
const lookup = {
|
|
1336
|
+
kind: `${kind4}`,
|
|
1337
|
+
kindNs: `${kind4}/${ns}`,
|
|
1338
|
+
kindNsName: `${kind4}/${ns}/${name}`,
|
|
1339
|
+
global: "global"
|
|
1340
|
+
};
|
|
1341
|
+
return lookup[strat];
|
|
1342
|
+
}
|
|
1343
|
+
function getOrCreateQueue(obj) {
|
|
1344
|
+
const key = queueKey(obj);
|
|
1345
|
+
if (!queues[key]) {
|
|
1346
|
+
queues[key] = new Queue(key);
|
|
1347
|
+
}
|
|
1348
|
+
return queues[key];
|
|
1294
1349
|
}
|
|
1295
1350
|
var watchCfg = {
|
|
1296
1351
|
resyncFailureMax: process.env.PEPR_RESYNC_FAILURE_MAX ? parseInt(process.env.PEPR_RESYNC_FAILURE_MAX, 10) : 5,
|
|
@@ -1313,12 +1368,12 @@ function setupWatch(capabilities) {
|
|
|
1313
1368
|
async function runBinding(binding, capabilityNamespaces) {
|
|
1314
1369
|
const phaseMatch = eventToPhaseMap[binding.event] || eventToPhaseMap["*" /* Any */];
|
|
1315
1370
|
logger_default.debug({ watchCfg }, "Effective WatchConfig");
|
|
1316
|
-
const watchCallback = async (obj,
|
|
1317
|
-
if (phaseMatch.includes(
|
|
1371
|
+
const watchCallback = async (obj, phase) => {
|
|
1372
|
+
if (phaseMatch.includes(phase)) {
|
|
1318
1373
|
try {
|
|
1319
1374
|
const filterMatch = filterNoMatchReason(binding, obj, capabilityNamespaces);
|
|
1320
1375
|
if (filterMatch === "") {
|
|
1321
|
-
await binding.watchCallback?.(obj,
|
|
1376
|
+
await binding.watchCallback?.(obj, phase);
|
|
1322
1377
|
} else {
|
|
1323
1378
|
logger_default.debug(filterMatch);
|
|
1324
1379
|
}
|
|
@@ -1327,20 +1382,13 @@ async function runBinding(binding, capabilityNamespaces) {
|
|
|
1327
1382
|
}
|
|
1328
1383
|
}
|
|
1329
1384
|
};
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
queueRecord[key] = new Queue();
|
|
1333
|
-
queueRecord[key].setReconcile(watchCallback);
|
|
1334
|
-
}
|
|
1335
|
-
return queueRecord[key];
|
|
1336
|
-
}
|
|
1337
|
-
const watcher = (0, import_kubernetes_fluent_client5.K8s)(binding.model, binding.filters).Watch(async (obj, type) => {
|
|
1338
|
-
logger_default.debug(obj, `Watch event ${type} received`);
|
|
1339
|
-
const queue = getOrCreateQueue(queueRecordKey(obj));
|
|
1385
|
+
const watcher = (0, import_kubernetes_fluent_client5.K8s)(binding.model, binding.filters).Watch(async (obj, phase) => {
|
|
1386
|
+
logger_default.debug(obj, `Watch event ${phase} received`);
|
|
1340
1387
|
if (binding.isQueue) {
|
|
1341
|
-
|
|
1388
|
+
const queue = getOrCreateQueue(obj);
|
|
1389
|
+
await queue.enqueue(obj, phase, watchCallback);
|
|
1342
1390
|
} else {
|
|
1343
|
-
await watchCallback(obj,
|
|
1391
|
+
await watchCallback(obj, phase);
|
|
1344
1392
|
}
|
|
1345
1393
|
}, watchCfg);
|
|
1346
1394
|
watcher.events.on(import_kubernetes_fluent_client5.WatchEvent.GIVE_UP, (err) => {
|
|
@@ -1376,8 +1424,8 @@ async function runBinding(binding, capabilityNamespaces) {
|
|
|
1376
1424
|
process.exit(1);
|
|
1377
1425
|
}
|
|
1378
1426
|
}
|
|
1379
|
-
function logEvent(
|
|
1380
|
-
const logMessage = `Watch event ${
|
|
1427
|
+
function logEvent(event, message = "", obj) {
|
|
1428
|
+
const logMessage = `Watch event ${event} received${message ? `. ${message}.` : "."}`;
|
|
1381
1429
|
if (obj) {
|
|
1382
1430
|
logger_default.debug(obj, logMessage);
|
|
1383
1431
|
} else {
|
|
@@ -1841,12 +1889,13 @@ var Capability = class {
|
|
|
1841
1889
|
name: "",
|
|
1842
1890
|
namespaces: [],
|
|
1843
1891
|
labels: {},
|
|
1844
|
-
annotations: {}
|
|
1892
|
+
annotations: {},
|
|
1893
|
+
deletionTimestamp: false
|
|
1845
1894
|
}
|
|
1846
1895
|
};
|
|
1847
1896
|
const bindings = this.#bindings;
|
|
1848
1897
|
const prefix = `${this.#name}: ${model.name}`;
|
|
1849
|
-
const commonChain = { WithLabel, WithAnnotation, Mutate, Validate, Watch, Reconcile };
|
|
1898
|
+
const commonChain = { WithLabel, WithAnnotation, WithDeletionTimestamp, Mutate, Validate, Watch, Reconcile };
|
|
1850
1899
|
const isNotEmpty = (value) => Object.keys(value).length > 0;
|
|
1851
1900
|
const log = (message, cbString) => {
|
|
1852
1901
|
const filteredObj = (0, import_ramda6.pickBy)(isNotEmpty, binding.filters);
|
|
@@ -1902,6 +1951,11 @@ var Capability = class {
|
|
|
1902
1951
|
binding.filters.namespaces.push(...namespaces);
|
|
1903
1952
|
return { ...commonChain, WithName };
|
|
1904
1953
|
}
|
|
1954
|
+
function WithDeletionTimestamp() {
|
|
1955
|
+
logger_default.debug("Add deletionTimestamp filter");
|
|
1956
|
+
binding.filters.deletionTimestamp = true;
|
|
1957
|
+
return commonChain;
|
|
1958
|
+
}
|
|
1905
1959
|
function WithName(name) {
|
|
1906
1960
|
logger_default.debug(`Add name filter ${name}`, prefix);
|
|
1907
1961
|
binding.filters.name = name;
|
|
@@ -1922,7 +1976,8 @@ var Capability = class {
|
|
|
1922
1976
|
return {
|
|
1923
1977
|
...commonChain,
|
|
1924
1978
|
InNamespace,
|
|
1925
|
-
WithName
|
|
1979
|
+
WithName,
|
|
1980
|
+
WithDeletionTimestamp
|
|
1926
1981
|
};
|
|
1927
1982
|
}
|
|
1928
1983
|
return {
|