<p>I want to make sure that a Network Policy exists when an Ingress is created / updated. CertManager spawns a Pod to get a ACME certificate for the URL when an Ingress is created and fails if no NetworkPolicy is defined.<br />
Sadly I haven't found a way to access Network Policies for the Namespace the Ingress is created in.</p>

Michael
<p>You can do this by a custom <code>admission-controller</code>. I suggest this because OPA implements policy and compliance checking and therefore has the feature to implement the same, it might not come out of the box with functionality for dependency checking.</p>
<p>Since, the problem you have, however, is more of a <code>workflow/dependency</code> problem. You want to ensure resource creation/deletion enforcement based on dependency resolution. This is best done through a custom <code>admission-controller</code>. This will have the ability to query your API server to get information about existing resources before allowing certain requests to be passed to it. You can read more about <code>admission-controller</code>s <a href="https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/" rel="nofollow noreferrer">here</a> in the k8s docs.</p>
