Skip to content

fix: avoid OVN northd "No path for static route" warning on startup#6323

Merged
oilbeater merged 1 commit intomasterfrom
fix/ovn-northd-no-path-static-route-warning
Feb 24, 2026
Merged

fix: avoid OVN northd "No path for static route" warning on startup#6323
oilbeater merged 1 commit intomasterfrom
fix/ovn-northd-no-path-static-route-warning

Conversation

@oilbeater
Copy link
Copy Markdown
Collaborator

Summary

  • Remove addNodeGatewayStaticRoute() from syncNodeRoutes() (init phase) and handleAddNode() where it ran before the join subnet's OVN Logical Router Port existed, causing OVN northd to warn: No path for static route 0.0.0.0/0 on router ovn-cluster; next hop 100.64.0.1
  • Add LogicalSwitchExists check in handleAddOrUpdateVpc() to requeue the default VPC if the join subnet's logical switch is not yet ready, preventing the race between VPC worker and Subnet worker
  • Remove the now-unused addNodeGatewayStaticRoute() function since handleAddOrUpdateVpc() already manages default route reconciliation via VPC route diffing

Root Cause

During controller startup, there were three places adding default gateway routes:

Location Function Timing Safe?
Init phase syncNodeRoutes()addNodeGatewayStaticRoute() Before workers start ❌ join LRP does not exist
VPC Worker handleAddOrUpdateVpc() Concurrent with Subnet Worker ⚠️ race condition
Node Worker handleAddNode()addNodeGatewayStaticRoute() After subnet ready ✅ but redundant

The init phase call always triggered the warning. The VPC worker call could race with the Subnet worker.

Fix

  • Init phase: Remove the route addition entirely — let the VPC worker handle it
  • VPC worker: Check that the join logical switch exists before adding routes; requeue if not ready
  • Node worker: Remove redundant call since VPC worker already reconciles all routes

On controller restart, the informer's initial list triggers enqueueAddVpc for the default VPC, and since OVN NB data is persistent, the join logical switch already exists — routes are added immediately without warnings.

Test plan

  • make lint passes (0 issues)
  • make ut passes (all packages ok)
  • Verify no No path for static route warning in OVN northd logs after controller restart
  • Verify default routes (0.0.0.0/0, ::/0) are present after fresh install and controller restart

🤖 Generated with Claude Code

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Feb 23, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @oilbeater, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a persistent warning in OVN northd ("No path for static route") that occurred during controller startup and node additions. The issue stemmed from static gateway routes being added before the corresponding OVN Logical Router Port for the join subnet was fully established, leading to unreachable next-hop errors. The solution refactors the route addition logic by centralizing default route reconciliation within the VPC worker, introducing a readiness check for the logical switch, and removing redundant route additions from the initialization and node handling phases. This ensures routes are only added when the OVN infrastructure is prepared, eliminating the warnings and streamlining the network configuration process.

Highlights

  • Route Addition Refactoring: The addNodeGatewayStaticRoute() function call has been removed from the controller's initialization phase (syncNodeRoutes()) and the node handling logic (handleAddNode()) to prevent premature route additions before the necessary OVN Logical Router Port exists.
  • VPC Worker Race Condition Fix: A LogicalSwitchExists check was introduced in handleAddOrUpdateVpc() to ensure the join subnet's logical switch is ready before attempting to add default routes, thereby preventing race conditions between the VPC and Subnet workers.
  • Code Cleanup: The addNodeGatewayStaticRoute() function, now unused due to centralized route reconciliation in handleAddOrUpdateVpc(), has been completely removed.
Changelog
  • pkg/controller/init.go
    • Removed the call to c.addNodeGatewayStaticRoute().
  • pkg/controller/node.go
    • Removed the call to c.addNodeGatewayStaticRoute().
    • Removed the entire addNodeGatewayStaticRoute() function definition.
  • pkg/controller/vpc.go
    • Added a check using c.OVNNbClient.LogicalSwitchExists() to verify the existence of the node's logical switch.
    • Implemented logic to requeue the VPC if the logical switch is not yet ready, preventing premature route additions.
Activity
  • Verified that make lint passes with 0 issues.
  • Verified that make ut passes for all packages.
  • Pending verification for the absence of "No path for static route" warnings in OVN northd logs after controller restart.
  • Pending verification for the presence of default routes (0.0.0.0/0, ::/0) after a fresh install and controller restart.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses the OVN northd warning on startup by refactoring the default route creation logic to avoid a race condition. The changes are clean and well-targeted. However, I've identified a potential regression in behavior. The removed addNodeGatewayStaticRoute function contained logic to avoid adding a default route if the user was managing static routes for the VPC. The new implementation in handleAddOrUpdateVpc appears to unconditionally add a default route, which could lead to conflicts with user-defined configurations. I've added a high-severity comment detailing this issue.

I am having trouble creating individual review comments. Click here to see my feedback.

pkg/controller/node.go (921-955)

high

By removing addNodeGatewayStaticRoute, the logic to avoid adding a default gateway route when a user provides their own static routes in the VPC spec is also removed. The previous implementation checked vpc.Spec.StaticRoutes and skipped adding a default route if it was user-managed. The new implementation in handleAddOrUpdateVpc unconditionally adds a default route for the default VPC. This could lead to conflicts with user-defined routes and represents a regression in behavior.

To fix this, the logic in handleAddOrUpdateVpc should be updated to check if a default route (0.0.0.0/0 or ::/0) already exists in vpc.Spec.StaticRoutes before adding its own.

@coveralls
Copy link
Copy Markdown

coveralls commented Feb 23, 2026

Pull Request Test Coverage Report for Build 22316478569

Details

  • 0 of 8 (0.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.01%) to 23.069%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller/vpc.go 0 8 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/controller/vpc.go 2 16.25%
Totals Coverage Status
Change from base Build 22313794790: 0.01%
Covered Lines: 12533
Relevant Lines: 54328

💛 - Coveralls

During controller startup, default gateway static routes (0.0.0.0/0 and
::/0) were added to the OVN logical router before the join subnet's
Logical Router Port was created, causing OVN northd to warn about
unreachable next hops.

This fix ensures routes are only added after the join subnet's OVN
Logical Switch and LRP exist:

1. Remove addNodeGatewayStaticRoute() call from syncNodeRoutes() which
   runs during init phase before any OVN logical switches are created.

2. Add LogicalSwitchExists check in handleAddOrUpdateVpc() to requeue
   the VPC if the join subnet's logical switch is not yet ready, avoiding
   the race between VPC worker and Subnet worker.

3. Remove redundant addNodeGatewayStaticRoute() call from handleAddNode()
   since handleAddOrUpdateVpc() already manages default route reconciliation
   as part of VPC route diffing. Also remove the now-unused function.

Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
@oilbeater oilbeater force-pushed the fix/ovn-northd-no-path-static-route-warning branch from b3b380e to c0f6d01 Compare February 23, 2026 17:05
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 24, 2026
@oilbeater oilbeater merged commit 53bad7e into master Feb 24, 2026
75 of 77 checks passed
@oilbeater oilbeater deleted the fix/ovn-northd-no-path-static-route-warning branch February 24, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants