apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny
  labels:
    cdi.kubevirt.io: ""
spec:
  podSelector: { }
  policyTypes:
    - Ingress
    - Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: cdi-allow-egress-to-cluster-services
  labels:
    cdi.kubevirt.io: ""
spec:
  podSelector:
    matchExpressions:
      - key: np.kubevirt.io/allow-access-cluster-services
        operator: In
        values:
          - "true"
  policyTypes:
    - Egress
  egress:
    - ports:
        - protocol: TCP
          port: 6443
    - to:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: kube-system
          podSelector:
            matchLabels:
              k8s-app: kube-dns
      ports:
        - protocol: TCP
          port: dns-tcp
        - protocol: UDP
          port: dns
