apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-frontend-network-policy
  namespace: backend
spec:
  podSelector:
    matchLabels:
      app: backend
  policyTypes:
  - Ingress
  # - Egress
  ingress:
  - from:
  #   - namespaceSelector:
  #       matchLabels:
  #         namespace: frontend
  #     podSelector:
  #       matchLabels:
  #         app: frontend
    - ipBlock:
        cidr: 172.30.7.153/32
        # except:
    #     # - 172.17.1.0/24
    # - namespaceSelector:
    #     matchLabels:
    #       project: test2
    # - podSelector:
    #     matchLabels:
    #       app: frontend
    # ports:
    # - protocol: TCP
    #   port: 8080
  # egress:
  # - to:
  #   - ipBlock:
  #       cidr: 10.0.0.0/24
  #   ports:
  #   - protocol: TCP
  #     port: 5978
