pepr 0.32.0 → 0.32.2

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.
Files changed (40) hide show
  1. package/dist/cli.d.ts +3 -0
  2. package/dist/cli.js +1 -1
  3. package/dist/controller.js +1 -1
  4. package/dist/lib/assets/deploy.d.ts +3 -0
  5. package/dist/lib/assets/destroy.d.ts +2 -0
  6. package/dist/lib/assets/helm.d.ts +5 -0
  7. package/dist/lib/assets/index.d.ts +25 -0
  8. package/dist/lib/assets/loader.d.ts +8 -0
  9. package/dist/lib/assets/networking.d.ts +7 -0
  10. package/dist/lib/assets/pods.d.ts +126 -0
  11. package/dist/lib/assets/rbac.d.ts +14 -0
  12. package/dist/lib/assets/store.d.ts +7 -0
  13. package/dist/lib/assets/webhooks.d.ts +6 -0
  14. package/dist/lib/assets/yaml.d.ts +6 -0
  15. package/dist/lib/capability.d.ts +66 -0
  16. package/dist/lib/controller/index.d.ts +10 -0
  17. package/dist/lib/controller/store.d.ts +7 -0
  18. package/dist/lib/errors.d.ts +12 -0
  19. package/dist/lib/filter.d.ts +11 -0
  20. package/dist/lib/helpers.d.ts +34 -0
  21. package/dist/lib/included-files.d.ts +2 -0
  22. package/dist/lib/k8s.d.ts +132 -0
  23. package/dist/lib/logger.d.ts +3 -0
  24. package/dist/lib/metrics.d.ts +39 -0
  25. package/dist/lib/module.d.ts +62 -0
  26. package/dist/lib/mutate-processor.d.ts +5 -0
  27. package/dist/lib/mutate-request.d.ts +79 -0
  28. package/dist/lib/queue.d.ts +19 -0
  29. package/dist/lib/schedule.d.ts +76 -0
  30. package/dist/lib/storage.d.ts +83 -0
  31. package/dist/lib/tls.d.ts +18 -0
  32. package/dist/lib/types.d.ts +192 -0
  33. package/dist/lib/utils.d.ts +23 -0
  34. package/dist/lib/validate-processor.d.ts +4 -0
  35. package/dist/lib/validate-request.d.ts +55 -0
  36. package/dist/lib/watch-processor.d.ts +10 -0
  37. package/dist/lib.d.ts +11 -0
  38. package/dist/runtime/controller.d.ts +3 -0
  39. package/dist/sdk/sdk.d.ts +38 -0
  40. package/package.json +2 -2
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
package/dist/cli.js CHANGED
@@ -1888,7 +1888,7 @@ var gitIgnore = "# Ignore node_modules and Pepr build artifacts\nnode_modules\nd
1888
1888
  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';
1889
1889
  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';
1890
1890
  var helloPeprTS = 'import {\n Capability,\n K8s,\n Log,\n PeprMutateRequest,\n RegisterKind,\n a,\n fetch,\n fetchStatus,\n kind,\n} from "pepr";\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://api.chucknorris.io/jokes/random?category=dev");\n * const joke = await fetch("https://api.chucknorris.io/jokes/random?category=dev") as TheChuckNorrisJoke;\n * ```\n *\n * Alternatively, you can drop the type completely:\n *\n * ```ts\n * fetch("https://api.chucknorris.io/jokes/random?category=dev")\n * ```\n */\ninterface TheChuckNorrisJoke {\n icon_url: string;\n id: string;\n url: string;\n value: string;\n}\n\nWhen(a.ConfigMap)\n .IsCreated()\n .WithLabel("chuck-norris")\n .Mutate(async change => {\n // Try/catch is not needed as a response object will always be returned\n const response = await fetch<TheChuckNorrisJoke>(\n "https://api.chucknorris.io/jokes/random?category=dev",\n );\n\n // Instead, check the `response.ok` field\n if (response.ok) {\n // Add the Chuck Norris joke to the configmap\n change.Raw.data["chuck-says"] = response.data.value;\n return;\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';
