apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: wishlist
  namespace: wishlist
  labels:
    app.kubernetes.io/name: wishlist
    app.kubernetes.io/part-of: wishlist
spec:
  egress:
    - to:
      - namespaceSelector:
          matchLabels:
            app.kubernetes.io/name: mysql
      - podSelector:
          matchLabels:
            app.kubernetes.io/name: mysql
      ports:
      - protocol: TCP
        port: 3306
    - to:
      - podSelector:
          matchLabels:
            k8s-app: kube-dns
      - ipBlock:
          cidr: 10.100.0.0/19
      ports:
      - protocol: TCP
        port: 53
      - protocol: UDP
        port: 53
  ingress:
  - from:
    - ipBlock:
        cidr: 0.0.0.0/0
    ports:
    - port: 8080
      protocol: TCP
  podSelector:
    matchLabels:
      app.kubernetes.io/name: wishlist
  policyTypes:
  - Ingress
  - Egress
