apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: validator
  namespace: ethereum-2
  labels:
    app.kubernetes.io/name: validator
spec:
  podSelector:
    matchLabels:
      app.kubernetes.io/name: validator
  policyTypes:
  - Ingress
  ingress:
  # allow prometheus to scrape the metrics endpoint
  - from:
    - podSelector:
        matchLabels:
          app.kubernetes.io/name: prometheus
    ports:
    - protocol: TCP
      port: 8081
  # allow prometheus-to-sd to scrape the metrics endpoint
  - from:
    - podSelector:
        matchLabels:
          app.kubernetes.io/name: prometheus-to-sd
    ports:
    - protocol: TCP
      port: 8081
