When implementing DevSecOps within a GitOps workflow, where should the automated policy enforcement (like OPA/Gatekeeper) occur?
OPA Gatekeeper runs as a validating admission controller on the Kubernetes API server, so every manifest is evaluated against policy before persistence. This enforces policy at the cluster's control point, catching GitOps-applied resources regardless of source repository.
Why this answer
OPA/Gatekeeper runs as a Kubernetes admission controller (ValidatingAdmissionWebhook) that intercepts API server requests before objects are persisted. This enforces policy at the cluster boundary regardless of whether the change came from GitOps, kubectl, or a rogue controller — making it the authoritative enforcement point in a DevSecOps GitOps workflow.
Exam trap
CGOA often tests the misconception that CI scanning or pre-commit hooks are sufficient policy enforcement — the authoritative, non-bypassable enforcement point is the Kubernetes admission controller (OPA Gatekeeper).
How to eliminate wrong answers
Option A is wrong because local pre-commit hooks are client-side and easily bypassed with --no-verify; they provide developer feedback but are not authoritative enforcement. Option B is wrong because CI image scanning catches vulnerabilities in container images but does not enforce Kubernetes manifest policy (e.g., disallowing hostNetwork or privileged pods) at admission time. Option D is wrong because manual PR review is a human process that does not scale and cannot guarantee enforcement — a merged manifest with a policy violation would still be applied by the GitOps agent.