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

datapath: fix NodePort to remote hostns backend with tunnel config #27323

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

michaelasp
Copy link
Contributor

When forwarding external service requests to a remote backend in hostNetwork, the NodePort code in tail_nodeport_nat_egress_ipv4() doesn't redirect into the tunnel (as it's effectively a host-to-host connection).

Therefore it uses IPV4_DIRECT_ROUTING as src address. So if we're not populating IPV4_DIRECT_ROUTING, such forwarded requests end up being SNATed with 0.0.0.0.

This is a copy of #22738 by jwi@isovalent.com, reopening to debug test failures.

Fixes: #22557
Fixes: 5283ec9 ("datapath: Introduce DirectRoutingDeviceRequired helper")

@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 Aug 7, 2023
@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Aug 7, 2023
@michaelasp
Copy link
Contributor Author

After rebasing on top of #24677, a nil check introduced in front of device manager allows the tests to pass. Looks like this can be merged with just these changes 😄

@michaelasp michaelasp marked this pull request as ready for review August 24, 2023 18:35
@michaelasp michaelasp requested review from a team as code owners August 24, 2023 18:35
@michaelasp
Copy link
Contributor Author

@julianwiedmann these are basically the changes you made in #22738 but updated with some of the newer changes in device manager. Tested the agent tests, and they pass now 🥳

@joestringer joestringer added release-note/bug This PR fixes an issue in a previous release of Cilium. affects/v1.12 This issue affects v1.12 branch affects/v1.13 This issue affects v1.13 branch affects/v1.14 This issue affects v1.14 branch needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch and removed dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Aug 24, 2023
@joestringer
Copy link
Member

/test

@joestringer
Copy link
Member

If this is based on #22738, then please ensure that the commit message properly attributes the origins of the source, ie:

Co-authored-by: Julian Wiedmann <jwi@isovalent.com>

@michaelasp
Copy link
Contributor Author

Thanks @joestringer! Definitely want to make sure credit is given 👍

@joestringer
Copy link
Member

I'm seeing a few CI issues that are due to the PR being based on an older version of main. I'd suggest rebasing against the tip of the main branch and updating the commit message while you're at it.

@joestringer joestringer added the dont-merge/needs-rebase This PR needs to be rebased because it has merge conflicts. label Aug 24, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.14.2 Aug 24, 2023
@michaelasp
Copy link
Contributor Author

Done!

@joestringer
Copy link
Member

/test

@michaelasp
Copy link
Contributor Author

Fixed issue in TestDetect, other issues seem unrelated. I reverted my changes just in case and I could repro the TestWriteNodeConfig failures locally.

@aojea
Copy link
Contributor

aojea commented Sep 8, 2023

@julianwiedmann as previous owner of the PR can you please help us with the reviews and approval process?

@michi-covalent michi-covalent added this to Needs backport from main in 1.14.3 Sep 9, 2023
@michi-covalent michi-covalent removed this from Needs backport from main in 1.14.2 Sep 9, 2023
@lmb
Copy link
Contributor

lmb commented Sep 25, 2023

@jibi can you review this please?

@michaelasp please respond to or resolve the open conversations.

@michaelasp
Copy link
Contributor Author

Hey @lmb sorry for the wait! I just got back to my computer today from a long break, responded 😃.

Copy link
Member

@jibi jibi left a comment

Choose a reason for hiding this comment

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

The rationale for the change makes sense to me, but it could have a broader impact than expected as:

  • DirectRoutingDeviceRequired() can now return true even when tunneling is not enabled
  • because of that (*DeviceManager) Detect() will try to auto-detect a direct routing device even in tunneling mode
  • if we fail to detect a device either bpf nodeport gets disabled or the agent returns an error during initialization

so this PR has a potential upgrade impact as it might break some setups that used to work before 🤔

@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 Sep 26, 2023
@jibi jibi removed the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Sep 26, 2023
Copy link
Member

@jibi jibi left a comment

Choose a reason for hiding this comment

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

synced internally, I think in practice these changes are fine 👍

@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 Sep 26, 2023
@michaelasp
Copy link
Contributor Author

Awesome! Glad to hear :)

@lmb
Copy link
Contributor

lmb commented Sep 27, 2023

Removing ready-to-merge since @ti-mo needs to approve for cilium/loader. Not sure why the automation decided this was ready.

@lmb lmb removed ready-to-merge This PR has passed all tests and received consensus from code owners to merge. dont-merge/needs-rebase This PR needs to be rebased because it has merge conflicts. labels Sep 27, 2023
@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 Sep 27, 2023
@lmb lmb merged commit f2dcc86 into cilium:main Sep 28, 2023
61 checks passed
@sayboras sayboras mentioned this pull request Oct 6, 2023
9 tasks
@sayboras sayboras added backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. and removed needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Oct 6, 2023
@joamaki joamaki added needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch and removed backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. labels Oct 10, 2023
@joamaki joamaki mentioned this pull request Oct 10, 2023
4 tasks
@joamaki joamaki added backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. and removed needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Oct 10, 2023
@github-actions github-actions bot added backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. and removed backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. labels Oct 12, 2023
@jrajahalme jrajahalme moved this from Needs backport from main to Backport done to v1.14 in 1.14.3 Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/v1.12 This issue affects v1.12 branch affects/v1.13 This issue affects v1.13 branch affects/v1.14 This issue affects v1.14 branch backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. kind/community-contribution This was a contribution made by a community member. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
No open projects
1.14.3
Backport done to v1.14
Development

Successfully merging this pull request may close these issues.

Can't connect to remote NodePort backend in hostNetwork (with tunnel enabled)