apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: mattermost
spec:
  podSelector:
    matchLabels:
      app: mattermost
  policyTypes:
  - Ingress
  - Egress
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          system: "true"
    - podSelector:
        matchLabels:
          app: nginx-ingress-controller
    ports:
    - protocol: TCP
      port: 8065
  egress:
  - to:
    - podSelector:
        matchLabels:
          app: mysql
    ports:
    - protocol: TCP
      port: 3306
  - to:
    - namespaceSelector:
        matchLabels:
          system: "true"
    - podSelector:
        matchLabels:
          k8s-app: coredns
    ports:
    - protocol: TCP
      port: 53
    - protocol: UDP
      port: 53
