The requirement is Create a network policy that allows traffic to the hello pod via the exposed route.
So this is ONLY for the hellp pod, but the solution provided grant access to all pods:
spec:
podSelector: {}
I did it differently, pls comment...
[student@workstation ~]$ oc get networkpolicies/allow-from-openshift-ingress -ojsonpath='{.spec.podSelector}{"\n"}'
{"matchLabels":{"deployment":"hello"}}
Exercise didn't specify that you need to limit the policy just to pods with some labels, therefore solution was provided as it was provided. Otherwise I would say that your solution is correct. But just to be safe - on exam when they don't tell you to limit the policy only to some pods, I wouldn't do it.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.