Local Development

Requirements

Getting started

Fork and/or checkout Policy Reporter on GitHub

Install dependencies

go get ./...

Unit Tests

Run unit tests locally with

make test

or

go test -v ./... -timeout=10s

Running Policy Reporter

To run Policy Reporter locally, you must connect it to a Kubernetes cluster. This is required because it connects to the Kubernetes API to watch for PolicyReports and ClusterPolicyReports. The configuration can be done via CLI arguments, config.yaml, or a mix of both.

go run main.go run -k ~/.kube/config

Argument Reference

ArgumentShortDescriptionDefault
--kubeconfig-kpath to the kubeconfig file,
used to connect to the Kubernetes API
--config-cpath to the Policy Reporter config fileconfig.yaml
--dbfile-dpath to the SQLite database filesqlite-database.db
--metrics-enabled-menables the Metrics API endpointsfalse
--rest-enabled-renables the REST API endpointsfalse
--port-pused port for the HTTP server8080

Compile and run Policy Reporter

make build./build/policyreporter run -k ~/.kube/config