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

[v1.9] bpf: Skip policy enforcements for service loopback case #15709

Merged
merged 3 commits into from
May 5, 2021

Conversation

pchaigno
Copy link
Member

@pchaigno pchaigno commented Apr 15, 2021

Once this PR is merged, you can update the PR labels via:

$ for pr in 15321 15928; do contrib/backporting/set-labels.py $pr done 1.9; done

@pchaigno pchaigno added kind/backports This PR provides functionality previously merged into master. backport/1.9 labels Apr 15, 2021
@pchaigno
Copy link
Member Author

Smoke test / conformance-test is failing because of a complexity issue.

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Apr 21, 2021
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Apr 21, 2021
@christarazi

This comment has been minimized.

@christarazi

This comment has been minimized.

@christarazi christarazi added the priority/high This is considered vital to an upcoming release. label Apr 26, 2021
@christarazi christarazi force-pushed the pr/v1.9-backport-2021-04-15 branch 2 times, most recently from 9647f4a to 1b0a3d7 Compare April 27, 2021 16:28
@christarazi christarazi temporarily deployed to release-developer-images April 27, 2021 16:33 Inactive
@christarazi christarazi temporarily deployed to release-developer-images April 27, 2021 16:33 Inactive
@christarazi christarazi temporarily deployed to release-developer-images April 27, 2021 16:33 Inactive
@christarazi christarazi temporarily deployed to release-developer-images April 27, 2021 16:33 Inactive
@christarazi christarazi temporarily deployed to release-developer-images April 27, 2021 16:33 Inactive
@christarazi christarazi temporarily deployed to release-developer-images April 27, 2021 16:33 Inactive
@christarazi christarazi temporarily deployed to release-developer-images April 27, 2021 16:33 Inactive
@christarazi christarazi temporarily deployed to release-developer-images April 27, 2021 16:33 Inactive
@christarazi christarazi changed the title bpf: Skip policy enforcements for service loopback case [v1.9] bpf: Skip policy enforcements for service loopback case Apr 27, 2021
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Apr 27, 2021
@cilium cilium deleted a comment from maintainer-s-little-helper bot Apr 27, 2021
@cilium cilium deleted a comment from maintainer-s-little-helper bot Apr 27, 2021
@cilium cilium deleted a comment from maintainer-s-little-helper bot Apr 27, 2021
@cilium cilium deleted a comment from maintainer-s-little-helper bot Apr 28, 2021
[ upstream commit 52cd6da ]

When an endpoint connects to itself via service clusterIP, we hairpin the
flow using a loopback IP address (configured using
ipv4-service-loopback-address). The destination clusterIP (on egress) and
loopback IP (on ingress) map to unexpected identities. As a result,
policy enforcement fails and the packet is dropped.

This is visible in the cilium monitor output:

    <- endpoint 1844 flow 0x96c8d52 identity 55108->unknown state new ifindex 0 orig-ip 0.0.0.0: 10.12.0.123:58242 -> 172.20.0.130:80 tcp SYN
    Policy verdict log: flow 0x96c8d52 local EP ID 1844, remote ID world, proto 6, egress, action deny, match none, 169.254.42.1:58242 -> 10.12.0.123:80 tcp SYN

Since we don't want to enforce policies anyway for the loopback traffic,
this commit skips policy enforcements in that case.

Co-authored-by: Paul Chaignon <paul@cilium.io>
Signed-off-by: Aditi Ghag <aditi@cilium.io>
Signed-off-by: Chris Tarazi <chris@isovalent.com>
@christarazi christarazi force-pushed the pr/v1.9-backport-2021-04-15 branch from 76f2c38 to a4b9c96 Compare May 3, 2021 17:20
christarazi and others added 2 commits May 3, 2021 10:20
Upon code inspection, the remote endpoint lookup that retrieves the
destination ID is useless because the destination ID is not used when
`hairpin_flow` is true. We can skip over this code in hopes that it
simplifies the code complexity.

Signed-off-by: Chris Tarazi <chris@isovalent.com>
[ upstream commit 69f10ed ]

Test for PR #15321 - tests the case where a pod
connects to itself via service clusterIP when selected
by a policy.

Signed-off-by: Aditi Ghag <aditi@cilium.io>
@christarazi christarazi force-pushed the pr/v1.9-backport-2021-04-15 branch from a4b9c96 to ce442fb Compare May 3, 2021 17:22
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label May 3, 2021
@cilium cilium deleted a comment from maintainer-s-little-helper bot May 3, 2021
@christarazi
Copy link
Member

test-backport-1.9

@christarazi
Copy link
Member

christarazi commented May 3, 2021

Updated the PR description to convert this PR into a backport PR, now that the complexity issue has been resolved on this branch. Opening for reviews.

Edit: I can't request reviews from Paul as he opened the PR, but I've been pushing to it

@christarazi christarazi marked this pull request as ready for review May 3, 2021 17:44
@christarazi christarazi requested a review from a team as a code owner May 3, 2021 17:44
@christarazi christarazi requested review from aditighag, a team and borkmann and removed request for a team May 3, 2021 17:45
Copy link
Member

@aditighag aditighag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Thank you. 🚀

Copy link
Member Author

@pchaigno pchaigno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I can't leave an approving review because I opened the PR, but that's my intent 🙂

Thanks @christarazi and @aditighag! 🙏

@pchaigno pchaigno removed their assignment May 3, 2021
@pchaigno pchaigno added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 5, 2021
@ti-mo ti-mo merged commit a2e844f into v1.9 May 5, 2021
@ti-mo ti-mo deleted the pr/v1.9-backport-2021-04-15 branch May 5, 2021 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/backports This PR provides functionality previously merged into master. priority/high This is considered vital to an upcoming release. ready-to-merge This PR has passed all tests and received consensus from code owners to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants