Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change pod network policy checks #368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tylergmuir
Copy link

This reworks how the ingress and egress policies are checked. I'm open to input on if this is strict enough of a check, but my initial thought was that if the pod has both some sort of selector that it is probably good enough. While the selector could be too open, I feel like that should be flagged under the network policy check instead of flagging the pod directly.

Ingress check is good if:

  • .spec.policyType includes "Ingress"
  • .spec.podSelector targets the pod
  • .spec.ingress.[*] includes both a port definition and at least one of the following: podSelector, namespaceSelector, ipBlock

Egress check is good if:

  • .spec.policyType includes "Ingress"
  • .spec.podSelector targets the pod
  • .spec.egress.[*] includes both a port definition and at least one of the following: podSelector, namespaceSelector, ipBlock

@derailed derailed added enhancement New feature or request need-tlc labels Nov 11, 2024
@derailed
Copy link
Owner

@tylergmuir Thank you for this update Tyler!
The intent of this check is to ensure a given pod is covered by a network policy either as a source or destination.
I think there is indeed a problem in this check.
If a given policy targets the pod via the selector then your check is valid.
However when a given policy does not target the pod directly via the selector, we want to make sure that the pod from/to traffic is covered i.e ingress/egress selects that pod.
Does this make sense or am I missing it?

Note: the tests are currently failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request need-tlc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants