apiVersion: v1
items:
- apiVersion: projectcalico.org/v3
  kind: NetworkPolicy
  metadata:
    name: test-network-policy1
    namespace: test-ns
  spec:
    egress:
    - action: Allow
      destination:
        nets:
        - 10.0.0.0/24
        ports:
        - 5978
      protocol: TCP
    ingress:
    - action: Allow
      destination:
        ports:
        - 6379
      protocol: TCP
      source:
        nets:
        - 172.17.0.0/16
        notNets:
        - 172.17.1.0/24
    - action: Allow
      destination:
        ports:
        - 6379
      protocol: TCP
      source:
        namespaceSelector: project == 'myproject'
        selector: projectcalico.org/orchestrator == 'k8s'
    - action: Allow
      destination:
        ports:
        - 6379
      protocol: TCP
      source:
        selector: projectcalico.org/orchestrator == 'k8s' && role == 'frontend'
    order: 1000
    selector: projectcalico.org/orchestrator == 'k8s' && role == 'db'
    types:
    - Ingress
    - Egress
- apiVersion: projectcalico.org/v3
  kind: NetworkPolicy
  metadata:
    name: default-deny-ingress
  spec:
    order: 1000
    selector: projectcalico.org/orchestrator == 'k8s'
    types:
    - Ingress
- apiVersion: projectcalico.org/v3
  kind: NetworkPolicy
  metadata:
    name: allow-all-egress
  spec:
    egress:
    - action: Allow
    order: 1000
    selector: projectcalico.org/orchestrator == 'k8s'
    types:
    - Egress
kind: List
metadata: {}
