Day 1: Understand Rego and build a first Gatekeeper policy
5 topics, Tap to openTap to close
10:00–11:00Connect OPA, Rego, and Gatekeeper
OPA makes decisions, Rego describes the rules, and Gatekeeper connects both to Kubernetes. You send sample workloads through the API server and follow when the admission webhook evaluates them and when the audit controller checks resources already stored. You then relate the request path, Gatekeeper components, ConstraintTemplate, and constraint within one architectural model and discuss where each decision occurs.
11:00–12:00Write and Test a First Rego Rule
Rego describes desired results rather than an imperative sequence of steps. You read a Kubernetes object through input and use if and contains to create a clear violation rule. With formatting, strict checks, and testing functions in the OPA CLI, you examine how syntax, empty test sets, and policy logic influence different kinds of feedback.
13:00–14:00Extend Rego for Kubernetes Objects
Kubernetes manifests contain nested objects and lists that a single condition rarely covers completely. You extend your rule with iteration, sets, negation, and a helper rule while varying present, missing, and differently structured fields. In the DevNinjas Dojo, our cloud learning environment, you examine how data structure and modelling influence evaluation and its feedback.
14:00–15:00Build a ConstraintTemplate from Rego
A ConstraintTemplate turns Rego logic into a reusable Kubernetes policy type. You transfer your rule into the explicit Rego v1 engine, define a structural OpenAPI parameter schema, and apply the template to the cluster. In the lab, you interpret ingestion status, the generated CRD, and type feedback as diagnostic signals and discuss what they can reveal about schema and policy logic.
15:00–16:00Parameterize and Scope Constraints
A constraint applies the same template with concrete parameters and a defined scope. Using examples for different teams, you vary kinds, scope, namespaces, exclusions, and selectors. In the lab, you examine how target selection and parameterisation affect the boundary between reusable logic and cluster-specific configuration and which workloads should deliberately remain outside the scope.

