---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: frontend
  namespace: team16
spec:
  podSelector:
    matchLabels:
      role: frontend
  policyTypes:
  - Ingress
  - Egress
  ingress:
  - from:
    - ipBlock:
        cidr: 0.0.0.0/0
    ports:
    - protocol: TCP
      port: 8080
  egress:
  - to:
    - namespaceSelector:
        matchLabels:
          networking/namespace: kube-system
      podSelector:
        matchLabels:
          k8s-app: kube-dns
    ports:
    - protocol: TCP
      port: 53
    - protocol: UDP
      port: 53
  - to:
    - namespaceSelector:
        matchLabels:
          namespace: team16
      podSelector:
        matchLabels:
          app: auth-api
    ports:
    - protocol: TCP
      port: 8081
  - to:
    - namespaceSelector:
        matchLabels:
          namespace: team16
      podSelector:
        matchLabels:
          app: todos-api
    ports:
    - protocol: TCP
      port: 8082