← Back to Pull requests

Fix default route replacement #1552

Open
stek29 opened this pull request with 35 lines diff across 2 files
View on GitHub
stek29 stek29 commented on Sep 20, 2026 22:37 UTC
Author

Multus was failing to detect existing Default routes in container and remove them before replacement, which causes later adding of default route to fail with EEXIST, which is ignored and not detected as a error.

This leads to container keeping existing default route in case of chained CNIs instead of getting new default route from Multus.

Fixes regression introduced by f18d96b648559d1b67d21eb8b772df51c7a493e7

There was a breaking change in that bump:
https://github.com/vishvananda/netlink/commit/acdc658b8613655ddb69f978e9fb4cf413e2b830 route.Dst is a zero IPNet instead of nil

Check for default route using isIPNetZero adopted from github.com/containernetworking/plugins/pkg/ip.IsIPNetZero. Avoid importing ip.IsIPNetZero to avoid brining more dependencies.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

Summary by CodeRabbit

  • Bug Fixes

  • - Improved default-route detection to recognize IPv4 and IPv6 zero-prefix routes, including routes with nil destinations.
    - Deleting the default gateway now correctly removes these default route variants.

  • Tests

  • - Added coverage for IPv4, IPv6, and nil default-route destinations.
    - Extended route deletion checks to confirm no default routes remain.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 35 lines (+34 / -1) across 2 files Reviewer: wizhaoredhat Review duration: 109984m
    All Vouch review confidence checks passed
    Residual risk 0.12 = Change Risk (0.38) × (1 − Review Confidence (0.69)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.38 · 35 lines diff across 2 files
    0.38
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.57 · 5 substantive comment(s)
    0.57
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    69%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.214
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    8 items
    coderabbitai[bot] coderabbitai[bot] commented on Sep 20, 2026 22:38 UTC
    Bot

    <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
    <!-- review_stack_entry_start -->

    <a href="https://app.coderabbit.ai/change-stack/k8snetworkplumbingwg/multus-cni/pull/1552#gh-light-mode-only"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg" alt="Review Change Stack" width="202" height="32"></a><a href="https://app.coderabbit.ai/change-stack/k8snetworkplumbingwg/multus-cni/pull/1552#gh-dark-mode-only"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg" alt="Review Change Stack" width="202" height="32"></a>

    <!-- review_stack_entry_end -->
    <!-- recent_review_start -->

    No actionable comments were generated in the recent review. 🎉

    <details>
    <summary>ℹ️ Recent review info</summary>

    <details>
    <summary>⚙️ Run configuration</summary>

    Configuration used: Repository: k8snetworkplumbingwg/multus-cni/.coderabbit.yaml

    Review profile: CHILL

    Plan: Advanced

    Run ID: 07e2275e-d425-4c16-b554-06c32f71e0f8

    </details>

    <details>
    <summary>📥 Commits</summary>

    Reviewing files that changed from the base of the PR and between f68879000841714a83475c51590e501192e51abe and 26340cd64bf7cf4e051ec8d29e0f8c479c9101d9.

    </details>

    <details>
    <summary>📒 Files selected for processing (2)</summary>

    pkg/netutils/netutils.go
    pkg/netutils/netutils_test.go

    </details>

    Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

    </details>

    ---

    <!-- recent_review_end -->
    <!-- walkthrough_start -->

    Walkthrough

    DeleteDefaultGW now recognizes nil and zero-prefix IPv4 or IPv6 destinations. Tests cover helper behavior and verify that no zero-prefix route remains after deletion.

    Changes

    Default route detection

    |Layer / File(s)|Summary|
    |---|---|
    |Route matching and validation <br> pkg/netutils/netutils.go, pkg/netutils/netutils_test.go|isIPNetZero identifies nil and zero-prefix destinations. DeleteDefaultGW uses the helper. Tests cover IPv4, IPv6, nil destinations, and post-deletion routes.|

    <!-- change_assessment_start -->
    Priority: ➖ Normal

    Estimated code review effort: 2 (Simple) | ~10 minutes

    <!-- change_assessment_commit:"26340cd64bf7cf4e051ec8d29e0f8c479c9101d9" -->
    Change: Bug fix
    <!-- change_assessment_end -->

    <!-- walkthrough_end -->
    <!-- pre_merge_checks_walkthrough_start -->

    <details>
    <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary>

    ❌ Failed checks (1 warning)

    | Check name | Status | Explanation | Resolution |
    | :----------------: | :--------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- |
    | Docstring Coverage | ⚠️ Warning | Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. |

    <details>
    <summary>✅ Passed checks (4 passed)</summary>

    | Check name | Status | Explanation |
    | :------------------------: | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
    | Title check | ✅ Passed | The title, "Fix default route replacement," clearly and concisely describes the main change: correcting default-route detection before replacement. |
    | 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. |

    </details>

    </details>

    <!-- pre_merge_checks_walkthrough_end -->

  • <!-- {"checkboxId":"585bb3f6-faf5-4dbf-96d2-74e382adf19a"} --> Fix all pre-merge checks with AI

  • <!-- finishing_touch_checkbox_start -->

    <details>
    <summary>✨ Finishing Touches</summary>

    <details open>
    <summary>🧪 Generate unit tests (beta)</summary>

  • <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create a new PR
  • </details>

    </details>

    <!-- finishing_touch_checkbox_end -->
    <!-- tips_start -->

    ---

    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.

    <details>
    <summary>❤️ Share</summary>

  • X

  • Mastodon

  • Reddit

  • LinkedIn
  • </details>

    <sub>Comment @coderabbitai help to get the list of available commands.</sub>

    <!-- tips_end -->

    wizhaoredhat wizhaoredhat approved these changes on Sep 25, 2026 14:27 UTC
    Approved Reviewer

    LGTM

    github-actions[bot] github-actions[bot] commented on Sep 25, 2026 14:59 UTC
    Bot

    🚀 Performance Test Results

    Status: ✅ Completed
    Workflow Run: #35542276439
    Baseline: Run #36147853262

    ---

    Workloads Tested: 2

    ---

    <details>
    <summary><strong>node-density-cni-0.4.0</strong></summary>

    📊 Kubernetes Workload Metrics Report


    node-density-cni-0.4.0 Performance Results

    Generated on: 2026-10-04 05:00:43 UTC

    📊 Baseline: Run from workflow

    🎯 Pod Ready Latency (Main KPI)


    | Metric | Current | Baseline | Change |
    |--------|---------|----------|--------|
    | Average Latency | 1648.4 ms | 6359.4 ms | -4710.9 (-74.1%) |
    | Max Latency | 5000 ms | 10000 ms | -5000 (-50.0%) |
    | Min Latency | 0 ms | 4000 ms | -4000 (-100.0%) |
    | Total Pods | 128 | 128 | 0 |

    ---
    Report generated by Multus performance testing
    </details>

    <details>
    <summary><strong>node-density-cni-0.3.1</strong></summary>

    📊 Kubernetes Workload Metrics Report


    node-density-cni-0.3.1 Performance Results

    Generated on: 2026-10-04 05:00:43 UTC

    📊 Baseline: Run from workflow

    🎯 Pod Ready Latency (Main KPI)


    | Metric | Current | Baseline | Change |
    |--------|---------|----------|--------|
    | Average Latency | 4781.2 ms | 4320.3 ms | +460.9 (+10.7%) |
    | Max Latency | 8000 ms | 8000 ms | 0 (0.0%) |
    | Min Latency | 2000 ms | 2000 ms | 0 (0.0%) |
    | Total Pods | 128 | 128 | 0 |

    ---
    Report generated by Multus performance testing
    </details>
    ---

    Previous Run

    <details>
    <summary><strong>2026-09-25 14:59:05 UTC</strong></summary>

    🚀 Performance Test Results

    Status: ❌ Failed
    Workflow Run: #35542276439
    Baseline: Run #35069431027

    ---

    Workloads Tested: 2

    ---

    <details>
    <summary><strong>node-density-cni-0.4.0</strong></summary>

    📊 Kubernetes Workload Metrics Report


    node-density-cni-0.4.0 Performance Results

    Generated on: 2026-09-25 19:33:43 UTC

    📊 Baseline: Run from workflow

    🎯 Pod Ready Latency (Main KPI)


    | Metric | Current | Baseline | Change |
    |--------|---------|----------|--------|
    | Average Latency | 1648.4 ms | 2453.1 ms | -804.7 (-32.8%) |
    | Max Latency | 5000 ms | 6000 ms | -1000 (-16.7%) |
    | Min Latency | 0 ms | 0 ms | N/A |
    | Total Pods | 128 | 128 | 0 |

    ---
    Report generated by Multus performance testing
    </details>

    <details>
    <summary><strong>node-density-cni-0.3.1</strong></summary>

    📊 Kubernetes Workload Metrics Report


    node-density-cni-0.3.1 Performance Results

    Generated on: 2026-09-25 19:33:43 UTC

    📊 Baseline: Run from workflow

    🎯 Pod Ready Latency (Main KPI)


    ⚠️ No pod latency data available

    ---
    Report generated by Multus performance testing
    </details>
    </details>

    ---
    🤖 Generated by performance-report workflow

    stek29 stek29 commented on Sep 25, 2026 18:53 UTC
    Author

    I'm not sure that the failing e2e has anything to do with my changes, and I can't restart it to see if it's flaky

    Anything else I have to do here to get this merged?

    stek29 stek29 commented on Oct 03, 2026 12:50 UTC
    Author

    Hey, is there anything I can do to help this get merged?

    wizhaoredhat wizhaoredhat commented on Oct 06, 2026 14:32 UTC
    Contributor

    @bpickard22 PTAL, CI lanes pass

    stek29 stek29 commented on Nov 16, 2026 15:46 UTC
    Author

    Hey, any chance this could get looked at? Anything I can do to help?

    Reviewers
    Assignees
    stek29 stek29
    Labels
    risk: low confidence: 69.1% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.9% (MEDIUM) · Higher = larger blast radius
    37.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 69.1% · Lower = rushed or shallow review
    69.1%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 11.7% · Safe to merge
    11.7%