<!-- Thanks for sending a pull request! Here are some tips for you:
1. Ensure you have added the unit tests for your changes.
2. Ensure you have included output of manual testing done in the Testing
section.
3. Ensure number of lines of code for new or existing methods are within
the reasonable limit.
4. Ensure your change works on existing clusters after upgrade.
-->
**What type of PR is this?**
fix a bug
<!--
Add one of the following:
bug
cleanup
documentation
feature
-->
bug
**Which issue does this PR fix**:
#71
**What does this PR do / Why do we need it**:
The controller shouldn't loop through src pods to check if their ports
matching policies'.
**If an issue # is not available please add steps to reproduce and the
controller logs**:
**Testing done on this change**:
<!--
output of manual testing/integration tests results and also attach logs
showing the fix being resolved
-->
Unit tests are updated and functional tests were done
policy applied pod (dst)
```
ports:
- containerPort: 80
name: http
protocol: TCP
- containerPort: 443
name: https
protocol: TCP
```
src pod
```
ports:
- name: src
containerPort: 9999
protocol: TCP
```
svc
```
spec:
ports:
- port: 80
name: http
targetPort: http
- port: 443
name: https
targetPort: https
```
policyendpoint
```
spec:
ingress:
- cidr: 192.168.xx.xxx
ports:
- port: 80
protocol: TCP
- port: 443
protocol: TCP
podIsolation:
- Ingress
```
**Automation added to e2e**:
<!--
List the e2e tests you added as part of this PR.
If no, create an issue with enhancement/testing label
-->
no
**Will this PR introduce any new dependencies?**:
<!--
e.g. new K8s API
-->
no
**Will this break upgrades or downgrades. Has updating a running cluster
been tested?**:
no
**Does this PR introduce any user-facing change?**:
<!--
If yes, a release note update is required:
Enter your extended release note in the block below. If the PR requires
additional actions
from users switching to the new release, include the string "action
required".
-->
no
```release-note
```
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.