docs/static/v0.7/project/contributing/contributing-policies/index.html
Meshery has a built-in policy engine, based on Open Policy Agent (OPA). Meshery uses the Rego query language to create these policies.
To start contributing to Meshery Policy Engine, make sure you have OPA CLI installed on your system. You will also need to clone the Meshery Server project from Github.
Rego policies are the declarative logic behind the policy engine. These policies define how the underlying engine understands relationships within Meshery Designs. Rego policies can be found here in the Meshery Github repository.
Currently the Rego policies are invoked from the Go code in Meshery Server. This requires configuring the OPA context as seen here.
The Meshery Policy Engine is invoked by calling the evaluation endpoint. This endpoint is passed a Meshery Design in JSON which it passes to the Meshery Policy Engine for validation.
Working with the Meshery Policy Engine can feel complex because of the large number of different relationships a Meshery Design might contain. Contributors must then be careful to test any changes thoroughly to avoid unexpected results. When working with the Rego policies themselves it makes testing and development easier to be able to test the policies directly without running the entire Meshery Server. When working on the policies keep the following in mind:
You can evaluate the Rego policies against test data stored in the policies/test folder:
`make rego-eval`