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

Extract tunnel options to simplify override, and inject them through hive #29051

Merged
merged 2 commits into from Nov 14, 2023

Conversation

giorio94
Copy link
Member

@giorio94 giorio94 commented Nov 8, 2023

Certain features (e.g., egress gateway, high-scale ipcache, ...) require
the configuration of the tunnel device also then the primary routing
mode is set to native routing, as some traffic may need to flow through
it. Currently, every affected code path needs ad-hoc checks, which is
getting more and more complex with the addition of new features.

This commit consolidates the tunnel-related options, that is protocol,
port, device name and whether it requires MTU adaptation, into a single
struct, initialized based on the user configuration and the requests of
additional features, and propagated through hive. Specifically, different
modules can now request the configuration of the tunnel device (regardless
of the primary routing mode) through the injection of the appropriate
enabler object. Additional validation constraints can be specified if a
given feature is compatible only with a specific encapsulation protocol.

This change introduces a small functional difference, because now the
tunnel protocol flag is always respected, and no longer defaulted to
geneve when Cilium is configured in native routing mode, and DSR
Geneve is enabled. This prevents causing unexpected tunnel changes
when turning on/off other features (DSR Geneve in this case).

The primary routing mode is still represented by the TunnelingEnabled()
function, both to reduce the scope of this change and because it is
currently accessed also before the initialization of the hive.

Fixes: #25769
Depends on: #29053

@giorio94 giorio94 added kind/cleanup This includes no functional changes. area/daemon Impacts operation of the Cilium daemon. release-note/misc This PR makes changes that have no direct user impact. labels Nov 8, 2023
@giorio94
Copy link
Member Author

giorio94 commented Nov 8, 2023

/test

@giorio94
Copy link
Member Author

giorio94 commented Nov 8, 2023

/test

@giorio94
Copy link
Member Author

giorio94 commented Nov 8, 2023

Marking ready for review, to start gathering feedback. Please ignore the first commit, as it is a stripped down version of #29053, which should be merged first.

@giorio94 giorio94 added the dont-merge/blocked Another PR must be merged before this one. label Nov 8, 2023
@giorio94 giorio94 marked this pull request as ready for review November 8, 2023 15:52
@giorio94 giorio94 requested review from a team as code owners November 8, 2023 15:52
Copy link
Member

@christarazi christarazi left a comment

Choose a reason for hiding this comment

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

ci-structure LGTM

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.

LGTM, thanks! Left a comment but don't let it block merging.

daemon/cmd/kube_proxy_replacement.go Show resolved Hide resolved
Copy link
Contributor

@lmb lmb left a comment

Choose a reason for hiding this comment

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

Loader changes LGTM.

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.

One log message nitpick, and one question wrt to upgrade behaviour. Both could be addressed as follow-on PR if needed. Otherwise lgtm, thank you very much Marco!

daemon/cmd/kube_proxy_replacement.go Outdated Show resolved Hide resolved
test/k8s/services.go Show resolved Hide resolved
@julianwiedmann julianwiedmann added the upgrade-impact This PR has potential upgrade or downgrade impact. label Nov 9, 2023
Copy link
Member

@ysksuzuki ysksuzuki left a comment

Choose a reason for hiding this comment

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

LGTM! Just a non-blocking newbie question.

Copy link
Contributor

@derailed derailed left a comment

Choose a reason for hiding this comment

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

@giorio94 Nice work Marco!

pkg/datapath/loader/netlink.go Show resolved Hide resolved
pkg/datapath/loader/netlink.go Show resolved Hide resolved
pkg/datapath/tunnel/cell.go Show resolved Hide resolved
pkg/datapath/tunnel/tunnel.go Show resolved Hide resolved
@giorio94
Copy link
Member Author

Rebased onto main and dropped the temporary commit. Additionally added a new commit extending the upgrade notes to document the behavioral difference with respect to Cilium configured in native routing mode with DSR Geneve enabled.

@giorio94 giorio94 removed the dont-merge/blocked Another PR must be merged before this one. label Nov 10, 2023
@giorio94
Copy link
Member Author

/test