1891
- 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" }, version: "0.32.0", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", 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.0", express: "4.19.2", "fast-json-patch": "3.1.1", "kubernetes-fluent-client": "2.6.1", pino: "9.2.0", "pino-pretty": "11.2.0", "prom-client": "15.1.2", ramda: "0.30.1" }, devDependencies: { "@commitlint/cli": "19.3.0", "@commitlint/config-conventional": "19.2.2", "@jest/globals": "29.7.0", "@types/eslint": "8.56.10", "@types/express": "4.17.21", "@types/node": "18.x.x", "@types/node-forge": "1.3.11", "@types/prompts": "2.4.9", "@types/uuid": "9.0.8", jest: "29.7.0", nock: "13.5.4", "ts-jest": "29.1.4" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "6.15.0", "@typescript-eslint/parser": "6.15.0", commander: "11.1.0", esbuild: "0.19.10", eslint: "8.56.0", "node-forge": "1.3.1", prettier: "3.1.1", prompts: "2.4.2", typescript: "5.3.3", uuid: "9.0.1" } };
1891
+ 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" }, version: "0.32.2", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", 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.0", express: "4.19.2", "fast-json-patch": "3.1.1", "kubernetes-fluent-client": "2.6.1", pino: "9.2.0", "pino-pretty": "11.2.1", "prom-client": "15.1.2", ramda: "0.30.1" }, devDependencies: { "@commitlint/cli": "19.3.0", "@commitlint/config-conventional": "19.2.2", "@jest/globals": "29.7.0", "@types/eslint": "8.56.10", "@types/express": "4.17.21", "@types/node": "18.x.x", "@types/node-forge": "1.3.11", "@types/prompts": "2.4.9", "@types/uuid": "9.0.8", jest: "29.7.0", nock: "13.5.4", "ts-jest": "29.1.4" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "6.15.0", "@typescript-eslint/parser": "6.15.0", commander: "11.1.0", esbuild: "0.19.10", eslint: "8.56.0", "node-forge": "1.3.1", prettier: "3.1.1", prompts: "2.4.2", typescript: "5.3.3", uuid: "9.0.1" } };
1892
1892
 
1893
1893
  // src/templates/pepr.code-snippets.json
