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

UDN: Prerequisite: Make OVN topology network aware. #4478

Merged
merged 31 commits into from
Jun 28, 2024

Conversation

dceara
Copy link
Contributor

@dceara dceara commented Jun 27, 2024

What this PR does and why is it needed

This PR is a prerequisite for adding support for L2/L3 user defined network support.

It adds helpers to avoid hardcoding OVN topology names (cluster router, node switches, managament ports, external switches, GW routers).

It changes (most of) the code base to use the new wrappers. There are still some places where names are built in an ad-hoc manner, e.g., some parts of the hybrid overlay implementation and the kubevirt package. The latter doesn't use a network controller derived from BaseNetworkController so making it network aware is left as a follow up task.

Which issue(s) this PR fixes

Fixes #

Special notes for reviewers

There are quite a few commits in this PR but the rationale is to make the transition to the new helpers in chunks, per functionality to allow for a simpler review process.

How to verify it

This doesn't change functionality so existing unit and e2e tests must pass as-is.

Details to documentation updates

No doc changes needed.

Description for the changelog

Don't hardcode OVN topology names.

Does this PR introduce a user-facing change?

NONE

@dceara dceara added the feature/user-defined-network-segmentation All PRs related to User defined network segmentation label Jun 27, 2024
@github-actions github-actions bot added feature/egress-ip Issues related to EgressIP feature area/unit-testing Issues related to adding/updating unit tests feature/network-qos Issues related to egressQoS feature/egress-service Issues related to egress service feature/egress-gateway All issues related to ICNI/APBR feature/egress-firewall All issues related to egress firewall labels Jun 27, 2024
@dceara dceara requested a review from tssurya June 27, 2024 11:33
@dceara dceara mentioned this pull request Jun 27, 2024
9 tasks
@dceara dceara force-pushed the net-seg-make-topo-net-aware branch 2 times, most recently from 9164d25 to 1c1c8d5 Compare June 27, 2024 14:56
@dceara
Copy link
Contributor Author

dceara commented Jun 27, 2024

@tssurya This at least passes UTs. Marking it as ready for review in the hope that it also passes e2e.

@dceara dceara marked this pull request as ready for review June 27, 2024 15:23
@dceara dceara requested a review from a team as a code owner June 27, 2024 15:23
dceara added 16 commits June 28, 2024 10:41
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the port name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
And use the GetNetworkScopedK8sMgmtIntfName() wrapper instead of
buidling the port name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the port name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
It makes it easier to use generic network aware wrappers in the future.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of hardcoding the cluster router name.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the name manually.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
…ter name.

This allows us to use it from multiple networks.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the name manually.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the name manually.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
dceara added 15 commits June 28, 2024 10:43
Instead of building the name manually.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the GW router name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
…ame.

This allows us to use it from multiple networks.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the GW router name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the GW router name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the router name ad-hoc.

TODO: this still isn't network aware!

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
…omNode().

TODO: there are still a few places, e.g., apbroute, where we use
GetGatewayRouterFromNode() directly.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the node switch name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the node switch name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the node switch name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the node switch name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the node switch name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of hardcoding the join switch name.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Instead of building the node switch name ad-hoc.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
@dceara dceara force-pushed the net-seg-make-topo-net-aware branch from 1c1c8d5 to 2b29179 Compare June 28, 2024 08:57
Comment on lines +47 to +52
GetNetworkScopedK8sMgmtIntfName(nodeName string) string
GetNetworkScopedClusterRouterName() string
GetNetworkScopedGWRouterName(nodeName string) string
GetNetworkScopedSwitchName(nodeName string) string
GetNetworkScopedJoinSwitchName() string
GetNetworkScopedExtSwitchName(nodeName string) string
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Since these are really under under NetInfo they are suppose to be NetworkScoped maybe we can remove that part although I see they are used as oc.GetNetworkScopedClusterRouteName.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed offline, it's probably more explicit to keep them as is. Otherwise:

oc.GetNetworkScopedClusterRouteName()

would change to:

oc.GetClusterRouteName()

@tssurya Wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the NetworkScoped part

Copy link
Member

Choose a reason for hiding this comment

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

Not at desk(will come back to this again), but in future PRs do we plan to use this from everywhere in BNC? Where its internally going to be defaultnetwork(empty) and other networks? Ny preference depends on that..
Like do we plan to keep getrouterName etc in DNC as is? And this is extra on top?

Copy link
Contributor

@trozet trozet left a comment

Choose a reason for hiding this comment

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

had some comments about the kubevirt file, but can be cleaned up later

@@ -94,7 +94,7 @@ func EnsureLocalZonePodAddressesToNodeRoute(watchFactory *factory.WatchFactory,
if config.OVNKubernetesFeature.EnableInterconnect {
// NOTE: EIP & ESVC use same route and if this is already present thanks to those features,
// this will be a no-op
if err := libovsdbutil.CreateDefaultRouteToExternal(nbClient, pod.Spec.NodeName); err != nil {
if err := libovsdbutil.CreateDefaultRouteToExternal(nbClient, types.OVNClusterRouter, pod.Spec.NodeName); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems a little awkard to me. The commit talks about making it for multiple networks, so I would have expected refactoring this to use oc.GetNetworkScopedClusterRouter or whatever the function is. Also the EnsureLocalZonePodAddressesToNodeRoute function passes in the nadName. Maybe this is just something to clean up later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, the kubevirt part needs further cleanup. I kind of gave up half way there. Let's do that as a follow up, thanks for your review!

@@ -94,7 +94,7 @@ func EnsureLocalZonePodAddressesToNodeRoute(watchFactory *factory.WatchFactory,
if config.OVNKubernetesFeature.EnableInterconnect {
// NOTE: EIP & ESVC use same route and if this is already present thanks to those features,
// this will be a no-op
if err := libovsdbutil.CreateDefaultRouteToExternal(nbClient, types.OVNClusterRouter, pod.Spec.NodeName); err != nil {
if err := libovsdbutil.CreateDefaultRouteToExternal(nbClient, types.OVNClusterRouter, types.GWRouterPrefix+pod.Spec.NodeName); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

another instance of my previous comment in the same file. I think we should either make functions in kubevirt receivers of the controller, or pass the controller in here and use the correct function rather than fixing this behavior of string concat in some places by using functions, but here we still prepend the prefix.

@trozet
Copy link
Contributor

trozet commented Jun 28, 2024

odd APB Route flaked:
External Gateway With Admin Policy Based External Route CRs e2e multiple external gateway validation Should validate ICMP connectivity to multiple external gateways for an ECMP scenario [It] IPV4

https://github.com/ovn-org/ovn-kubernetes/actions/runs/9710194825/job/26811460206?pr=4478

Looks like its being tracked here: #4432

@trozet trozet merged commit 6b5c591 into ovn-org:master Jun 28, 2024
35 of 36 checks passed
@dceara dceara deleted the net-seg-make-topo-net-aware branch July 1, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/unit-testing Issues related to adding/updating unit tests feature/egress-firewall All issues related to egress firewall feature/egress-gateway All issues related to ICNI/APBR feature/egress-ip Issues related to EgressIP feature feature/egress-service Issues related to egress service feature/network-qos Issues related to egressQoS feature/user-defined-network-segmentation All PRs related to User defined network segmentation
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants