---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: access-to-httpd 
  namespace: default
spec:
  podSelector:
    matchLabels:
      component: httpd_webserver  
  policyTypes:
    - Ingress
    - Egress
  ingress:
    - from:
      - ipBlock:               
          cidr: 172.17.0.0/16
          except:
          - 172.17.1.0/24
      - namespaceSelector:   # here we grant access at the namespace level
          matchLabels:
            project: codingbee
      - podSelector:
          matchLabels:
            app: curl_client 
      ports:
        - protocol: TCP
          port: 80