Skip to content

Automated backport of #4126: Fix OVN-K Interconnect: Remove deprecated nexthop field - #4128

Merged
tpantelis merged 4 commits into
submariner-io:release-0.23from
yboaron:automated-backport-of-#4126-origin-release-0.23
Aug 17, 2026
Merged

Automated backport of #4126: Fix OVN-K Interconnect: Remove deprecated nexthop field#4128
tpantelis merged 4 commits into
submariner-io:release-0.23from
yboaron:automated-backport-of-#4126-origin-release-0.23

Conversation

@yboaron

@yboaron yboaron commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Backport of #4126 on release-0.23.

#4126: Fix OVN-K Interconnect: Remove deprecated nexthop field

For details on the backport process, see the backport requests page.

Summary by CodeRabbit

  • Bug Fixes
    • Improved OVN logical router policy handling to correctly replace duplicate match rules.
    • Updated next-hop matching to support multiple next hops and IPv4/IPv6-specific routes.
    • Automatically removes outdated or conflicting policies, including those using the legacy next-hop format.
    • Preserves unrelated OVN-K routes and policies during policy updates.
  • Tests
    • Expanded coverage for policy migration, conditional removal, and IPv4/IPv6 routing scenarios.

OVN 26.03.3+ (OCP 4.21.27+, 4.22.6+) ignores Logical Router Policies
that have the deprecated 'nexthop' (singular) field set, even when
'nexthops' (array) is correctly populated.

This causes RouteAgent health checks to fail because ovn-northd does
not generate southbound flows for these policies, logging:
  'policy uses deprecated column nexthop, this column is ignored'

Why not keep both fields?
Manual testing showed that when BOTH nexthop and nexthops are set,
ovn-northd ignores the entire policy. Only when nexthop field is
cleared (leaving only nexthops populated) does the southbound flow
appear and RouteAgent health checks succeed.

Fixes: submariner-io#4124

Signed-off-by: Yossi Boaron <yboaron@redhat.com>
Enhance stale policy detection to also match policies with the deprecated
Nexthop field set, even when Nexthops is correctly populated. This ensures
complete migration from old Submariner versions.

Add regression test that verifies:
- Old policies with both Nexthop (deprecated) and Nexthops (correct) set
- Are detected as stale and replaced during reconciliation
- New policies have only Nexthops field (Nexthop is nil)

Addresses: CodeRabbit actionable comment on PR submariner-io#4125
Signed-off-by: Yossi Boaron <yboaron@redhat.com>
@submariner-bot

Copy link
Copy Markdown
Contributor

🤖 Created branch: z_pr4128/yboaron/automated-backport-of-#4126-origin-release-0.23
🚀 Full E2E won't run until the "ready-to-test" label is applied. I will add it automatically once the PR has 2 approvals, or you can add it manually.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7dabfca7-71a1-43be-a705-2e63df8668b3

📥 Commits

Reviewing files that changed from the base of the PR and between 5477d0c and 2ceb4be.

📒 Files selected for processing (1)
  • pkg/routeagent_driver/handlers/ovn/handler_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/routeagent_driver/handlers/ovn/handler_test.go

Walkthrough

OVN logical router policy reconciliation now uses Nexthops, replaces duplicate matches in the fake OVSDB client, removes legacy policies, and adds IPv4/IPv6 and migration test coverage. OVN handler tests also propagate Ginkgo context to resource operations.

Changes

OVN Nexthops reconciliation

Layer / File(s) Summary
Fake OVSDB policy semantics
pkg/routeagent_driver/handlers/ovn/fake/ovsdb_client.go
Duplicate logical router policies are replaced by Match. Lookups compare Match and Nexthops, with optional legacy Nexthop validation. Predicate-based deletion removes matching models.
OVN policy reconciliation
pkg/routeagent_driver/handlers/ovn/ovn_logical_routes.go
Stale-policy cleanup removes incorrect or legacy policies. Generated policies use the Nexthops slice.
Policy migration and family-aware tests
pkg/routeagent_driver/handlers/ovn/handler_test.go
Tests cover IPv4 and IPv6 matches, Nexthops, unrelated policy preservation, and migration from legacy Nexthop policies.
Context-aware handler tests
pkg/routeagent_driver/handlers/ovn/handler_test.go
Test callbacks, setup helpers, and resource operations now use Ginkgo context.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OVNHandler
  participant ovn_logical_routes
  participant fake_ovsdb_client
  participant LogicalRouterPolicy
  OVNHandler->>ovn_logical_routes: reconcile GatewayRoute
  ovn_logical_routes->>fake_ovsdb_client: find stale policies
  fake_ovsdb_client->>LogicalRouterPolicy: evaluate Nexthops and legacy Nexthop
  ovn_logical_routes->>fake_ovsdb_client: delete stale policies
  ovn_logical_routes->>fake_ovsdb_client: create policy with Nexthops
