-
Notifications
You must be signed in to change notification settings - Fork 260
[backport v1.6] [NPM Lite] Bypassing IPSets for IP CIDR Block Based Network Policies … #4147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…4107) * added logic to bypass ipsets for /32 cidrs with npm lite * removed logic to only look at /32 pod cidrs and allow all pod cidr * updated code specific to direct ip logic * fixed if else logic * added error for named port * get rid of unneeded comments * got rid of function in utils that was not neede * added unit test for translate policy * resolved pr comments * resolved copilot comments * fixed golinter
|
/azp run Azure Container Networking PR, NPM Scale Test, NPM Conformance Tests |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements NPM Lite mode optimization for Windows by bypassing IPSet creation for all IP CIDR-based network policies. Instead of creating IPSets for CIDR blocks, the implementation now directly embeds IP addresses in ACL policies, reducing overhead and improving performance for CIDR-based network policies when npm lite is enabled.
Key Changes:
- Added direct IP address fields (
SrcDirectIPs,DstDirectIPs) to ACL policies for npm lite mode - Implemented
directPeerAndPortAllowRulefunction to handle CIDR blocks without IPSets - Enhanced error messages for named port validation with additional context
- Refactored Windows ACL settings to support both IPSet-based and direct IP approaches
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| npm/pkg/dataplane/policies/policy.go | Added SrcDirectIPs and DstDirectIPs fields to ACLPolicy struct for direct IP matching; fixed comment formatting |
| npm/pkg/dataplane/policies/policy_windows.go | Implemented direct IP handling in ACL settings conversion; fixed spelling of "definitions" |
| npm/pkg/controlplane/translation/translatePolicy.go | Added directPeerAndPortAllowRule function for npm lite CIDR handling; removed npmLiteValidPolicy function; enhanced checkForNamedPortType with detailed error context |
| npm/pkg/controlplane/translation/translatePolicy_test.go | Added comprehensive tests for direct IP/CIDR handling; removed obsolete TestNpmLiteCidrPolicy; updated TestCheckForNamedPortType for new function signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…(#4107)
added logic to bypass ipsets for /32 cidrs with npm lite
removed logic to only look at /32 pod cidrs and allow all pod cidr
updated code specific to direct ip logic
fixed if else logic
added error for named port
get rid of unneeded comments
got rid of function in utils that was not neede
added unit test for translate policy
resolved pr comments
resolved copilot comments
fixed golinter
Reason for Change:
Issue Fixed:
Requirements:
Notes: