apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: mysql
  namespace: mysql
  labels:
    app.kubernetes.io/name: mysql
    app.kubernetes.io/part-of: mysql
spec:
  egress:
  - to:
    - namespaceSelector:
        matchLabels:
          app.kubernetes.io/name: wishlist
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          app.kubernetes.io/name: wishlist
    ports:
    - port: 3306
      protocol: TCP
  podSelector:
    matchLabels:
      app.kubernetes.io/name: mysql
      app.kubernetes.io/part-of: mysql
  policyTypes:
  - Ingress
  - Egress
