Skip to content

Conversation

@zbb88888
Copy link
Collaborator

@zbb88888 zbb88888 commented Nov 17, 2025

Pull Request

What type of this PR

Examples of user facing changes:

  • Features

  • IPPool support to sync its ips into address set.

  • Enable IPPool to work with vpc policy route or ACL

Which issue(s) this PR fixes

Fixes #(issue-number)

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. feature New network feature labels Nov 17, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @zbb88888, 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 enhances the IPPool functionality by enabling direct synchronization with OVN address sets. This integration allows IPPools to be seamlessly utilized for advanced networking features such as VPC policy-based routing and Access Control Lists (ACLs), providing a more dynamic and automated way to manage network policies based on defined IP ranges. The changes involve extending the IPPool API, implementing the necessary controller logic for OVN interaction, and ensuring proper resource lifecycle management through finalizers and comprehensive testing.

Highlights

  • IPPool API Extension: Introduced a new EnableAddressSet boolean field in the IPPoolSpec to explicitly control whether an IPPool should be synchronized with an OVN address set.
  • OVN Address Set Synchronization: Implemented controller logic to automatically create, update, and delete OVN address sets based on the EnableAddressSet field and the IPs defined in an IPPool.
  • IP Range Expansion and Normalization: Added robust utility functions to parse and expand various IP formats (single IPs, CIDRs, and IP ranges like "10.0.0.1..10.0.0.5") into canonical CIDR representations for OVN address sets.
  • Finalizer Management: Integrated finalizers for IPPools to ensure that associated OVN address sets are properly cleaned up upon IPPool deletion, preventing resource leaks.
  • Comprehensive Testing: Included new unit tests for the IP parsing and address set naming logic, and added an end-to-end conformance test to validate the full lifecycle of IPPool-backed OVN address sets.
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
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 introduces a new feature to synchronize IPPools with OVN address sets, which is crucial for enabling policy-based routing and ACLs. The changes include adding an EnableAddressSet field to the IPPool CRD, implementing controller logic to manage OVN address sets, and providing comprehensive unit and E2E tests. The IP parsing and range expansion logic appears robust and well-tested. However, there are a couple of areas that could be improved for maintainability and robustness.

@coveralls
Copy link

coveralls commented Nov 17, 2025

Pull Request Test Coverage Report for Build 19498592422

Details

  • 274 of 415 (66.02%) changed or added relevant lines in 4 files are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.4%) to 22.278%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller/init.go 0 4 0.0%
pkg/util/ippool.go 206 212 97.17%
pkg/ipam/ip_range_list.go 68 81 83.95%
pkg/controller/ippool.go 0 118 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/controller/ippool.go 1 0.0%
pkg/ovs/ovn-nb-logical_router_route.go 2 74.6%
Totals Coverage Status
Change from base Build 19453678196: 0.4%
Covered Lines: 11409
Relevant Lines: 51212

💛 - Coveralls

@zbb88888 zbb88888 changed the title Ip pool sync to address set IPPool sync to address set Nov 18, 2025
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Nov 18, 2025
…tility functions for CIDR normalization

Signed-off-by: zbb88888 <[email protected]>
…dling

- Introduced edge case tests for ExpandIPPoolAddresses, covering scenarios like empty inputs, CIDR normalization, and complex mixed inputs.
- Added error condition tests for ExpandIPPoolAddresses to handle invalid inputs and ranges.
- Implemented ToCIDRs method in IPRangeList to convert IP ranges to CIDR notation, ensuring proper handling of single IPs and ranges.
- Created unit tests for ToCIDRs to validate various cases including empty lists, single IPs, CIDRs, and overlapping ranges.
- Enhanced the ExpandIPPoolAddresses function documentation to clarify its behavior regarding overlapping ranges.
- Added tests for canonicalization and normalization functions to ensure correctness in handling IP addresses and CIDR formats.

Signed-off-by: zbb88888 <[email protected]>
…dress set limitations and update related tests

Signed-off-by: zbb88888 <[email protected]>
…dling in expandIPPoolAddressesInternal

Signed-off-by: zbb88888 <[email protected]>
@zbb88888 zbb88888 force-pushed the ip-pool-sync-to-address-set branch from 3c5f094 to 3cdd2a2 Compare November 18, 2025 11:38
Signed-off-by: zbb88888 <[email protected]>
Signed-off-by: zbb88888 <[email protected]>
@zbb88888
Copy link
Collaborator Author

@oilbeater 大佬,帮忙 review 下吧,主要是想扩展 ippool 映射到 address set,这样可以和 vpc 的策略路由一起用

Signed-off-by: zbb88888 <[email protected]>
Signed-off-by: zbb88888 <[email protected]>
Signed-off-by: zbb88888 <[email protected]>
Signed-off-by: zbb88888 <[email protected]>
Signed-off-by: zbb88888 <[email protected]>
Signed-off-by: zbb88888 <[email protected]>
@zbb88888 zbb88888 requested a review from oilbeater November 21, 2025 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New network feature size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants