-
Notifications
You must be signed in to change notification settings - Fork 136
support CIDR and IPv6 #772
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Prakhar-Shankar <[email protected]>
Signed-off-by: Prakhar-Shankar <[email protected]>
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 adds support for CIDR blocks and IPv6 addresses in the pod network partition functionality. Previously, the system was incorrectly appending "/32" to all destination IPs regardless of their format.
- Introduces
normalizeIPOrCIDR()function to properly handle IPv4, IPv6, and CIDR formats - Replaces the previous IP processing logic with proper validation and normalization
- Adds comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| network-policy.go | Implements new IP/CIDR normalization logic and refactors setExceptIPs method |
| network-policy_cidr_test.go | Adds unit tests for CIDR handling and IP normalization functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
chaoslib/litmus/pod-network-partition/lib/network-policy_cidr_test.go
Outdated
Show resolved
Hide resolved
|
Hey @Prakhar-Shankar thanks for the PR 🙏, can you please address the Copilot comments? |
Signed-off-by: Prakhar-Shankar <[email protected]>
Thanks for reviewing, I have changed the test file so that it won't take empty string as an error. I have also added the recommended comments. |
neelanjan00
left a comment
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.
LGTM.
Problem:
Earlier the program was adding "/32" to every destination IP be it CIDR or IPv6.
Solution:
Introduced normalizeIPOrCIDR() to validate and normalize IPs:
fixes #717
Note - I have also added a test file to check everything is working fine.
Checklist:
breaking-changestagrequires-upgradetag