tsandall / validating-and-mutating-example

A small example project containing a validating and mutating policy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

๐Ÿ›  Validating and Mutating Admission Control Example ๐Ÿ› 

This repository contains a small example of how to combine validating and mutating admission control policies in OPA using the entry point contributed to the open-policy-agent/library repository.

Examples

  • ๐Ÿ”ช The mutating policy sets an annotation on objects that indicate a requirement.
  • ๐Ÿ›ก๏ธ The validating policy example checks for a specific label.

There are four files:

Running

You can run the tests on the command-line:

opa test -b . -v

You can evaluate the entire policy with an example input on the command-line:

opa eval -b . -i input.json 'data.system.main'

Hint: check out the 'Open Policy Agent' extension for VS Code. Try the OPA: Test Workspace, OPA: Evaluate Selection, and OPA: Toggle Evaluation Coverage commands on this project.

About

A small example project containing a validating and mutating policy.


Languages

Language:Open Policy Agent 100.0%