opa-exporter

module
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2022 License: Apache-2.0

README

opa-exporter

A simple exporter for monitoring OPA Constraint Violations in realtime.

Inspired by this blog post, from which the exporter code itself originates.

Why fork?

The source was written as a proof of concept. My needs dictate a production-ready product with timely updates. This fork intends to be that.

Contributing

Pull requests are welcome! Please read CONTRIBUTING.md before beginning.

This repo makes heavy use of Taskfiles. Install this first.

Please check that you have the other necessary prerequisites installed by running:

task req
Setting up an environment

First create your cluster:

task kind:create

Deploy gatekeeper and observability stack:

task gk:deploy
# OR IF USING EXTERNAL DATA IN YOUR POLICIES:
task gk:deploy ED_ENABLED=true

Deploy the prometheus stack:

task prom:deploy

Build the container image:

task build

Deploy the container image:

task deploy

Run port-forwarding for the local grafana:

task prom:port-forward

At this point you may open grafana at localhost:3000 and view the OPA dashboard. You can test your policies and see the violations appear in this dashboard.

Directories

Path Synopsis
internal
config
Package config handles getting configuration from the environment and/or from file
Package config handles getting configuration from the environment and/or from file
log
Package log provides methods for creating the logger
Package log provides methods for creating the logger
server
Package server handles HTTP requests for the exporter
Package server handles HTTP requests for the exporter
pkg
opa
Package opa provides prometheus metrics for OPA and methods
Package opa provides prometheus metrics for OPA and methods

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL