kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
spec:
  podSelector:
    matchLabels:
      role: db
  ingress:
    - ports:
        - protocol: TCP
          port: 5432
      from:
        - podSelector:
            matchLabels:
              role: api
        - podSelector:
            matchLabels:
              role: queue
        - podSelector:
            matchLabels:
              role: job
        - podSelector:
            matchLabels:
              role: backup
        - podSelector:
            matchLabels:
              openshift.io/deployer-pod.type: hook-pre
  policyTypes:
    - Ingress