- Node.js: This project requires Node.js version 18 or 20 to run.
- Yarn: This project uses Yarn version 4 for package management.
- Kind: This project uses Kind to run a local Kubernetes cluster.
- Kubectl: This project uses Kubectl to interact with the Kubernetes cluster.
- Policy Reporter: Ensure you have a Policy Reporter instance running. The plugin is configured to query
http://localhost:8080/api/policy-reporter
.
Before starting local development, install the necessary dependencies using Yarn.
yarn install
Prerequired Steps (without existing Cluster)
- Create a local cluster (e.g. with Kind or Minikube)
kind create cluster -n kyverno
NOTE: if you get error on too many open files you need to increase the inotify limits.
- Install Kyverno + Kyverno PSS Policies
Kyverno installs the required CRDS and you get some sample PolicyReports by installing the PSS policies.
Add Helm chart
helm repo add kyverno https://kyverno.github.io/kyverno/
helm repo add policy-reporter https://kyverno.github.io/policy-reporter
helm repo update
install Kyverno + CRDs
helm upgrade --install kyverno kyverno/kyverno -n kyverno --create-namespace
Add Pod Security Standard Policies
helm upgrade --install kyverno-policies kyverno/kyverno-policies -n kyverno --set podSecurityStandard=restricted
Add Policy Reporter
helm install policy-reporter policy-reporter/policy-reporter --create-namespace -n policy-reporter --set ui.enabled=true --set kyverno-plugin.enabled=true --version ^2.0.0
kubectl port-forward service/policy-reporter 8080:8080 -n policy-reporter
To start local development, use the yarn dev
command. This command starts the local development server using the dev
folders inside the kyverno-policy-reports
and kyverno-policy-reports-backend
directories.
yarn dev
Dev Containers provide a fully configured development environment that contains everything needed to start development.
- Install Docker: Dev Containers require Docker.
- Install VSCode. JetBrains IDEs also support Dev Containers.
- Install the Remote - Containers extension.
- Open the project in VSCode and run the command
Remote-Containers: Reopen in Container
. This will start the Dev Container process.
Ensure that your Policy Reporter instance is running and accessible at http://localhost:8080/api/policy-reporter
. You can adjust the configuration if your Policy Reporter instance is running on a different host or port.
To change the endpoint used by the plugin locally, update the endpoint
annotation in the catalog/entities.yaml
file to the desired endpoint.
Depending on what policies are present in your Policy Reporter instance, you might need to change the mock entity annotations used during yarn dev
that define the policies to display.
To update the mock entity annotations, modify the annotations in the plugins/kyverno-policy-reports/dev/index.ts
file to match the policies available in your Policy Reporter instance.