1894
1894
  var pepr_code_snippets_default = {
@@ -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" }, version: "0.32.0", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", 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.0", express: "4.19.2", "fast-json-patch": "3.1.1", "kubernetes-fluent-client": "2.6.1", pino: "9.2.0", "pino-pretty": "11.2.0", "prom-client": "15.1.2", ramda: "0.30.1" }, devDependencies: { "@commitlint/cli": "19.3.0", "@commitlint/config-conventional": "19.2.2", "@jest/globals": "29.7.0", "@types/eslint": "8.56.10", "@types/express": "4.17.21", "@types/node": "18.x.x", "@types/node-forge": "1.3.11", "@types/prompts": "2.4.9", "@types/uuid": "9.0.8", jest: "29.7.0", nock: "13.5.4", "ts-jest": "29.1.4" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "6.15.0", "@typescript-eslint/parser": "6.15.0", commander: "11.1.0", esbuild: "0.19.10", eslint: "8.56.0", "node-forge": "1.3.1", prettier: "3.1.1", prompts: "2.4.2", typescript: "5.3.3", uuid: "9.0.1" } };
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" }, version: "0.32.2", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", 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.0", express: "4.19.2", "fast-json-patch": "3.1.1", "kubernetes-fluent-client": "2.6.1", pino: "9.2.0", "pino-pretty": "11.2.1", "prom-client": "15.1.2", ramda: "0.30.1" }, devDependencies: { "@commitlint/cli": "19.3.0", "@commitlint/config-conventional": "19.2.2", "@jest/globals": "29.7.0", "@types/eslint": "8.56.10", "@types/express": "4.17.21", "@types/node": "18.x.x", "@types/node-forge": "1.3.11", "@types/prompts": "2.4.9", "@types/uuid": "9.0.8", jest: "29.7.0", nock: "13.5.4", "ts-jest": "29.1.4" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "6.15.0", "@typescript-eslint/parser": "6.15.0", commander: "11.1.0", esbuild: "0.19.10", eslint: "8.56.0", "node-forge": "1.3.1", prettier: "3.1.1", prompts: "2.4.2", typescript: "5.3.3", uuid: "9.0.1" } };
55
55
 
56
56
  // src/lib/k8s.ts
57
57
  var import_kubernetes_fluent_client = require("kubernetes-fluent-client");
@@ -0,0 +1,3 @@
1
+ import { Assets } from ".";
2
+ export declare function deploy(assets: Assets, force: boolean, webhookTimeout?: number): Promise<void>;
3
+ //# sourceMappingURL=deploy.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function destroyModule(name: string): Promise<void>;
2
+ //# sourceMappingURL=destroy.d.ts.map
@@ -0,0 +1,5 @@
1
+ export declare function nsTemplate(): string;
2
+ export declare function chartYaml(name: string, description?: string): string;
3
+ export declare function watcherDeployTemplate(buildTimestamp: string): string;
4
+ export declare function admissionDeployTemplate(buildTimestamp: string): string;
5
+ //# sourceMappingURL=helm.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { ModuleConfig } from "../module";
2
+ import { TLSOut } from "../tls";
3
+ import { CapabilityExport } from "../types";
4
+ import { WebhookIgnore } from "../k8s";
5
+ export declare class Assets {
6
+ readonly config: ModuleConfig;
7
+ readonly path: string;
8
+ readonly host?: string | undefined;
9
+ readonly name: string;
10
+ readonly tls: TLSOut;
11
+ readonly apiToken: string;
12
+ readonly alwaysIgnore: WebhookIgnore;
13
+ capabilities: CapabilityExport[];
14
+ image: string;
15
+ buildTimestamp: string;
16
+ hash: string;
17
+ constructor(config: ModuleConfig, path: string, host?: string | undefined);
18
+ setHash: (hash: string) => void;
19
+ deploy: (force: boolean, webhookTimeout?: number) => Promise<void>;
20
+ zarfYaml: (path: string) => string;
21
+ zarfYamlChart: (path: string) => string;
22
+ allYaml: (rbacMode: string) => Promise<string>;
23
+ generateHelmChart: (basePath: string) => Promise<void>;
24
+ }
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { CapabilityExport } from "../types";
2
+ /**
3
+ * Read the capabilities from the module by running it in build mode
4
+ * @param path
5
+ * @returns
6
+ */
7
+ export declare function loadCapabilities(path: string): Promise<CapabilityExport[]>;
8
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { kind } from "kubernetes-fluent-client";
2
+ import { TLSOut } from "../tls";
3
+ export declare function apiTokenSecret(name: string, apiToken: string): kind.Secret;
4
+ export declare function tlsSecret(name: string, tls: TLSOut): kind.Secret;
5
+ export declare function service(name: string): kind.Service;
6
+ export declare function watcherService(name: string): kind.Service;
7
+ //# sourceMappingURL=networking.d.ts.map
@@ -0,0 +1,126 @@
1
+ /// <reference types="node" />
2
+ import { V1EnvVar } from "@kubernetes/client-node";
3
+ import { kind } from "kubernetes-fluent-client";
4
+ import { Assets } from ".";
5
+ /** Generate the pepr-system namespace */
6
+ export declare function namespace(namespaceLabels?: Record<string, string>): {
7
+ apiVersion: string;
8
+ kind: string;
9
+ metadata: {
10
+ name: string;
11
+ labels: Record<string, string>;
12
+ };
13
+ } | {
14
+ apiVersion: string;
15
+ kind: string;
16
+ metadata: {
17
+ name: string;
18
+ labels?: undefined;
19
+ };
20
+ };
21
+ export declare function watcher(assets: Assets, hash: string, buildTimestamp: string): {
22
+ apiVersion: string;
23
+ kind: string;
24
+ metadata: {
25
+ name: string;
26
+ namespace: string;
27
+ annotations: {
28
+ "pepr.dev/description": string;
29
+ };
30
+ labels: {
31
+ app: string;
32
+ "pepr.dev/controller": string;
33
+ "pepr.dev/uuid": string;
34
+ };
35
+ };
36
+ spec: {
37
+ replicas: number;
38
+ strategy: {
39
+ type: string;
40
+ };
41
+ selector: {
42
+ matchLabels: {
43
+ app: string;
44
+ "pepr.dev/controller": string;
45
+ };
46
+ };
47
+ template: {
48
+ metadata: {
49
+ annotations: {
50
+ buildTimestamp: string;
51
+ };
52
+ labels: {
53
+ app: string;
54
+ "pepr.dev/controller": string;
55
+ };
56
+ };
57
+ spec: {
58
+ terminationGracePeriodSeconds: number;
59
+ serviceAccountName: string;
60
+ securityContext: {
61
+ runAsUser: number;
62
+ runAsGroup: number;
63
+ runAsNonRoot: boolean;
64
+ fsGroup: number;
65
+ };
66
+ containers: {
67
+ name: string;
68
+ image: string;
69
+ imagePullPolicy: string;
70
+ command: string[];
71
+ readinessProbe: {
72
+ httpGet: {
73
+ path: string;
74
+ port: number;
75
+ scheme: string;
76
+ };
77
+ };
78
+ livenessProbe: {
79
+ httpGet: {
80
+ path: string;
81
+ port: number;
82
+ scheme: string;
83
+ };
84
+ };
85
+ ports: {
86
+ containerPort: number;
87
+ }[];
88
+ resources: {
89
+ requests: {
90
+ memory: string;
91
+ cpu: string;
92
+ };
93
+ limits: {
94
+ memory: string;
95
+ cpu: string;
96
+ };
97
+ };
98
+ securityContext: {
99
+ runAsUser: number;
100
+ runAsGroup: number;
101
+ runAsNonRoot: boolean;
102
+ allowPrivilegeEscalation: boolean;
103
+ capabilities: {
104
+ drop: string[];
105
+ };
106
+ };
107
+ volumeMounts: {
108
+ name: string;
109
+ mountPath: string;
110
+ readOnly: boolean;
111
+ }[];
112
+ env: V1EnvVar[];
113
+ }[];
114
+ volumes: {
115
+ name: string;
116
+ secret: {
117
+ secretName: string;
118
+ };
119
+ }[];
120
+ };
121
+ };
122
+ };
123
+ } | null;
124
+ export declare function deployment(assets: Assets, hash: string, buildTimestamp: string): kind.Deployment;
125
+ export declare function moduleSecret(name: string, data: Buffer, hash: string): kind.Secret;
126
+ //# sourceMappingURL=pods.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { kind } from "kubernetes-fluent-client";
2
+ import { CapabilityExport } from "../types";
3
+ /**
4
+ * Grants the controller access to cluster resources beyond the mutating webhook.
5
+ *
6
+ * @todo: should dynamically generate this based on resources used by the module. will also need to explore how this should work for multiple modules.
7
+ * @returns
8
+ */
9
+ export declare function clusterRole(name: string, capabilities: CapabilityExport[], rbacMode?: string): kind.ClusterRole;
10
+ export declare function clusterRoleBinding(name: string): kind.ClusterRoleBinding;
11
+ export declare function serviceAccount(name: string): kind.ServiceAccount;
12
+ export declare function storeRole(name: string): kind.Role;
13
+ export declare function storeRoleBinding(name: string): kind.RoleBinding;
14
+ //# sourceMappingURL=rbac.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { kind as k } from "kubernetes-fluent-client";
2
+ export declare const group: string, version: string, kind: string;
3
+ export declare const singular: string;
4
+ export declare const plural: string;
5
+ export declare const name: string;
6
+ export declare const peprStoreCRD: k.CustomResourceDefinition;
7
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { V1RuleWithOperations } from "@kubernetes/client-node";
2
+ import { kind } from "kubernetes-fluent-client";
3
+ import { Assets } from ".";
4
+ export declare function generateWebhookRules(assets: Assets, isMutateWebhook: boolean): Promise<V1RuleWithOperations[]>;
5
+ export declare function webhookConfig(assets: Assets, mutateOrValidate: "mutate" | "validate", timeoutSeconds?: number): Promise<kind.MutatingWebhookConfiguration | kind.ValidatingWebhookConfiguration | null>;
6
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { Assets } from ".";
2
+ export declare function overridesFile({ hash, name, image, config, apiToken }: Assets, path: string): Promise<void>;
3
+ export declare function zarfYaml({ name, image, config }: Assets, path: string): string;
4
+ export declare function zarfYamlChart({ name, image, config }: Assets, path: string): string;
5
+ export declare function allYaml(assets: Assets, rbacMode: string): Promise<string>;
6
+ //# sourceMappingURL=yaml.d.ts.map
@@ -0,0 +1,66 @@
1
+ import { GenericClass, GroupVersionKind } from "kubernetes-fluent-client";
2
+ import { PeprStore, Storage } from "./storage";
3
+ import { Schedule } from "./schedule";
4
+ import { Binding, CapabilityCfg, CapabilityExport, WhenSelector } from "./types";
5
+ /**
6
+ * A capability is a unit of functionality that can be registered with the Pepr runtime.
7
+ */
8
+ export declare class Capability implements CapabilityExport {
9
+ #private;
10
+ hasSchedule: boolean;
11
+ /**
12
+ * Run code on a schedule with the capability.
13
+ *
14
+ * @param schedule The schedule to run the code on
15
+ * @returns
16
+ */
17
+ OnSchedule: (schedule: Schedule) => void;
18
+ /**
19
+ * Store is a key-value data store that can be used to persist data that should be shared
20
+ * between requests. Each capability has its own store, and the data is persisted in Kubernetes
21
+ * in the `pepr-system` namespace.
22
+ *
23
+ * Note: You should only access the store from within an action.
24
+ */
25
+ Store: PeprStore;
26
+ /**
27
+ * ScheduleStore is a key-value data store used to persist schedule data that should be shared
28
+ * between intervals. Each Schedule shares store, and the data is persisted in Kubernetes
29
+ * in the `pepr-system` namespace.
30
+ *
31
+ * Note: There is no direct access to schedule store
32
+ */
33
+ ScheduleStore: PeprStore;
34
+ get bindings(): Binding[];
35
+ get name(): string;
36
+ get description(): string;
37
+ get namespaces(): string[];
38
+ constructor(cfg: CapabilityCfg);
39
+ /**
40
+ * Register the store with the capability. This is called automatically by the Pepr controller.
41
+ *
42
+ * @param store
43
+ */
44
+ registerScheduleStore: () => {
45
+ scheduleStore: Storage;
46
+ };
47
+ /**
48
+ * Register the store with the capability. This is called automatically by the Pepr controller.
49
+ *
50
+ * @param store
51
+ */
52
+ registerStore: () => {
53
+ store: Storage;
54
+ };
55
+ /**
56
+ * The When method is used to register a action to be executed when a Kubernetes resource is
57
+ * processed by Pepr. The action will be executed if the resource matches the specified kind and any
58
+ * filters that are applied.
59
+ *
60
+ * @param model the KubernetesObject model to match
61
+ * @param kind if using a custom KubernetesObject not available in `a.*`, specify the GroupVersionKind
62
+ * @returns
63
+ */
64
+ When: <T extends GenericClass>(model: T, kind?: GroupVersionKind) => WhenSelector<T>;
65
+ }
66
+ //# sourceMappingURL=capability.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { Capability } from "../capability";
2
+ import { MutateResponse, AdmissionRequest, ValidateResponse } from "../k8s";
3
+ import { ModuleConfig } from "../module";
4
+ export declare class Controller {
5
+ #private;
6
+ constructor(config: ModuleConfig, capabilities: Capability[], beforeHook?: (req: AdmissionRequest) => void, afterHook?: (res: MutateResponse | ValidateResponse) => void, onReady?: () => void);
7
+ /** Start the webhook server */
8
+ startServer: (port: number) => void;
9
+ }
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { Capability } from "../capability";
2
+ export declare const debounceBackoff = 5000;
3
+ export declare class PeprControllerStore {
4
+ #private;
5
+ constructor(capabilities: Capability[], name: string, onReady?: () => void);
6
+ }
7
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1,12 @@
1
+ export declare const Errors: {
2
+ audit: string;
3
+ ignore: string;
4
+ reject: string;
5
+ };
6
+ export declare const ErrorList: string[];
7
+ /**
8
+ * Validate the error or throw an error
9
+ * @param error
10
+ */
11
+ export declare function ValidateError(error?: string): void;
12
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { AdmissionRequest } from "./k8s";
2
+ import { Binding } from "./types";
3
+ /**
4
+ * shouldSkipRequest determines if a request should be skipped based on the binding filters.
5
+ *
6
+ * @param binding the action binding
7
+ * @param req the incoming request
8
+ * @returns
9
+ */
10
+ export declare function shouldSkipRequest(binding: Binding, req: AdmissionRequest, capabilityNamespaces: string[]): boolean;
11
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1,34 @@
1
+ import { KubernetesObject } from "kubernetes-fluent-client";
2
+ import { Binding, CapabilityExport } from "./types";
3
+ export declare class ValidationError extends Error {
4
+ }
5
+ export declare function validateCapabilityNames(capabilities: CapabilityExport[] | undefined): void;
6
+ export declare function validateHash(expectedHash: string): void;
7
+ type RBACMap = {
8
+ [key: string]: {
9
+ verbs: string[];
10
+ plural: string;
11
+ };
12
+ };
13
+ export declare function checkOverlap(bindingFilters: Record<string, string>, objectFilters: Record<string, string>): boolean;
14
+ /**
15
+ * Decide to run callback after the event comes back from API Server
16
+ **/
17
+ export declare function filterNoMatchReason(binding: Partial<Binding>, obj: Partial<KubernetesObject>, capabilityNamespaces: string[]): string;
18
+ export declare function addVerbIfNotExists(verbs: string[], verb: string): void;
19
+ export declare function createRBACMap(capabilities: CapabilityExport[]): RBACMap;
20
+ export declare function createDirectoryIfNotExists(path: string): Promise<void>;
21
+ export declare function hasEveryOverlap<T>(array1: T[], array2: T[]): boolean;
22
+ export declare function hasAnyOverlap<T>(array1: T[], array2: T[]): boolean;
23
+ export declare function ignoredNamespaceConflict(ignoreNamespaces: string[], bindingNamespaces: string[]): boolean;
24
+ export declare function bindingAndCapabilityNSConflict(bindingNamespaces: string[], capabilityNamespaces: string[]): boolean;
25
+ export declare function generateWatchNamespaceError(ignoredNamespaces: string[], bindingNamespaces: string[], capabilityNamespaces: string[]): string;
26
+ export declare function namespaceComplianceValidator(capability: CapabilityExport, ignoredNamespaces?: string[]): void;
27
+ export declare function checkDeploymentStatus(namespace: string): Promise<boolean>;
28
+ export declare function namespaceDeploymentsReady(namespace?: string): Promise<true | undefined>;
29
+ export declare function secretOverLimit(str: string): boolean;
30
+ export declare const parseTimeout: (value: string, previous: unknown) => number;
31
+ export declare function dedent(file: string): string;
32
+ export declare function replaceString(str: string, stringA: string, stringB: string): string;
33
+ export {};
34
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function createDockerfile(version: string, description: string, includedFiles: string[]): Promise<void>;
2
+ //# sourceMappingURL=included-files.d.ts.map
@@ -0,0 +1,132 @@
1
+ import { GenericKind, GroupVersionKind, KubernetesObject } from "kubernetes-fluent-client";
2
+ export declare enum Operation {
3
+ CREATE = "CREATE",
4
+ UPDATE = "UPDATE",
5
+ DELETE = "DELETE",
6
+ CONNECT = "CONNECT"
7
+ }
8
+ /**
9
+ * PeprStore for internal use by Pepr. This is used to store arbitrary data in the cluster.
10
+ */
11
+ export declare class PeprStore extends GenericKind {
12
+ data: {
13
+ [key: string]: string;
14
+ };
15
+ }
16
+ export declare const peprStoreGVK: {
17
+ kind: string;
18
+ version: string;
19
+ group: string;
20
+ };
21
+ /**
22
+ * GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion
23
+ * to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling
24
+ */
25
+ export interface GroupVersionResource {
26
+ readonly group: string;
27
+ readonly version: string;
28
+ readonly resource: string;
29
+ }
30
+ /**
31
+ * A Kubernetes admission request to be processed by a capability.
32
+ */
33
+ export interface AdmissionRequest<T = KubernetesObject> {
34
+ /** UID is an identifier for the individual request/response. */
35
+ readonly uid: string;
36
+ /** Kind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale) */
37
+ readonly kind: GroupVersionKind;
38
+ /** Resource is the fully-qualified resource being requested (for example, v1.pods) */
39
+ readonly resource: GroupVersionResource;
40
+ /** SubResource is the sub-resource being requested, if any (for example, "status" or "scale") */
41
+ readonly subResource?: string;
42
+ /** RequestKind is the fully-qualified type of the original API request (for example, v1.Pod or autoscaling.v1.Scale). */
43
+ readonly requestKind?: GroupVersionKind;
44
+ /** RequestResource is the fully-qualified resource of the original API request (for example, v1.pods). */
45
+ readonly requestResource?: GroupVersionResource;
46
+ /** RequestSubResource is the sub-resource of the original API request, if any (for example, "status" or "scale"). */
47
+ readonly requestSubResource?: string;
48
+ /**
49
+ * Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and
50
+ * rely on the server to generate the name. If that is the case, this method will return the empty string.
51
+ */
52
+ readonly name: string;
53
+ /** Namespace is the namespace associated with the request (if any). */
54
+ readonly namespace?: string;
55
+ /**
56
+ * Operation is the operation being performed. This may be different than the operation
57
+ * requested. e.g. a patch can result in either a CREATE or UPDATE Operation.
58
+ */
59
+ readonly operation: Operation;
60
+ /** UserInfo is information about the requesting user */
61
+ readonly userInfo: {
62
+ /** The name that uniquely identifies this user among all active users. */
63
+ username?: string;
64
+ /**
65
+ * A unique value that identifies this user across time. If this user is deleted
66
+ * and another user by the same name is added, they will have different UIDs.
67
+ */
68
+ uid?: string;
69
+ /** The names of groups this user is a part of. */
70
+ groups?: string[];
71
+ /** Any additional information provided by the authenticator. */
72
+ extra?: {
73
+ [key: string]: string[];
74
+ };
75
+ };
76
+ /** Object is the object from the incoming request prior to default values being applied */
77
+ readonly object: T;
78
+ /** OldObject is the existing object. Only populated for UPDATE or DELETE requests. */
79
+ readonly oldObject?: T;
80
+ /** DryRun indicates that modifications will definitely not be persisted for this request. Defaults to false. */
81
+ readonly dryRun?: boolean;
82
+ /**
83
+ * Options contains the options for the operation being performed.
84
+ * e.g. `meta.k8s.io/v1.DeleteOptions` or `meta.k8s.io/v1.CreateOptions`. This may be
85
+ * different than the options the caller provided. e.g. for a patch request the performed
86
+ * Operation might be a CREATE, in which case the Options will a
87
+ * `meta.k8s.io/v1.CreateOptions` even though the caller provided `meta.k8s.io/v1.PatchOptions`.
88
+ */
89
+ readonly options?: any;
90
+ }
91
+ export interface MutateResponse {
92
+ /** UID is an identifier for the individual request/response. This must be copied over from the corresponding AdmissionRequest. */
93
+ uid: string;
94
+ /** Allowed indicates whether or not the admission request was permitted. */
95
+ allowed: boolean;
96
+ /** Result contains extra details into why an admission request was denied. This field IS NOT consulted in any way if "Allowed" is "true". */
97
+ result?: string;
98
+ /** The patch body. Currently we only support "JSONPatch" which implements RFC 6902. */
99
+ patch?: string;
100
+ /** The type of Patch. Currently we only allow "JSONPatch". */
101
+ patchType?: "JSONPatch";
102
+ /**
103
+ * AuditAnnotations is an unstructured key value map set by remote admission controller (e.g. error=image-blacklisted).
104
+ *
105
+ * See https://kubernetes.io/docs/reference/labels-annotations-taints/audit-annotations/ for more information
106
+ */
107
+ auditAnnotations?: {
108
+ [key: string]: string;
109
+ };
110
+ /** warnings is a list of warning messages to return to the requesting API client. */
111
+ warnings?: string[];
112
+ }
113
+ export interface ValidateResponse extends MutateResponse {
114
+ /** Status contains extra details into why an admission request was denied. This field IS NOT consulted in any way if "Allowed" is "true". */
115
+ status?: {
116
+ /** A machine-readable description of why this operation is in the
117
+ "Failure" status. If this value is empty there is no information available. */
118
+ code: number;
119
+ /** A human-readable description of the status of this operation. */
120
+ message: string;
121
+ };
122
+ }
123
+ export type WebhookIgnore = {
124
+ /**
125
+ * List of Kubernetes namespaces to always ignore.
126
+ * Any resources in these namespaces will be ignored by Pepr.
127
+ *
128
+ * Note: `kube-system` and `pepr-system` are always ignored.
129
+ */
130
+ namespaces?: string[];
131
+ };
132
+ //# sourceMappingURL=k8s.d.ts.map
@@ -0,0 +1,3 @@
1
+ declare const Log: import("pino").Logger<never>;
2
+ export default Log;
3
+ //# sourceMappingURL=logger.d.ts.map