Skip to content

Conversation

ysksuzuki
Copy link
Member

@ysksuzuki ysksuzuki commented Jun 2, 2024

Currently packets from Pods selected by an egress gateway policy will not be forwarded to a gateway if there's an L7 policy applied to those packets. That's because we apply the egress gateway policy at bpf_lxc right after the L7 policy redirection. Therefore the Egress Gateway logic will be skipped if packets are redirected to the L7 proxy.

This PR adds the egress gateway handling code at to-netdev@bpf_host so that packets from the L7 proxy can be properly redirected to an egress gw.

Fixes: #19642

Support Egress Gateway for endpoints that are also selected by a L7 Network Policy.

ysksuzuki added 5 commits June 2, 2024 20:48
egress_gw_request_needs_redirect* functions already returun proper
error code. So don't need to return DROP_NO_EGRESS_GATEWAY from the
caller side.

Signed-off-by: Yusuke Suzuki <yusuke.suzuki@isovalent.com>
Currently packets from Pods selected by an egress gateway policy will
not be forwarded to a gateway if there's an L7 policy applied to those
packets. That's because we apply the egress gateway policy at bpf_lxc
right after the L7 policy redirection. Therefore the Egress Gateway
logic will be skipped if packets are redirected to the L7 proxy.

This commit adds the egress gateway handling code at to-netdev@bpf_host
so that packets from the L7 proxy can be properly redirected to an egress gw.

We will keep the egress gw code in from-container@bpf_lxc around
until v1.17 to avoid disruption of traffic to egress gateway.
It’s possible that the datapath becomes an incomplete state where bpf_lxc
has been upgraded while bpf_host hasn't during the upgrade. If that situation
were to occur, traffic destined for egress gateway would be broken for that
period of time. So we will keep the egress gateway code at both bpf_lxc
and bpf_host to avoid this scenario.

Fixes: cilium#19642

Signed-off-by: Yusuke Suzuki <yusuke.suzuki@isovalent.com>
Signed-off-by: Yusuke Suzuki <yusuke.suzuki@isovalent.com>
Signed-off-by: Yusuke Suzuki <yusuke.suzuki@isovalent.com>
Signed-off-by: Yusuke Suzuki <yusuke.suzuki@isovalent.com>
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jun 2, 2024
@ysksuzuki ysksuzuki added release-note/bug This PR fixes an issue in a previous release of Cilium. feature/egress-gateway Impacts the egress IP gateway feature. labels Jun 2, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Jun 2, 2024
@ysksuzuki
Copy link
Member Author

/test

@ysksuzuki ysksuzuki marked this pull request as ready for review June 2, 2024 22:10
@ysksuzuki ysksuzuki requested review from a team as code owners June 2, 2024 22:10
@ysksuzuki ysksuzuki requested review from jschwinger233 and a user June 2, 2024 22:10
Copy link
Member

@jschwinger233 jschwinger233 left a comment

Choose a reason for hiding this comment

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

My understanding is, skbs are still redirected to L7 proxy from lxc, then we will handle egress gw business at to_netdev@eth0 for proxy traffic. But this relies on routing mode doesn't it?

(I suppose egress gw is compatible with tunnel.) When tunnel is enabled with egw, L7 proxy's packets are routed to cilium_host, where the skbs are bpf_redirected to cilium_vxlan for encap. In this case, to_netdev bpf doesn't have chance to process egress gateway logic for the proxy traffic, is this the correct assumption?

@ysksuzuki
Copy link
Member Author

ysksuzuki commented Jun 3, 2024

When tunnel is enabled with egw, L7 proxy's packets are routed to cilium_host, where the skbs are bpf_redirected to cilium_vxlan for encap. In this case, to_netdev bpf doesn't have chance to process egress gateway logic for the proxy traffic, is this the correct assumption?

Actually, that's not quite right. Since traffic leaving the cluster is not redirected to cilium_vxlan there, it should be handled by the egress gateway logic at to-netdev. Regarding the EgressGW, we only care traffic leaving the cluster.

@julianwiedmann julianwiedmann added area/proxy Impacts proxy components, including DNS, Kafka, Envoy and/or XDS servers. release-note/minor This PR changes functionality that users may find relevant to operating Cilium. area/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. and removed release-note/bug This PR fixes an issue in a previous release of Cilium. labels Jun 3, 2024
Copy link
Member

@julianwiedmann julianwiedmann left a comment

Choose a reason for hiding this comment

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

looks great, thank you!

I polished the release note a tiny bit, and updated the release-note label. This feels more like an enhancement, and not a bugfix that we would attempt to backport.

@julianwiedmann julianwiedmann added the kind/enhancement This would improve or streamline existing functionality. label Jun 3, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jun 4, 2024
@julianwiedmann julianwiedmann added this pull request to the merge queue Jun 4, 2024
Merged via the queue into cilium:main with commit 8cd748d Jun 4, 2024
julianwiedmann added a commit to julianwiedmann/cilium that referenced this pull request Jun 11, 2024
This option was suggested to deal with an incompatibility between EGW and
L7 policies. The incompatibility has been addressed by
cilium#32828.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann added a commit to julianwiedmann/cilium that referenced this pull request Jun 14, 2024
This option was suggested to deal with an incompatibility between EGW and
L7 policies. The incompatibility has been addressed by
cilium#32828.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
github-merge-queue bot pushed a commit that referenced this pull request Jun 14, 2024
This option was suggested to deal with an incompatibility between EGW and
L7 policies. The incompatibility has been addressed by
#32828.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
youngnick pushed a commit to youngnick/cilium that referenced this pull request Jun 20, 2024
This option was suggested to deal with an incompatibility between EGW and
L7 policies. The incompatibility has been addressed by
cilium#32828.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
@cdtzabra
Copy link
Contributor

