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

Add a RoutingMode option to cniConfig #6766

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

meyskens
Copy link
Contributor

@meyskens meyskens commented Oct 4, 2023

Fixes #3182

Description of changes: This adds two routing modes for CIlium to use in the CNI configuration. Tunneled keeps the default geneve tunnel mode.
Direct adds a no tunnel mode with native as routing mode

Documentation added/planned (if applicable): Added a part explaining the option and linking to Cilium documentation to the cni.md file.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This adds two routing modes for CIlium to use in the CNI configuration.
Tunneled keeps the default geneve tunnel mode.
Direct adds a no tunnel mode with native as routing mode

Signed-off-by: Maartje Eyskens <[email protected]>
@eks-distro-bot
Copy link
Collaborator

Hi @meyskens. Thanks for your PR.

I'm waiting for a aws member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@eks-distro-bot eks-distro-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 4, 2023
@chrisdoherty4
Copy link
Contributor

chrisdoherty4 commented Oct 4, 2023

Cc @jaxesn

@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (0f10c3c) 75.67% compared to head (c45992c) 71.58%.
Report is 202 commits behind head on main.

Files Patch % Lines
pkg/api/v1alpha1/cluster_types.go 40.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6766      +/-   ##
==========================================
- Coverage   75.67%   71.58%   -4.09%     
==========================================
  Files         475      545      +70     
  Lines       38411    42362    +3951     
==========================================
+ Hits        29066    30324    +1258     
- Misses       7733    10345    +2612     
- Partials     1612     1693      +81     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -237,6 +237,11 @@ func templateValues(spec *cluster.Spec, versionsBundle *cluster.VersionsBundle)
val["egressMasqueradeInterfaces"] = spec.Cluster.Spec.ClusterNetwork.CNIConfig.Cilium.EgressMasqueradeInterfaces
}

if spec.Cluster.Spec.ClusterNetwork.CNIConfig.Cilium.RoutingMode == anywherev1.CiliumRoutingModeDirect {
val["tunnel"] = "disabled"
val["routingMode"] = "native"
Copy link
Contributor

@chrisdoherty4 chrisdoherty4 Oct 4, 2023

Choose a reason for hiding this comment

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

EKS-A uses Cilium v1.12 and will be transitioning to v1.13. Neither of these have the routingMode option so I don't think this will be successful.

Should we also expose ipv4NativeRoutingCIDR from the EKS-A API? Its not totally clear to me what that option does. From the docs:

Allows to explicitly specify the IPv4 CIDR for native routing. When specified, Cilium assumes networking for this CIDR is preconfigured and hands traffic destined for that range to the Linux network stack without applying any SNAT. Generally speaking, specifying a native routing CIDR implies that Cilium can depend on the underlying networking stack to route packets to their destination. To offer a concrete example, if Cilium is configured to use direct routing and the Kubernetes CIDR is included in the native routing CIDR, the user must configure the routes to reach pods, either manually or by setting the auto-direct-node-routes flag.

I'm struggling to make sense of the example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right the flag only got added in 1.14, i had the wrong branch open. I have added the NativeRouting prefix to the config and set the auto direct mode accordingly

@@ -237,6 +237,11 @@ func templateValues(spec *cluster.Spec, versionsBundle *cluster.VersionsBundle)
val["egressMasqueradeInterfaces"] = spec.Cluster.Spec.ClusterNetwork.CNIConfig.Cilium.EgressMasqueradeInterfaces
}

if spec.Cluster.Spec.ClusterNetwork.CNIConfig.Cilium.RoutingMode == anywherev1.CiliumRoutingModeDirect {
val["tunnel"] = "disabled"
val["routingMode"] = "native"
Copy link
Contributor

Choose a reason for hiding this comment

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

@g-gaston I'm wondering if we want to expose autoDirectNodeRoutes also which, when all nodes are connected on the same L2, means route propagation is handled by Cilium. More info at https://docs.cilium.io/en/v1.12/concepts/networking/routing/#native-routing.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, as long as we have a real use case for it and we understand its implications (just so we can supports folks using it in the field), we can expose it
Personally I would prefer to roll these slowly so we can have time to learn them better, but if someone needs this right now, as I said, we can for it
Let's sync offline

Copy link
Contributor

@chrisdoherty4 chrisdoherty4 Nov 16, 2023

Choose a reason for hiding this comment

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

Given the time this has been open I think we can add the autoDirectNodeRoutes` later - this still has value.

@meyskens meyskens force-pushed the add-ciliun-routing-mode branch from 8749045 to 72e8589 Compare October 9, 2023 11:06
@eks-distro-bot eks-distro-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 9, 2023
@chrisdoherty4 chrisdoherty4 self-assigned this Nov 16, 2023
@chrisdoherty4
Copy link
Contributor

/lgtm

@chrisdoherty4
Copy link
Contributor

/approve

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chrisdoherty4

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@chrisdoherty4
Copy link
Contributor

/test eks-anywhere-presubmit

Copy link
Member

@chrisnegus chrisnegus left a comment

Choose a reason for hiding this comment

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

Just a couple of nits from me.

@chrisdoherty4 chrisdoherty4 force-pushed the add-ciliun-routing-mode branch from bf112fb to c45992c Compare December 12, 2023 15:21
@chrisdoherty4
Copy link
Contributor

/lgtm

@eks-distro-bot eks-distro-bot merged commit 91693d0 into aws:main Dec 12, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/docs Documentation documentation lgtm size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow customization of cilium CNI
5 participants