# Egress policy for data-download jobs (MBP-10 download, etc.)
# Allows: MinIO (upload), Databento API (HTTPS download)
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: data-download-job
  namespace: foxhunt
  labels:
    app.kubernetes.io/part-of: foxhunt
spec:
  podSelector:
    matchLabels:
      foxhunt/job-type: data-download
  policyTypes:
    - Egress
  egress:
    # MinIO — binary fetch + data upload
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: minio
      ports:
        - protocol: TCP
          port: 9000
    # Databento API (HTTPS)
    - to:
        - ipBlock:
            cidr: 0.0.0.0/0
            except:
              - 10.0.0.0/8
              - 172.16.0.0/12
              - 192.168.0.0/16
              - 100.64.0.0/10
      ports:
        - protocol: TCP
          port: 443
---
# Egress policy for data-sync jobs (MinIO → PVC sync)
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: data-sync-job
  namespace: foxhunt
  labels:
    app.kubernetes.io/part-of: foxhunt
spec:
  podSelector:
    matchLabels:
      foxhunt/job-type: data-sync
  policyTypes:
    - Egress
  egress:
    # MinIO — data sync source
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: minio
      ports:
        - protocol: TCP
          port: 9000
