apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: trading-agent-service
  namespace: foxhunt
spec:
  podSelector:
    matchLabels:
      app.kubernetes.io/name: trading-agent-service
  policyTypes:
    - Ingress
    - Egress
  ingress:
    - from:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: api
      ports:
        - protocol: TCP
          port: 50055
  egress:
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: trading-service
      ports:
        - protocol: TCP
          port: 50051
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: postgres
      ports:
        - protocol: TCP
          port: 5432
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: redis
      ports:
        - protocol: TCP
          port: 6379
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: minio
      ports:
        - protocol: TCP
          port: 9000
