---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-allow-all
  namespace: litmus
spec:
  podSelector: {}
  policyTypes:
    - Ingress
    - Egress
  ingress:
    # Ingress traffic from any pod in current namespace will be allowed
    - from:
        - podSelector: {}
    # Ingress traffic from any pod in the cluster will be allowed
    - {}
    # Allow ingress from any endpoint only to any pods but only specific port(s)
    - from:
        - ipBlock:
            cidr: 0.0.0.0/0
      ports:
        - port: 443
  egress:
    # Egress flows to Kubernetes DNS will be allowed but only specific port(s).
    - to:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: kube-system
          podSelector:
            matchLabels:
              k8s-app: kube-dns
      ports:
        - port: 53
          protocol: UDP
        - port: 53
          protocol: TCP
    # Egress traffic to any pod in current namespace will be allowed
    - {}
    # Egress traffic to any endpoint outside of the cluster will be allowed.
    - to:
        - ipBlock:
            cidr: 0.0.0.0/0
    # Egress traffic to any pod in current namespace will be allowed
    - to:
        - podSelector: {}