Loading

Possibly related PRs

Suggested labels: bug

Suggested reviewers: skitt, vthapar, sridhargaddam, tpantelis, oats87

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the backport and the main change: removing the deprecated nexthop field in OVN-K Interconnect.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Actionable Comments Resolved ✅ Passed Commits 50deaf7 and 2ceb4be explicitly address CodeRabbit actionable comments #2#4; comment #1 is documented as a false positive, with no unresolved review markers found.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/routeagent_driver/handlers/ovn/fake/ovsdb_client.go`:
- Around line 151-173: The fake OVSDB client must preserve distinct
LogicalRouterPolicy rows during migration instead of deduplicating by Match
alone. Update Create at
pkg/routeagent_driver/handlers/ovn/fake/ovsdb_client.go:151-173, and adjust the
related hasModel logic at
pkg/routeagent_driver/handlers/ovn/fake/ovsdb_client.go:186-195 and GetModel
logic at pkg/routeagent_driver/handlers/ovn/fake/ovsdb_client.go:243-252 so an
omitted Nexthops probe treats that field as unconstrained. Update the migration
assertions in pkg/routeagent_driver/handlers/ovn/handler_test.go:650-669 to
verify the legacy row is absent and the migrated row has Nexthop == nil.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6dc3d98c-2a09-42e5-9b70-d3a1c45582ab

📥 Commits

Reviewing files that changed from the base of the PR and between 6d19fc5 and 34107fc.

📒 Files selected for processing (3)
  • pkg/routeagent_driver/handlers/ovn/fake/ovsdb_client.go
  • pkg/routeagent_driver/handlers/ovn/handler_test.go
  • pkg/routeagent_driver/handlers/ovn/ovn_logical_routes.go

Comment thread pkg/routeagent_driver/handlers/ovn/fake/ovsdb_client.go
@yboaron
yboaron force-pushed the automated-backport-of-#4126-origin-release-0.23 branch from 34107fc to 5477d0c Compare August 12, 2026 05:00
@yboaron yboaron added the ready-to-test When a PR is ready for full E2E testing label Aug 12, 2026
- Fix Go 1.26 new(expr) syntax to Go 1.25 compatible pointer creation
- Remove invalid context parameters from helper method calls
  (release-0.24 helper signatures don't accept context)
- Update fake OVSDB client to match on Nexthop field when set
- Remove unused k8s.io/utils/ptr import

This addresses CodeRabbit comments #2, #3, and #4 for the backport.
Comment #1 (Priority check) is a false positive for Submariner's design.

Signed-off-by: Yossi Boaron <yboaron@redhat.com>
@yboaron
yboaron force-pushed the automated-backport-of-#4126-origin-release-0.23 branch from 5477d0c to 2ceb4be Compare August 12, 2026 06:57
@yboaron

yboaron commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

It seems the lint vulnerability scanning failure is pre-existing on release-0.23 and unrelated to this PR — PR #4130 was merged on 0.23 repo with the identical failure, should be safe to merge.

@tpantelis
tpantelis enabled auto-merge (rebase) August 17, 2026 19:11
@tpantelis
tpantelis merged commit ced1adb into submariner-io:release-0.23 Aug 17, 2026
52 of 58 checks passed
@submariner-bot

Copy link
Copy Markdown
Contributor

🤖 Closed branches: [z_pr4128/yboaron/automated-backport-of-#4126-origin-release-0.23]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-backport ready-to-test When a PR is ready for full E2E testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants