A microservices platform may need one policy engine to authorize API requests, validate Kubernetes resources, restrict CI/CD inputs, and enforce deployment rules. Open Policy Agent (OPA) provides that general-purpose decision engine, while Rego expresses declarative logic over JSON data. section 8.2
OPA can be embedded in applications, gateways, and controllers, keeping policies portable, testable, and independent of the systems they protect. It evaluates more than access control: policies can validate resources, enforce admission control, restrict inputs, or produce other structured decisions. section 8.2 section 8.2.4
Rego gives policy authors flexibility, but the policy structure must be designed deliberately:
- Define principals, actions, resources, and context in the request input; Rego supplies no built-in authorization model for them. section 8.2.3
- Represent identities and resources as JSON, with attributes such as identifiers, groups, departments, nested data, or organizational state. section 8.2.3
- Use runtime context such as time, location, network conditions, headers, or external data when decisions depend on environmental state. section 8.2.3
- Expect careful validation, analysis, and testing: flexible, untyped inputs can produce subtle bugs, while Rego has a steep learning curve. section 8.2.3 section 8.2.4
Cloud-native authorization
As infrastructure moves to Kubernetes and microservices, OPA can apply consistent decisions across APIs, CI/CD pipelines, container deployments, and controllers. Its flexibility suits infrastructure spanning multiple platforms, although teams seeking a purpose-built access-control model may prefer another framework. section 8.0 section 8.5.6
Figure 8.3 Strength map comparing five policy languages and frameworks (XACML, OPA/Rego, OpenFGA, AWS IAM, and Cedar) across the four PARC elements and portability. Darker shading indicates stronger, more native support for that element; lighter shading indicates partial or minimal support. This visual emphasizes how each system’s design highlights different aspects of authorization, from attribute-rich context handling to typed principals and explicit resource modeling.
Compare OPA/Rego with XACML, OpenFGA, AWS IAM, and Cedar across principal, action, resource, context, and portability support. section 8.5.6

