Company
Date Published
Author
Jasper Van der Jeugt, Becki Lee
Word count
3425
Language
English
Hacker News points
None

Summary

This blog post is the third installment in a series introducing Rego, the policy language for the Open Policy Agent (OPA), focusing on the types of values and rules. Rego allows users to write policy as code, using programming practices such as version control and modular design for evaluating cloud and infrastructure resources. The post delves into scalar and composite values in Rego, including strings, numbers, booleans, arrays, objects, and sets, and explains how to construct different types of rules, such as complete rules, set and object comprehensions, and functions. It provides examples of how these rules can be used to create policies that evaluate data in JSON format, particularly in the context of Kubernetes pods, emphasizing Rego's iteration process, which differs from imperative languages by using implicit iteration. The post encourages readers to experiment with Rego using the OPA Playground or command line tools and offers examples of practical application, such as ensuring containers in production-stage pods do not use the latest image, highlighting Rego's utility in maintaining compliance with security policies.