cdtzabra commented Jun 20, 2024

@julianwiedmann Since you have removed the imcompatibility notice in EgressGateway documentation https://github.com/cilium/cilium/pull/32828/files/e169996613bc2cd9b6ce48df991e792401b4f3be#diff-254749e3152a2d97fdff438b3b2a1611eb7e575f1f0f665ebb534f977d5b661cL72

I guess that --set l7Proxy=false is not needed anymore when enabling the egressgatway and should be removed also ?

@julianwiedmann
Copy link
Member

@julianwiedmann Since you have removed the imcompatibility notice in EgressGateway documentation https://github.com/cilium/cilium/pull/32828/files/e169996613bc2cd9b6ce48df991e792401b4f3be#diff-254749e3152a2d97fdff438b3b2a1611eb7e575f1f0f665ebb534f977d5b661cL72

I guess that --set l7Proxy=false is not needed anymore when enabling the egressgatway and should be removed also ?

Yep! Can you please open a PR?

cdtzabra added a commit to cdtzabra/cilium that referenced this pull request Jul 1, 2024
Cleaning up a minor oversight in the documentation following this merge cilium#32828

Signed-off-by: cdtzabra <22188574+cdtzabra@users.noreply.github.com>
@cdtzabra
Copy link
Contributor

cdtzabra commented Jul 1, 2024

@julianwiedmann Since you have removed the imcompatibility notice in EgressGateway documentation https://github.com/cilium/cilium/pull/32828/files/e169996613bc2cd9b6ce48df991e792401b4f3be#diff-254749e3152a2d97fdff438b3b2a1611eb7e575f1f0f665ebb534f977d5b661cL72
I guess that --set l7Proxy=false is not needed anymore when enabling the egressgatway and should be removed also ?

Yep! Can you please open a PR?

Here is the PR #33516

github-merge-queue bot pushed a commit that referenced this pull request Jul 2, 2024
Cleaning up a minor oversight in the documentation following this merge #32828

Signed-off-by: cdtzabra <22188574+cdtzabra@users.noreply.github.com>
jibi pushed a commit that referenced this pull request Jul 8, 2024
[ oss commit 1c1382d ]

Cleaning up a minor oversight in the documentation following this merge #32828

Signed-off-by: cdtzabra <22188574+cdtzabra@users.noreply.github.com>
Signed-off-by: Gilberto Bertin <jibi@cilium.io>
jibi pushed a commit that referenced this pull request Jul 9, 2024
[ upstream commit 1c1382d ]

Cleaning up a minor oversight in the documentation following this merge #32828

Signed-off-by: cdtzabra <22188574+cdtzabra@users.noreply.github.com>
Signed-off-by: Gilberto Bertin <jibi@cilium.io>
github-merge-queue bot pushed a commit that referenced this pull request Jul 10, 2024
[ upstream commit 1c1382d ]

Cleaning up a minor oversight in the documentation following this merge #32828

Signed-off-by: cdtzabra <22188574+cdtzabra@users.noreply.github.com>
Signed-off-by: Gilberto Bertin <jibi@cilium.io>
julianwiedmann added a commit to julianwiedmann/cilium that referenced this pull request Aug 1, 2024
In v1.16 we added an EGW policy hook in to-netdev (as part of
cilium#32828), and the hook in
from-container only stayed around for seamless upgrade compatibility.

With v1.17 it's now time to remove the hook in from-container, and all
associated test infrastructure.

Fixes: cilium#32994
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
github-merge-queue bot pushed a commit that referenced this pull request Aug 9, 2024
In v1.16 we added an EGW policy hook in to-netdev (as part of
#32828), and the hook in
from-container only stayed around for seamless upgrade compatibility.

With v1.17 it's now time to remove the hook in from-container, and all
associated test infrastructure.

Fixes: #32994
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann added a commit that referenced this pull request Sep 2, 2024
#32828 resolved the incompatibility
in Cilium v1.16.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann added a commit that referenced this pull request Sep 2, 2024
#32828 resolved the incompatibility
in Cilium v1.16.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
github-merge-queue bot pushed a commit that referenced this pull request Sep 3, 2024
#32828 resolved the incompatibility
in Cilium v1.16.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
nbusseneau pushed a commit that referenced this pull request Sep 11, 2024
[ upstream commit 883b212 ]

#32828 resolved the incompatibility
in Cilium v1.16.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Signed-off-by: Nicolas Busseneau <nicolas@isovalent.com>
nbusseneau pushed a commit that referenced this pull request Sep 12, 2024
[ upstream commit 883b212 ]

#32828 resolved the incompatibility
in Cilium v1.16.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Signed-off-by: Nicolas Busseneau <nicolas@isovalent.com>
github-merge-queue bot pushed a commit that referenced this pull request Sep 13, 2024
[ upstream commit 883b212 ]

#32828 resolved the incompatibility
in Cilium v1.16.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Signed-off-by: Nicolas Busseneau <nicolas@isovalent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. area/proxy Impacts proxy components, including DNS, Kafka, Envoy and/or XDS servers. feature/egress-gateway Impacts the egress IP gateway feature. kind/enhancement This would improve or streamline existing functionality. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/minor This PR changes functionality that users may find relevant to operating Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Egress gateway partially incompatible with L7 policies
4 participants