# Egress policy for training jobs (binary fetch, data sync, telemetry)
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: training-job
  namespace: foxhunt
  labels:
    app.kubernetes.io/part-of: foxhunt
spec:
  podSelector:
    matchLabels:
      foxhunt/job-type: training
  policyTypes:
    - Egress
  egress:
    # MinIO — binary fetch + data sync
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: minio
      ports:
        - protocol: TCP
          port: 9000
    # Tempo — OTLP tracing
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: tempo
      ports:
        - protocol: TCP
          port: 4317
    # Pushgateway — Prometheus metrics push
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: pushgateway
      ports:
        - protocol: TCP
          port: 9091
    # QuestDB — ILP training metrics persistence
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: questdb
      ports:
        - protocol: TCP
          port: 9009
