apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: longhorn-ingress-only
  namespace: longhorn-system
spec:
  podSelector:
    matchLabels:
      app.kubernetes.io/name: longhorn
  policyTypes:
  - Ingress
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          name: ingress-nginx
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: portainer-ingress-only
  namespace: dashboard
spec:
  podSelector:
    matchLabels:
      app: portainer
  policyTypes:
  - Ingress
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          name: ingress-nginx
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: prometheus-ingress-only
  namespace: monitoring
spec:
  podSelector:
    matchLabels:
      app.kubernetes.io/name: prometheus
  policyTypes:
  - Ingress
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          name: ingress-nginx
