Skip to content

cni-server: fix inserting and deleting iptables rules#5421

Merged
zhangzujian merged 1 commit intokubeovn:masterfrom
zhangzujian:fix-iptables
Jul 3, 2025
Merged

cni-server: fix inserting and deleting iptables rules#5421
zhangzujian merged 1 commit intokubeovn:masterfrom
zhangzujian:fix-iptables

Conversation

@zhangzujian
Copy link
Copy Markdown
Member

Pull Request

What type of this PR

Examples of user facing changes:

  • Features
  • Bug fixes
  • Docs
  • Tests

Which issue(s) this PR fixes

Fixes #(issue-number)

@zhangzujian zhangzujian added bug Something isn't working need backport labels Jul 2, 2025
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 2, 2025
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.

Summary of Changes

Hello @zhangzujian, 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 primarily addresses a bug in the CNI server's iptables rule management, specifically fixing an issue with the insertion logic for NAT prerouting rules. Additionally, it introduces new configuration options for TPROXY functionality and improves the flexibility of image pull policies during Helm deployments, particularly for Talos installations.

Highlights

  • Iptables Rule Fix: Corrected a logical error in pkg/daemon/gateway_linux.go by changing a comparison from < to <= in the ensureNatPreroutingRulePosition function. This ensures that existing NAT prerouting rules are correctly identified at their exact insertion position, resolving a potential bug in rule management.
  • TPROXY Configuration: Introduced a new func.ENABLE_TPROXY Helm chart parameter in Makefile for both install-chart and upgrade-chart targets. This allows users to enable TPROXY functionality during deployment.
  • Image Pull Policy Control: Added image.pullPolicy as a configurable Helm chart parameter in Makefile for install-chart and upgrade-chart targets. This provides more granular control over how container images are pulled, defaulting to IfNotPresent.
  • Talos Build Enhancements: Updated talos.mk to explicitly enable ENABLE_TPROXY=true and set IMAGE_PULL_POLICY=Always for Talos-specific installations, aligning with the new configuration options.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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 fixes a bug in iptables rule insertion logic and introduces new configuration options for T-Proxy and image pull policy. The iptables fix is correct. The new configurations are added consistently. I've suggested some improvements in the Makefile for efficiency and readability, and a refactoring in the Go code to improve maintainability.

Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread pkg/daemon/gateway_linux.go Outdated
@coveralls
Copy link
Copy Markdown

coveralls commented Jul 2, 2025

Pull Request Test Coverage Report for Build 16039592081

Details

  • 0 of 6 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.007%) to 21.566%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/daemon/gateway_linux.go 0 6 0.0%
Totals Coverage Status
Change from base Build 16038977532: 0.007%
Covered Lines: 10514
Relevant Lines: 48753

💛 - Coveralls

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jul 2, 2025
@zhangzujian zhangzujian linked an issue Jul 2, 2025 that may be closed by this pull request
@zhangzujian zhangzujian force-pushed the fix-iptables branch 3 times, most recently from ec8ea7f to a2dd4fb Compare July 3, 2025 00:45
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 3, 2025
@zhangzujian zhangzujian merged commit 8cc5029 into kubeovn:master Jul 3, 2025
167 of 170 checks passed
@zhangzujian zhangzujian deleted the fix-iptables branch July 3, 2025 06:00
zhangzujian added a commit that referenced this pull request Jul 3, 2025
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
zhangzujian added a commit that referenced this pull request Jul 3, 2025
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
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 need backport size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] cni-server: create and delete nat prerouting rules repeatly

3 participants