From 1102f53166f593f844c961629f41e8fc6bf5f77b Mon Sep 17 00:00:00 2001 From: "docs.yml" <> Date: Thu, 7 Nov 2024 14:00:18 +0000 Subject: [PATCH] docs.yml --- site/content/en/v0.38.3/_index.md | 2 +- .../content/en/{v0.36.0 => v0.39.0}/_index.md | 4 +- .../best-practices/_index.md | 0 .../code_of_conduct/_index.md | 0 .../{v0.36.0 => v0.39.0}/community/_index.md | 0 .../community/pepr-media.md | 0 .../{v0.36.0 => v0.39.0}/contribute/_index.md | 5 + .../en/{v0.36.0 => v0.39.0}/faq/_index.md | 9 ++ .../module-examples/_index.md | 0 .../pepr-tutorials/_index.md | 0 .../pepr-tutorials/create-pepr-dashboard.md | 0 .../pepr-tutorials/create-pepr-module.md | 0 .../pepr-tutorials/create-pepr-operator.md | 0 .../en/{v0.36.0 => v0.39.0}/roadmap/_index.md | 0 .../{v0.36.0 => v0.39.0}/security/_index.md | 0 .../en/{v0.36.0 => v0.39.0}/support/_index.md | 0 .../{v0.36.0 => v0.39.0}/user-guide/_index.md | 0 .../user-guide/actions/_index.md | 2 +- .../en/v0.39.0/user-guide/actions/finalize.md | 15 +++ .../user-guide/actions/mutate.md | 0 .../user-guide/actions/reconcile.md | 0 .../actions/using-alias-child-logger.md | 91 ++++++++++++++++++ .../user-guide/actions/validate.md | 0 .../user-guide/actions/watch.md | 0 .../user-guide/capabilities.md | 0 .../user-guide/custom-resources.md | 0 .../user-guide/customization.md | 60 +++++++++++- .../user-guide/filters.md | 2 + .../user-guide/metrics.md | 0 .../user-guide/onschedule.md | 0 .../user-guide/pepr-cli.md | 7 +- .../user-guide/pepr-modules.md | 0 .../{v0.36.0 => v0.39.0}/user-guide/rbac.md | 0 .../en/{v0.36.0 => v0.39.0}/user-guide/sdk.md | 0 .../{v0.36.0 => v0.39.0}/user-guide/store.md | 0 .../user-guide/webassembly.md | 0 site/hugo.yaml | 4 +- .../_images/admission-endpoint.png | Bin .../{v0.36.0 => v0.39.0}/_images/dark.png | Bin .../{v0.36.0 => v0.39.0}/_images/light.png | Bin .../_images/pepr-arch.svg | 0 .../_images/pepr-dashboard-screenshot.png | Bin .../{v0.36.0 => v0.39.0}/_images/pepr.png | Bin .../_images/watcher-endpoint.png | Bin 44 files changed, 189 insertions(+), 12 deletions(-) rename site/content/en/{v0.36.0 => v0.39.0}/_index.md (99%) rename site/content/en/{v0.36.0 => v0.39.0}/best-practices/_index.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/code_of_conduct/_index.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/community/_index.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/community/pepr-media.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/contribute/_index.md (87%) rename site/content/en/{v0.36.0 => v0.39.0}/faq/_index.md (96%) rename site/content/en/{v0.36.0 => v0.39.0}/module-examples/_index.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/pepr-tutorials/_index.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/pepr-tutorials/create-pepr-dashboard.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/pepr-tutorials/create-pepr-module.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/pepr-tutorials/create-pepr-operator.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/roadmap/_index.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/security/_index.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/support/_index.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/_index.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/actions/_index.md (94%) create mode 100644 site/content/en/v0.39.0/user-guide/actions/finalize.md rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/actions/mutate.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/actions/reconcile.md (100%) create mode 100644 site/content/en/v0.39.0/user-guide/actions/using-alias-child-logger.md rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/actions/validate.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/actions/watch.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/capabilities.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/custom-resources.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/customization.md (82%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/filters.md (90%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/metrics.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/onschedule.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/pepr-cli.md (93%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/pepr-modules.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/rbac.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/sdk.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/store.md (100%) rename site/content/en/{v0.36.0 => v0.39.0}/user-guide/webassembly.md (100%) rename site/static/{v0.36.0 => v0.39.0}/_images/admission-endpoint.png (100%) rename site/static/{v0.36.0 => v0.39.0}/_images/dark.png (100%) rename site/static/{v0.36.0 => v0.39.0}/_images/light.png (100%) rename site/static/{v0.36.0 => v0.39.0}/_images/pepr-arch.svg (100%) rename site/static/{v0.36.0 => v0.39.0}/_images/pepr-dashboard-screenshot.png (100%) rename site/static/{v0.36.0 => v0.39.0}/_images/pepr.png (100%) rename site/static/{v0.36.0 => v0.39.0}/_images/watcher-endpoint.png (100%) diff --git a/site/content/en/v0.38.3/_index.md b/site/content/en/v0.38.3/_index.md index ea3d221a6..c707168d9 100644 --- a/site/content/en/v0.38.3/_index.md +++ b/site/content/en/v0.38.3/_index.md @@ -3,7 +3,7 @@ title: Pepr linkTitle: v0.38.3 cascade: type: docs -aliases: ["/current/"] +aliases: [] --- diff --git a/site/content/en/v0.36.0/_index.md b/site/content/en/v0.39.0/_index.md similarity index 99% rename from site/content/en/v0.36.0/_index.md rename to site/content/en/v0.39.0/_index.md index c8f98dcd7..2d80c0433 100644 --- a/site/content/en/v0.36.0/_index.md +++ b/site/content/en/v0.39.0/_index.md @@ -1,9 +1,9 @@ --- title: Pepr -linkTitle: v0.36.0 +linkTitle: v0.39.0 cascade: type: docs -aliases: [] +aliases: ["/current/"] --- diff --git a/site/content/en/v0.36.0/best-practices/_index.md b/site/content/en/v0.39.0/best-practices/_index.md similarity index 100% rename from site/content/en/v0.36.0/best-practices/_index.md rename to site/content/en/v0.39.0/best-practices/_index.md diff --git a/site/content/en/v0.36.0/code_of_conduct/_index.md b/site/content/en/v0.39.0/code_of_conduct/_index.md similarity index 100% rename from site/content/en/v0.36.0/code_of_conduct/_index.md rename to site/content/en/v0.39.0/code_of_conduct/_index.md diff --git a/site/content/en/v0.36.0/community/_index.md b/site/content/en/v0.39.0/community/_index.md similarity index 100% rename from site/content/en/v0.36.0/community/_index.md rename to site/content/en/v0.39.0/community/_index.md diff --git a/site/content/en/v0.36.0/community/pepr-media.md b/site/content/en/v0.39.0/community/pepr-media.md similarity index 100% rename from site/content/en/v0.36.0/community/pepr-media.md rename to site/content/en/v0.39.0/community/pepr-media.md diff --git a/site/content/en/v0.36.0/contribute/_index.md b/site/content/en/v0.39.0/contribute/_index.md similarity index 87% rename from site/content/en/v0.36.0/contribute/_index.md rename to site/content/en/v0.39.0/contribute/_index.md index 7ae129b4f..23f32e22a 100644 --- a/site/content/en/v0.36.0/contribute/_index.md +++ b/site/content/en/v0.39.0/contribute/_index.md @@ -64,6 +64,11 @@ Please follow the coding conventions and style used in the project. Use ESLint a ### Run Tests Locally +> ⚠️ **Warning: Be cautious when creating test cases in `journey/`!** +> +> - Test cases that capture end-to-end/journey behavior are usually stored in [pepr-excellent-examples](https://github.com/defenseunicorns/pepr-excellent-examples) or run as a Github workflow (`.github/workflows`). +> - Journey tests established in `journey/` are from an earlier time in project history. + - Run all tests: `npm test` ### Test a Local Development Version diff --git a/site/content/en/v0.36.0/faq/_index.md b/site/content/en/v0.39.0/faq/_index.md similarity index 96% rename from site/content/en/v0.36.0/faq/_index.md rename to site/content/en/v0.39.0/faq/_index.md index 28c72ebca..5888c2551 100644 --- a/site/content/en/v0.36.0/faq/_index.md +++ b/site/content/en/v0.39.0/faq/_index.md @@ -7,6 +7,14 @@ weight: 80 ## How do I remove the punycode warning? +By default, warnings are removed. You can allow warnings by setting the `PEPR_NODE_WARNINGS` environment variable. + +```bash +PEPR_NODE_WARNINGS="true" +``` + +If you allow warnings, you can disable the specific punycode warning by: + ```bash export NODE_OPTIONS="--disable-warning=DEP0040" ``` @@ -17,6 +25,7 @@ or npx --node-options="--disable-warning=DEP0040" pepr [command] ``` + ## How does Pepr compare to Operator SDK? Pepr and Operator SDK are both frameworks used for building Kubernetes operators and admission controllers. While they share a common goal of simplifying the creation of Kubernetes operators and enhancing Kubernetes functionality, they have different approaches and features. diff --git a/site/content/en/v0.36.0/module-examples/_index.md b/site/content/en/v0.39.0/module-examples/_index.md similarity index 100% rename from site/content/en/v0.36.0/module-examples/_index.md rename to site/content/en/v0.39.0/module-examples/_index.md diff --git a/site/content/en/v0.36.0/pepr-tutorials/_index.md b/site/content/en/v0.39.0/pepr-tutorials/_index.md similarity index 100% rename from site/content/en/v0.36.0/pepr-tutorials/_index.md rename to site/content/en/v0.39.0/pepr-tutorials/_index.md diff --git a/site/content/en/v0.36.0/pepr-tutorials/create-pepr-dashboard.md b/site/content/en/v0.39.0/pepr-tutorials/create-pepr-dashboard.md similarity index 100% rename from site/content/en/v0.36.0/pepr-tutorials/create-pepr-dashboard.md rename to site/content/en/v0.39.0/pepr-tutorials/create-pepr-dashboard.md diff --git a/site/content/en/v0.36.0/pepr-tutorials/create-pepr-module.md b/site/content/en/v0.39.0/pepr-tutorials/create-pepr-module.md similarity index 100% rename from site/content/en/v0.36.0/pepr-tutorials/create-pepr-module.md rename to site/content/en/v0.39.0/pepr-tutorials/create-pepr-module.md diff --git a/site/content/en/v0.36.0/pepr-tutorials/create-pepr-operator.md b/site/content/en/v0.39.0/pepr-tutorials/create-pepr-operator.md similarity index 100% rename from site/content/en/v0.36.0/pepr-tutorials/create-pepr-operator.md rename to site/content/en/v0.39.0/pepr-tutorials/create-pepr-operator.md diff --git a/site/content/en/v0.36.0/roadmap/_index.md b/site/content/en/v0.39.0/roadmap/_index.md similarity index 100% rename from site/content/en/v0.36.0/roadmap/_index.md rename to site/content/en/v0.39.0/roadmap/_index.md diff --git a/site/content/en/v0.36.0/security/_index.md b/site/content/en/v0.39.0/security/_index.md similarity index 100% rename from site/content/en/v0.36.0/security/_index.md rename to site/content/en/v0.39.0/security/_index.md diff --git a/site/content/en/v0.36.0/support/_index.md b/site/content/en/v0.39.0/support/_index.md similarity index 100% rename from site/content/en/v0.36.0/support/_index.md rename to site/content/en/v0.39.0/support/_index.md diff --git a/site/content/en/v0.36.0/user-guide/_index.md b/site/content/en/v0.39.0/user-guide/_index.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/_index.md rename to site/content/en/v0.39.0/user-guide/_index.md diff --git a/site/content/en/v0.36.0/user-guide/actions/_index.md b/site/content/en/v0.39.0/user-guide/actions/_index.md similarity index 94% rename from site/content/en/v0.36.0/user-guide/actions/_index.md rename to site/content/en/v0.39.0/user-guide/actions/_index.md index 79295c142..9e3bffa12 100644 --- a/site/content/en/v0.36.0/user-guide/actions/_index.md +++ b/site/content/en/v0.39.0/user-guide/actions/_index.md @@ -10,7 +10,7 @@ An action is a discrete set of behaviors defined in a single function that acts For example, an action could be responsible for adding a specific label to a Kubernetes resource, or for modifying a specific field in a resource's metadata. Actions can be grouped together within a Capability to provide a more comprehensive set of operations that can be performed on Kubernetes resources. -Actions are `Mutate()`, `Validate()`, `Watch()`, or `Reconcile()`. Both Mutate and Validate actions run during the admission controller lifecycle, while Watch and Reconcile actions run in a separate controller that tracks changes to resources, including existing resources. +Actions are `Mutate()`, `Validate()`, `Watch()`, `Reconcile()`, and `Finalize()`. Both Mutate and Validate actions run during the admission controller lifecycle, while Watch and Reconcile actions run in a separate controller that tracks changes to resources, including existing resource; the Finalize action spans both the admission & afterward. Let's look at some example actions that are included in the `HelloPepr` capability that is created for you when you [`npx pepr init`](./pepr-cli#pepr-init): diff --git a/site/content/en/v0.39.0/user-guide/actions/finalize.md b/site/content/en/v0.39.0/user-guide/actions/finalize.md new file mode 100644 index 000000000..07b190f94 --- /dev/null +++ b/site/content/en/v0.39.0/user-guide/actions/finalize.md @@ -0,0 +1,15 @@ +--- +title: Finalize +weight: 50 +--- + + +A specialized combination of Pepr's [Mutate](../mutate/) & [Watch](../watch/) functionalities that allow a module author to run logic while Kubernetes is [Finalizing](https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/) a resource (i.e. cleaning up related resources _after_ a deleteion request has been accepted). + +This method will: + +1. Inject a finalizer into the `metadata.finalizers` field of the requested resource during the mutation phase of the admission. + +1. Watch appropriate resource lifecycle events & invoke the given callback. + +1. Remove the injected finalizer from the `metadata.finalizers` field of the requested resource. \ No newline at end of file diff --git a/site/content/en/v0.36.0/user-guide/actions/mutate.md b/site/content/en/v0.39.0/user-guide/actions/mutate.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/actions/mutate.md rename to site/content/en/v0.39.0/user-guide/actions/mutate.md diff --git a/site/content/en/v0.36.0/user-guide/actions/reconcile.md b/site/content/en/v0.39.0/user-guide/actions/reconcile.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/actions/reconcile.md rename to site/content/en/v0.39.0/user-guide/actions/reconcile.md diff --git a/site/content/en/v0.39.0/user-guide/actions/using-alias-child-logger.md b/site/content/en/v0.39.0/user-guide/actions/using-alias-child-logger.md new file mode 100644 index 000000000..e919c50a9 --- /dev/null +++ b/site/content/en/v0.39.0/user-guide/actions/using-alias-child-logger.md @@ -0,0 +1,91 @@ +--- +title: Using Alias Child Logger in Actions +weight: 50 +--- + + +You can use the Alias function to include a user-defined alias in the logs for Mutate, Validate, and Watch actions. This can make for easier debugging since your user-defined alias will be included in the action's logs. This is especially useful when you have multiple actions of the same type in a single module. + +The below example uses Mutate, Validate, and Watch actions with the Alias function: + +```ts +When(a.Pod) + .IsCreatedOrUpdated() + .Alias("mutate") + .Mutate((po, logger) => { + logger.info(`alias: mutate ${po.Raw.metadata.name}`); + }); +When(a.Pod) + .IsCreatedOrUpdated() + .Alias("validate") + .Validate((po, logger) => { + logger.info(`alias: validate ${po.Raw.metadata.name}`); + return po.Approve(); + }); +When(a.Pod) + .IsCreatedOrUpdated() + .Alias("watch") + .Watch((po, _, logger) => { + logger.info(`alias: watch ${po.metadata.name}`); + }); +When(a.Pod) + .IsCreatedOrUpdated() + .Alias("reconcile") + .Reconcile((po, _, logger) => { + logger.info(`alias: reconcile ${po.metadata.name}`); + }); +``` + +This will result in log entries when creating a Pod with the that include the alias: + +**Logs for Mutate When Pod `red` is Created:** + +```bash +{"level":30,"time":1726632368808,"pid":16,"hostname":"pepr-static-test-6786948977-6hbnt","uid":"b2221631-e87c-41a2-94c8-cdaef15e7b5f","namespace":"pepr-demo","name":"/red","gvk":{"group":"","version":"v1","kind":"Pod"},"operation":"CREATE","admissionKind":"Mutate","msg":"Incoming request"} +{"level":30,"time":1726632368808,"pid":16,"hostname":"pepr-static-test-6786948977-6hbnt","uid":"b2221631-e87c-41a2-94c8-cdaef15e7b5f","namespace":"pepr-demo","name":"/red","msg":"Processing request"} +{"level":30,"time":1726632368808,"pid":16,"hostname":"pepr-static-test-6786948977-6hbnt","msg":"Executing mutation action with alias: mutate"} +{"level":30,"time":1726632368808,"pid":16,"hostname":"pepr-static-test-6786948977-6hbnt","alias":"mutate","msg":"alias: mutate red"} +{"level":30,"time":1726632368808,"pid":16,"hostname":"pepr-static-test-6786948977-6hbnt","uid":"b2221631-e87c-41a2-94c8-cdaef15e7b5f","namespace":"pepr-demo","name":"hello-pepr","msg":"Mutation action succeeded (mutateCallback)"} +{"level":30,"time":1726632368808,"pid":16,"hostname":"pepr-static-test-6786948977-6hbnt","uid":"b2221631-e87c-41a2-94c8-cdaef15e7b5f","namespace":"pepr-demo","name":"/red","res":{"uid":"b2221631-e87c-41a2-94c8-cdaef15e7b5f","allowed":true,"patchType":"JSONPatch","patch":"W3sib3AiOiJhZGQiLCJwYXRoIjoiL21ldGFkYXRhL2Fubm90YXRpb25zL3N0YXRpYy10ZXN0LnBlcHIuZGV2fjFoZWxsby1wZXByIiwidmFsdWUiOiJzdWNjZWVkZWQifV0="},"msg":"Check response"} +{"level":30,"time":1726632368809,"pid":16,"hostname":"pepr-static-test-6786948977-6hbnt","uid":"b2221631-e87c-41a2-94c8-cdaef15e7b5f","method":"POST","url":"/mutate/c1a7fb6e3f2ab9dc08909d2de4166987520f317d53b759ab882dfd0b1c198479?timeout=10s","status":200,"duration":"1 ms"} +``` + +**Logs for Validate When Pod `red` is Created:** + +```bash +{"level":30,"time":1726631437605,"pid":16,"hostname":"pepr-static-test-6786948977-j7f9h","uid":"731eff93-d457-4ffc-a98c-0bcbe4c1727a","namespace":"pepr-demo","name":"/red","gvk":{"group":"","version":"v1","kind":"Pod"},"operation":"CREATE","admissionKind":"Validate","msg":"Incoming request"} +{"level":30,"time":1726631437606,"pid":16,"hostname":"pepr-static-test-6786948977-j7f9h","uid":"731eff93-d457-4ffc-a98c-0bcbe4c1727a","namespace":"pepr-demo","name":"/red","msg":"Processing validation request"} +{"level":30,"time":1726631437606,"pid":16,"hostname":"pepr-static-test-6786948977-j7f9h","uid":"731eff93-d457-4ffc-a98c-0bcbe4c1727a","namespace":"pepr-demo","name":"hello-pepr","msg":"Processing validation action (validateCallback)"} +{"level":30,"time":1726631437606,"pid":16,"hostname":"pepr-static-test-6786948977-j7f9h","msg":"Executing validate action with alias: validate"} +{"level":30,"time":1726631437606,"pid":16,"hostname":"pepr-static-test-6786948977-j7f9h","alias":"validate","msg":"alias: validate red"} +{"level":30,"time":1726631437606,"pid":16,"hostname":"pepr-static-test-6786948977-j7f9h","uid":"731eff93-d457-4ffc-a98c-0bcbe4c1727a","namespace":"pepr-demo","name":"hello-pepr","msg":"Validation action complete (validateCallback): allowed"} +{"level":30,"time":1726631437606,"pid":16,"hostname":"pepr-static-test-6786948977-j7f9h","uid":"731eff93-d457-4ffc-a98c-0bcbe4c1727a","namespace":"pepr-demo","name":"/red","res":{"uid":"731eff93-d457-4ffc-a98c-0bcbe4c1727a","allowed":true},"msg":"Check response"} +{"level":30,"time":1726631437606,"pid":16,"hostname":"pepr-static-test-6786948977-j7f9h","uid":"731eff93-d457-4ffc-a98c-0bcbe4c1727a","method":"POST","url":"/validate/c1a7fb6e3f2ab9dc08909d2de4166987520f317d53b759ab882dfd0b1c198479?timeout=10s","status":200,"duration":"5 ms"} +``` + +**Logs for Watch and Reconcile When Pod `red` is Created:** + +```bash +{"level":30,"time":1726798504518,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","msg":"Executing reconcile action with alias: reconcile"} +{"level":30,"time":1726798504518,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","alias":"reconcile","msg":"alias: reconcile red"} +{"level":30,"time":1726798504518,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","msg":"Executing watch action with alias: watch"} +{"level":30,"time":1726798504518,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","alias":"watch","msg":"alias: watch red"} +{"level":30,"time":1726798504521,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","msg":"Executing reconcile action with alias: reconcile"} +{"level":30,"time":1726798504521,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","alias":"reconcile","msg":"alias: reconcile red"} +{"level":30,"time":1726798504521,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","msg":"Executing watch action with alias: watch"} +{"level":30,"time":1726798504521,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","alias":"watch","msg":"alias: watch red"} +{"level":30,"time":1726798504528,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","msg":"Executing reconcile action with alias: reconcile"} +{"level":30,"time":1726798504528,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","alias":"reconcile","msg":"alias: reconcile red"} +{"level":30,"time":1726798504528,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","msg":"Executing watch action with alias: watch"} +{"level":30,"time":1726798504528,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","alias":"watch","msg":"alias: watch red"} +{"level":30,"time":1726798510464,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","msg":"Executing watch action with alias: watch"} +{"level":30,"time":1726798510464,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","alias":"watch","msg":"alias: watch red"} +{"level":30,"time":1726798510466,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","msg":"Executing reconcile action with alias: reconcile"} +{"level":30,"time":1726798510466,"pid":16,"hostname":"pepr-static-test-watcher-6dc69654c9-5ql6b","alias":"reconcile","msg":"alias: reconcile red"} +``` + +**Note:** The Alias function is optional and can be used to provide additional context in the logs. You must pass the logger object as shown above to the action to use the Alias function. + +## See Also + +Looking for some more generic helpers? Check out the [Module Author SDK](../../sdk/) for information on other things that Pepr can help with. diff --git a/site/content/en/v0.36.0/user-guide/actions/validate.md b/site/content/en/v0.39.0/user-guide/actions/validate.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/actions/validate.md rename to site/content/en/v0.39.0/user-guide/actions/validate.md diff --git a/site/content/en/v0.36.0/user-guide/actions/watch.md b/site/content/en/v0.39.0/user-guide/actions/watch.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/actions/watch.md rename to site/content/en/v0.39.0/user-guide/actions/watch.md diff --git a/site/content/en/v0.36.0/user-guide/capabilities.md b/site/content/en/v0.39.0/user-guide/capabilities.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/capabilities.md rename to site/content/en/v0.39.0/user-guide/capabilities.md diff --git a/site/content/en/v0.36.0/user-guide/custom-resources.md b/site/content/en/v0.39.0/user-guide/custom-resources.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/custom-resources.md rename to site/content/en/v0.39.0/user-guide/custom-resources.md diff --git a/site/content/en/v0.36.0/user-guide/customization.md b/site/content/en/v0.39.0/user-guide/customization.md similarity index 82% rename from site/content/en/v0.36.0/user-guide/customization.md rename to site/content/en/v0.39.0/user-guide/customization.md index 192b08256..b3f81f7c1 100644 --- a/site/content/en/v0.36.0/user-guide/customization.md +++ b/site/content/en/v0.39.0/user-guide/customization.md @@ -6,11 +6,35 @@ weight: 120 This document outlines how to customize the build output through Helm overrides and `package.json` configurations. +## Redact Store Values from Logs + +By default, the store values are displayed in logs, to redact them you can set the `PEPR_STORE_REDACT_VALUES` environment variable to `true` in the `package.json` file or directly on the Watcher or Admission `Deployment`. The default value is `undefined`. + +```json +{ + "env": { + "PEPR_STORE_REDACT_VALUES": "true" + } +} +``` + +## Display Node Warnings + +You can display warnings in the logs by setting the `PEPR_NODE_WARNINGS` environment variable to `true` in the `package.json` file or directly on the Watcher or Admission `Deployment`. The default value is `undefined`. + +```json +{ + "env": { + "PEPR_NODE_WARNINGS": "true" + } +} +``` + ## Customizing Log Format -The log format can be customized by setting the `PINO_TIME_STAMP` environment variable in the `package.json` file or directly on the Watcher or Admission `Deployment`. The default value is a partial JSON timestamp string representation of the time. If set to `iso`, the timestamp is displayed in an ISO format. +The log format can be customized by setting the `PINO_TIME_STAMP` environment variable in the `package.json` file or directly on the Watcher or Admission `Deployment`. The default value is a partial JSON timestamp string representation of the time. If set to `iso`, the timestamp is displayed in an ISO format. -**Caution**: attempting to format time in-process will significantly impact logging performance. +**Caution**: attempting to format time in-process will significantly impact logging performance. ```json { @@ -26,13 +50,13 @@ With ISO: {"level":30,"time":"2024-05-14T14:26:03.788Z","pid":16,"hostname":"pepr-static-test-7f4d54b6cc-9lxm6","method":"GET","url":"/healthz","status":200,"duration":"1 ms"} ``` -Default (without): +Default (without): ```json {"level":30,"time":"1715696764106","pid":16,"hostname":"pepr-static-test-watcher-559d94447f-xkq2h","method":"GET","url":"/healthz","status":200,"duration":"1 ms"} ``` -## Customizing Watch Configuration +## Customizing Watch Configuration The Watch configuration is a part of the Pepr module that allows you to watch for specific resources in the Kubernetes cluster. The Watch configuration can be customized by specific enviroment variables of the Watcher Deployment and can be set in the field in the `package.json` or in the helm `values.yaml` file. @@ -42,6 +66,7 @@ The Watch configuration is a part of the Pepr module that allows you to watch fo | `PEPR_RETRY_DELAY_SECONDS` | The delay between retries in seconds. | default: `"10"` | | `PEPR_LAST_SEEN_LIMIT_SECONDS` | Max seconds to go without receiving a watch event before re-establishing the watch | default: `"300"` (5 mins) | | `PEPR_RELIST_INTERVAL_SECONDS` | Amount of seconds to wait before a relist of the watched resources | default: `"600"` (10 mins) | +| `PEPR_USE_LEGACY_WATCH` | Configure the Kubernetes Fluent Client to use legacy node-fetch watcher | default: `"undefined"` | ## Configuring Reconcile @@ -108,8 +133,33 @@ Below are the available configurations through `package.json`. | `onError` | Behavior of the webhook failure policy | `reject`, `ignore` | | `webhookTimeout` | Webhook timeout in seconds | `1` - `30` | | `customLabels` | Custom labels for namespaces | `{namespace: {}}` | -| `alwaysIgnore` | Conditions to always ignore | `{namespaces: []}` | +| `alwaysIgnore` | Conditions to always ignore | `{namespaces: []}` | | `includedFiles` | For working with WebAssembly | ["main.wasm", "wasm_exec.js"] | | `env` | Environment variables for the container| `{LOG_LEVEL: "warn"}` | +| `rbac` | Custom RBAC rules (requires building with `rbacMode: scoped`) | `{"rbac": [{"apiGroups": [""], "resources": [""], "verbs": [""]}]}` | +| `rbacMode` | Configures module to build binding RBAC with principal of least privilege | `scoped`, `admin` | These tables provide a comprehensive overview of the fields available for customization within the Helm overrides and the `package.json` file. Modify these according to your deployment requirements. + +### Example Custom RBAC Rules + +The following example demonstrates how to add custom RBAC rules to the Pepr module. + +```json +{ + "pepr": { + "rbac": [ + { + "apiGroups": ["pepr.dev"], + "resources": ["customresources"], + "verbs": ["get", "list"] + }, + { + "apiGroups": ["apps"], + "resources": ["deployments"], + "verbs": ["create", "delete"] + } + ] + } +} +``` diff --git a/site/content/en/v0.36.0/user-guide/filters.md b/site/content/en/v0.39.0/user-guide/filters.md similarity index 90% rename from site/content/en/v0.36.0/user-guide/filters.md rename to site/content/en/v0.39.0/user-guide/filters.md index 06e378508..9e559be32 100644 --- a/site/content/en/v0.36.0/user-guide/filters.md +++ b/site/content/en/v0.39.0/user-guide/filters.md @@ -28,7 +28,9 @@ When(a.ConfigMap) ## `Filters` - `.WithName("name")`: Filters resources by name. +- `.WithNameRegex(/^pepr/)`: Filters resources by name using a regex. - `.InNamespace("namespace")`: Filters resources by namespace. +- `.InNamespaceRegex(/(.*)-system/)`: Filters resources by namespace using a regex. - `.WithLabel("key", "value")`: Filters resources by label. (Can be multiple) - `.WithDeletionTimestamp()`: Filters resources that have a deletion timestamp. diff --git a/site/content/en/v0.36.0/user-guide/metrics.md b/site/content/en/v0.39.0/user-guide/metrics.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/metrics.md rename to site/content/en/v0.39.0/user-guide/metrics.md diff --git a/site/content/en/v0.36.0/user-guide/onschedule.md b/site/content/en/v0.39.0/user-guide/onschedule.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/onschedule.md rename to site/content/en/v0.39.0/user-guide/onschedule.md diff --git a/site/content/en/v0.36.0/user-guide/pepr-cli.md b/site/content/en/v0.39.0/user-guide/pepr-cli.md similarity index 93% rename from site/content/en/v0.36.0/user-guide/pepr-cli.md rename to site/content/en/v0.39.0/user-guide/pepr-cli.md index 499e35feb..dc85af6b2 100644 --- a/site/content/en/v0.36.0/user-guide/pepr-cli.md +++ b/site/content/en/v0.39.0/user-guide/pepr-cli.md @@ -10,7 +10,12 @@ Initialize a new Pepr Module. **Options:** -- `--skip-post-init` - Skip npm install, git init and VSCode launch +- `--skip-post-init` - Skip npm install, git init and VSCode launch. +- `--confirm` - Skip verification prompt when creating a new module. +- `--description ` - Explain the purpose of the new module. +- `--name ` - Set the name of the new module. +- `--skip-post-init` - Skip npm install, git init, and VSCode launch. +- `--errorBehavior ` - Set an errorBehavior. --- diff --git a/site/content/en/v0.36.0/user-guide/pepr-modules.md b/site/content/en/v0.39.0/user-guide/pepr-modules.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/pepr-modules.md rename to site/content/en/v0.39.0/user-guide/pepr-modules.md diff --git a/site/content/en/v0.36.0/user-guide/rbac.md b/site/content/en/v0.39.0/user-guide/rbac.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/rbac.md rename to site/content/en/v0.39.0/user-guide/rbac.md diff --git a/site/content/en/v0.36.0/user-guide/sdk.md b/site/content/en/v0.39.0/user-guide/sdk.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/sdk.md rename to site/content/en/v0.39.0/user-guide/sdk.md diff --git a/site/content/en/v0.36.0/user-guide/store.md b/site/content/en/v0.39.0/user-guide/store.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/store.md rename to site/content/en/v0.39.0/user-guide/store.md diff --git a/site/content/en/v0.36.0/user-guide/webassembly.md b/site/content/en/v0.39.0/user-guide/webassembly.md similarity index 100% rename from site/content/en/v0.36.0/user-guide/webassembly.md rename to site/content/en/v0.39.0/user-guide/webassembly.md diff --git a/site/hugo.yaml b/site/hugo.yaml index e520b8e54..ef9e14175 100644 --- a/site/hugo.yaml +++ b/site/hugo.yaml @@ -34,12 +34,12 @@ params: url: https://github.com/defenseunicorns/pepr-docs version_menu: Releases versions: + - version: v0.39 + url: /v0.39.0/ - version: v0.38 url: /v0.38.3/ - version: v0.37 url: /0.37.3/ - - version: v0.36 - url: /v0.36.0/ - version: main url: /main/ markup: diff --git a/site/static/v0.36.0/_images/admission-endpoint.png b/site/static/v0.39.0/_images/admission-endpoint.png similarity index 100% rename from site/static/v0.36.0/_images/admission-endpoint.png rename to site/static/v0.39.0/_images/admission-endpoint.png diff --git a/site/static/v0.36.0/_images/dark.png b/site/static/v0.39.0/_images/dark.png similarity index 100% rename from site/static/v0.36.0/_images/dark.png rename to site/static/v0.39.0/_images/dark.png diff --git a/site/static/v0.36.0/_images/light.png b/site/static/v0.39.0/_images/light.png similarity index 100% rename from site/static/v0.36.0/_images/light.png rename to site/static/v0.39.0/_images/light.png diff --git a/site/static/v0.36.0/_images/pepr-arch.svg b/site/static/v0.39.0/_images/pepr-arch.svg similarity index 100% rename from site/static/v0.36.0/_images/pepr-arch.svg rename to site/static/v0.39.0/_images/pepr-arch.svg diff --git a/site/static/v0.36.0/_images/pepr-dashboard-screenshot.png b/site/static/v0.39.0/_images/pepr-dashboard-screenshot.png similarity index 100% rename from site/static/v0.36.0/_images/pepr-dashboard-screenshot.png rename to site/static/v0.39.0/_images/pepr-dashboard-screenshot.png diff --git a/site/static/v0.36.0/_images/pepr.png b/site/static/v0.39.0/_images/pepr.png similarity index 100% rename from site/static/v0.36.0/_images/pepr.png rename to site/static/v0.39.0/_images/pepr.png diff --git a/site/static/v0.36.0/_images/watcher-endpoint.png b/site/static/v0.39.0/_images/watcher-endpoint.png similarity index 100% rename from site/static/v0.36.0/_images/watcher-endpoint.png rename to site/static/v0.39.0/_images/watcher-endpoint.png