Gatekeeper Library
website·Indexed 29 days ago
https://open-policy-agent.github.io/gatekeeper/website/docs/A collection of ConstraintTemplates for Gatekeeper, providing pre-defined validation and mutation policies for Kubernetes. Includes templates for pod security standards (pod-security-baseline and pod-security-restricted), resource limits, API deprecation checks, and container security controls such as Seccomp, AppArmor, and SELinux.
What's inside Gatekeeper Library
- Gatekeeper mutation policies allow the modification of Kubernetes resources at request time. Unlike validation constraints, mutation policies use specific Custom Resource Definitions (CRDs) called mutators. Mutation policies are stable in Gatekeeper version v3.10+.
Overview of Gatekeeper Mutation CRDs
v3.15.xGatekeeper (v3.10+ stable) provides mutation policies via specific Custom Resource Definitions (CRDs) called mutators. These allow modifying Kubernetes resources at request time. There are four primary mutators:
AssignMetadata: Modifies the metadata section (labels and annotations only).Assign: Modifies any field outside the metadata section.ModifySet: Adds or removes entries from a list (e.g., container arguments).AssignImage: Specifically modifies components of an image string (domain, path, tag).
Overview of Gatekeeper Mutation CRDs
v3.17.xGatekeeper (v3.10+ stable) allows modifying Kubernetes resources at request time using mutation-specific CRDs called mutators. There are four primary mutators:
AssignMetadata: Modifies the metadata section (specifically labels and annotations).Assign: Modifies any field outside the metadata section.ModifySet: Adds or removes entries from a list (set-like behavior).AssignImage: Specifically modifies components of an image string (domain, path, tag).
Overview of Gatekeeper External Data Providers
v3.20.xExternal data providers are in-cluster HTTP servers that allow Gatekeeper to interface with external data sources (e.g., image registries, Active Directory/LDAP). This model is preferred over OPA'shttp.sendbecause it provides better security (restricting accessible hosts), supports mutation (whichhttp.senddoes not), and allows Gatekeeper to manage caching and batching for better performance.Overview of Gatekeeper External Data Providers
v3.21.xExternal data providers are in-cluster components that act as HTTP servers. They communicate with external data sources (e.g., image registries, Active Directory/LDAP) and return data in a format Gatekeeper can process. This model is preferred over OPA'shttp.sendbecause it supports mutation, improves security by restricting accessible hosts, and allows Gatekeeper to manage response caching and request batching.Overview of Gatekeeper Mutation CRDs
v3.6.xGatekeeper mutation allows modifying Kubernetes resources at request time based on customizable policies. This feature is available in Gatekeeper v3.4+ (alpha). There are two primary CRDs used for mutations:
- AssignMetadata: Used specifically for modifying the
metadatasection of a resource. Due to the sensitivity of metadata, this is currently limited to adding labels and annotations. - Assign: Used for any modifications outside of the
metadatasection.
- AssignMetadata: Used specifically for modifying the
Overview of Gatekeeper External Data Providers
v3.15.xExternal data providers are in-cluster HTTP servers that allow Gatekeeper to fetch data from external sources (e.g., image registries, Active Directory, LDAP) during resource mutation and validation. This model is preferred over OPA'shttp.sendbecause it supports mutation, improves security by restricting accessible hosts, and allows Gatekeeper to manage caching and batching for better performance.Overview of Gatekeeper Mutation CRDs
Gatekeeper mutation policies allow the modification of Kubernetes resources at request time. Unlike validation constraints, mutation policies use specific mutation CRDs (mutators) rather than
ConstraintTemplateandConstraintresources.Available mutators include:
AssignMetadata: Modifies the metadata section of a resource (has stricter rules than other mutators).Assign: Modifies any field outside the metadata section.ModifySet: Adds or removes entries from a list (e.g., container arguments).AssignImage: Modifies components of an image string.
Overview of Gatekeeper External Data providers
v3.22.xExternal data providers are in-cluster HTTP servers that allow Gatekeeper to interface with external data sources (e.g., image registries, Active Directory, LDAP). This model is preferred over OPA'shttp.sendbecause it supports mutation, improves security by restricting accessible hosts, and enables better performance through Gatekeeper-controlled caching and request batching.Overview of Gatekeeper Mutation Policies
v3.21.xGatekeeper mutation policies allow for the modification of Kubernetes resources at request time. Unlike validation constraints, mutation policies use specific mutation CRDs (mutators) rather thanConstraintTemplateandConstraintresources. Mutation is stable in Gatekeeper version v3.10+.Overview of Gatekeeper Mutation CRDs
v3.19.xGatekeeper (v3.10+) allows modifying Kubernetes resources at request time using mutation policies defined via specific Custom Resource Definitions (CRDs) called mutators. Each mutator consists of three sections: the extent of changes (which resources to target), the intent (what path and value to modify), and conditionals (under what circumstances the mutation applies).Overview of Gatekeeper Resource Expansion
v3.21.xResource Expansion allows Gatekeeper to reject workload resources (e.g., Deployments, Jobs) that would create child resources (e.g., Pods) violating a constraint. Gatekeeper creates temporary 'expanded resources' based on a blueprint in the parent resource to perform this validation. This feature is available in Gatekeeper v3.10+ (alpha) and v3.13+ (beta) and is enabled by default. To disable it, set theenable-generator-resource-expansionflag to false.