@giorio94
Copy link
Member Author

Fixed a test failing due to a mismatch of integer types.

@giorio94
Copy link
Member Author

/ci-runtime

@giorio94
Copy link
Member Author

/test

Certain features (e.g., egress gateway, high-scale ipcache, ...) require
the configuration of the tunnel device also then the primary routing
mode is set to native routing, as some traffic may need to flow through
it. Currently, every affected code path needs ad-hoc checks, which is
getting more and more complex with the addition of new features.

This commit consolidates the tunnel-related options, that is protocol,
port, device name and whether it requires MTU adaptation, into a single
struct, initialized based on the user configuration and the requests of
additional features, and propagated through hive. Specifically, different
modules can now request the configuration of the tunnel device (regardless
of the primary routing mode) through the injection of the appropriate
enabler object. Additional validation constraints can be specified if a
given feature is compatible only with a specific encapsulation protocol.

This change introduces a small functional difference, because now the
tunnel protocol flag is always respected, and no longer defaulted to
geneve when Cilium is configured in native routing mode, and DSR
Geneve is enabled. This prevents causing unexpected tunnel changes
when turning on/off other features (DSR Geneve in this case).

The primary routing mode is still represented by the TunnelingEnabled()
function, both to reduce the scope of this change and because it is
currently accessed also before the initialization of the hive.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Historically, the tunnel protocol was defaulted to geneve when Cilium
was configured in native routing mode and DSR Geneve was enabled. This
is no longer the case since the last commit, and the tunnel protocol
flag is now always respected (possibly triggering an error if
incompatible), so that we don't cause unexpected tunnel changes when
turning on/off other features. Hence, let's document in the upgrade
notes that users now need to explicitly configure the tunnel protocol
to geneve when using DSR Geneve.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
@giorio94
Copy link
Member Author

Rebased onto main to fix conflict

@giorio94
Copy link
Member Author

/test

Copy link
Contributor

@derailed derailed left a comment

Choose a reason for hiding this comment

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

@giorio94 Thanks for the updates!

@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 Nov 14, 2023
@julianwiedmann julianwiedmann merged commit 1cc77a1 into cilium:main Nov 14, 2023
61 checks passed
@julianwiedmann
Copy link
Member

Additionally added a new commit extending the upgrade notes to document the behavioral difference with respect to Cilium configured in native routing mode with DSR Geneve enabled.

Note that Marco wrote up a draft for how we could do auto-selection of the tunnel protocol in some scenarios: #29267. Let's continue any discussion there.

julianwiedmann added a commit to julianwiedmann/cilium that referenced this pull request Feb 19, 2024
Reflect the config change from cilium#29051
in the kubeproxy-free docs for DSR-Geneve.

Fixes: cilium#30845
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
github-merge-queue bot pushed a commit that referenced this pull request Feb 20, 2024
Reflect the config change from #29051
in the kubeproxy-free docs for DSR-Geneve.

Fixes: #30845
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
YutaroHayakawa pushed a commit that referenced this pull request Feb 27, 2024
[ upstream commit 8791007 ]

Reflect the config change from #29051
in the kubeproxy-free docs for DSR-Geneve.

Fixes: #30845
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
YutaroHayakawa pushed a commit that referenced this pull request Feb 27, 2024
[ upstream commit 8791007 ]

Reflect the config change from #29051
in the kubeproxy-free docs for DSR-Geneve.

Fixes: #30845
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
YutaroHayakawa pushed a commit that referenced this pull request Feb 27, 2024
[ upstream commit 8791007 ]

Reflect the config change from #29051
in the kubeproxy-free docs for DSR-Geneve.

Fixes: #30845
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
YutaroHayakawa pushed a commit that referenced this pull request Feb 28, 2024
[ upstream commit 8791007 ]

Reflect the config change from #29051
in the kubeproxy-free docs for DSR-Geneve.

Fixes: #30845
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/daemon Impacts operation of the Cilium daemon. kind/cleanup This includes no functional changes. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact. upgrade-impact This PR has potential upgrade or downgrade impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate checks for ad-hoc TUNNEL_PROTOCOL setting
8 participants