Bug 2092567 - Network policy is not being applied as expected
Summary: Network policy is not being applied as expected
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Networking
Version: 4.11
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.13.0
Assignee: Surya Seetharaman
QA Contact: Anurag saxena
URL:
Whiteboard: perfscale-ovn
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-01 19:59 UTC by Mohit Sheth
Modified: 2023-05-17 22:47 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-17 22:46:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift ovn-kubernetes pull 1381 0 None open Bug 2092567: [Downstream Merge] 16/11/2022 2022-11-16 08:20:45 UTC
Github ovn-org ovn-kubernetes pull 3178 0 None open Fix Network Policy service hairpin traffic 2022-09-27 10:25:01 UTC
Red Hat Product Errata RHSA-2023:1326 0 None None None 2023-05-17 22:47:12 UTC

Description Mohit Sheth 2022-06-01 19:59:56 UTC
Description of problem:
Pods accept ingress traffic when there is a deny all policy.

In this scenario we have multiple pods in a namespace. 
Each pod should have 2 labels, where each label is shared by 1-5 other pods
Add a “deny-all” policy to each Namespace
For each unique label in each Namespace, create a NetworkPolicy with that label as the podSelector, allowing traffic from pods with some other randomly-selected label.

For ex: pod nginx-4-1-1 with labels "label1: foo-4 and label2: bar-4" should only accept traffic from pods with labels label1: foo-2 OR label2: bar-5. Is was observed that it also accepts traffic from pods with labels  "label1: foo-4 and label2: bar-4".

Version-Release number of selected component (if applicable):
4.11.0-0.nightly-2022-05-25-193227

How reproducible:
Always

Steps to Reproduce:
1. Described in description


Actual results:
The curls to pods with deny-all policy should fail/timeout

Expected results:
The curls succeeds for some pods

Additional info:

Comment 4 Surya Seetharaman 2022-11-16 08:21:52 UTC
Upstream fix has merged, downstream merge has been opened.

Comment 12 errata-xmlrpc 2023-05-17 22:46:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.13.0 security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:1326


Note You need to log in before you can comment on or make changes to this bug.