apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: test-network-policy-large
  namespace: default
spec:
  podSelector:
    matchLabels:
        app: webapp
        role: db
  policyTypes:
  - Ingress
  - Egress
  ingress:
    - from:
      - ipBlock:
          cidr: 172.17.0.0/16
          except:
          - 172.17.1.0/24
      - podSelector:
          matchLabels:
            role: frontend
      ports:
        - protocol: TCP
          port: 8000
        - protocol: TCP
          port: 8081
        - protocol: TCP
          port: 8082
        - protocol: TCP
          port: 8083
        - protocol: TCP
          port: 8084
        - protocol: TCP
          port: 8085
    - from:
      - ipBlock:
          cidr: 11.1.1.0/16
          except:
          - 11.1.1.0/24
      - podSelector:
          matchLabels:
            role: backend
      ports:
        - protocol: TCP
          port: 8086
        - protocol: TCP
          port: 8087
  egress:
    - to:
      - ipBlock:
          cidr: 11.0.0.0/24
      - podSelector:
          matchLabels:
            app: datastore
      ports:
      - protocol: TCP
        port: 5978

