derailed / popeye

👀 A Kubernetes cluster resource sanitizer
https://popeyecli.io
Other
5.32k stars 286 forks source link

change pod network policy checks #368

Open tylergmuir opened 1 month ago

tylergmuir commented 1 month ago

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:

Egress check is good if:

derailed commented 3 weeks ago

@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.