Local Development
Requirements
- Go >= v1.19
- (optional) Kubernetes Cluster with Kyverno installed
Getting started
Fork and/or checkout Policy Reporter Kyverno plugin on GitHub
Install dependencies
go get ./...Unit Tests
Run unit tests locally with
make testor
go test -v ./... -timeout=10sRunning Kyverno Plugin
To run the Kyverno plugin locally, you must connect it to a Kubernetes cluster. This is required because it connects to the Kubernetes API to watch for Kyverno Policies and ClusterPolicies. The configuration can be done via CLI arguments, config.yaml, or a mix of both.
go run main.go run -k ~/.kube/configArgument Reference
| Argument | Short | Description | Default |
|---|---|---|---|
--kubeconfig | -k | path to the kubeconfig file, used to connect to the Kubernetes API | |
--config | -c | path to the Policy Reporter config file | config.yaml |
--metrics-enabled | -m | enables the Metrics API endpoints | false |
--rest-enabled | -r | enables the REST API endpoints | false |
--port | -p | used port for the HTTP server | 8080 |
Compile and run Policy Reporter
make build./build/kyverno-plugin run -k ~/.kube/config
