`Allow traffic from all the pods in "web" namespace and from pods` `with lebel . . .

Mohammad Karim:
Allow traffic from all the pods in "web" namespace and from pods
with lebel "type=monitoring" to the pods matching lable "app:db"

My Understanding : 
----------------------

apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: NetworkPolicy
metadata:
  name: test-network-policy
  namespace: default
spec:
  podSelector:
    matchLabels:
      app: db
  policyTypes:
  - Ingress
  ingress:
  - from:
    - podSelector:
        matchLabels:
          type: monitoring
Answers Says : 
----------------------

apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: NetworkPolicy
metadata:
  name: test-network-policy
  namespace: default
spec:
  podSelector:
    matchLabels:
      app: db
  policyTypes:
  - Ingress
  ingress:
  - from:
    - namespaceSelector: 
        matchLabels:
          app: web
    - podSelector:
        matchLabels:
          type: monitoring

Sagar Vakkala:
Hey @Mohammad Karim, I hope you’ve figured it out by now but you if you haven’t:

The question is asking you to apply a network policy for “app:db” which takes ingress traffic from two sources: Pods in "web" namespace and Pods with label "type=monitoring". In your answer, You’ve only answered the latter part of the question, You also have to add the namespaceSelector.
Just add this:

 namespaceSelector: 
        matchLabels:
          app: web