This directory contains Open Policy Agent (OPA) Rego policies used by conftest to validate generated Kubernetes manifests.
Package: main
Validates core OLM NetworkPolicy requirements:
- Deny-all policy: Ensures a default deny-all NetworkPolicy exists with empty podSelector and both Ingress/Egress policy types
- catalogd-controller-manager policy: Validates the NetworkPolicy for catalogd:
- Ingress on port 7443 (Prometheus metrics scraping)
- Ingress on port 8443 (catalog metadata queries from operator-controller)
- Ingress on port 9443 (Kubernetes API server webhook access)
- General egress enabled
- operator-controller-controller-manager policy: Validates the NetworkPolicy for operator-controller:
- Ingress on port 8443 (Prometheus metrics scraping)
- General egress enabled (for pulling bundle images, connecting to catalogd, and Kubernetes API)
These policies are automatically run as part of:
make lint-helm- Validates the helm/olmv1 chart (runsmainpackage)make manifests- Generates and validates core OLM manifests usingmainpackage policies
helm template olmv1 helm/olmv1 | conftest test --policy hack/conftest/policy/ --combine -n main -- Add new rules to an existing
.regofile or create a new one - Use
package mainfor policies that should run by default on all manifests - Update the Makefile targets if new namespaces need to be included