feat: Extend SG API to have tiers, larger priority range, localAddress and port matches#6330
Conversation
Summary of ChangesHello @abhishek-pandey-1, 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 significantly enhances the capabilities of the SecurityGroup API by introducing multi-tier support for security policies, expanding the range of rule priorities, and adding new matching criteria for local addresses and ports. These changes provide greater flexibility and control over network traffic management within Kube-OVN, allowing for more complex and finely-tuned security configurations. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
801faf8 to
a0d7e78
Compare
There was a problem hiding this comment.
Code Review
This pull request enhances the SecurityGroup API by introducing tiers, a larger priority range, and matching on local address and port. The changes are extensive, affecting the CRD, controller logic, and OVS ACL creation. I've identified a couple of critical issues: the CRD validation for rule priority has not been updated to reflect the new, larger range, and there's a bug in the port matching logic for ingress rules that causes them to be ineffective. Additionally, I've suggested a minor refactoring to improve code maintainability in the validation logic.
Pull Request Test Coverage Report for Build 22989950013Details
💛 - Coveralls |
3e848c9 to
64f807e
Compare
|
@oilbeater these are the tiered ACL changes we discussed a while back. These are fully back-compatible and only provide optional additive features to allow users to stack securityGroups to create a multi-tier ACL filtering and optionally do source ip/port based filtering as well. I could not think of a sensible e2e test to add for this so I have skipped that and only added UTs. Let me know if there are any concerns. (Apologies for the delay!) |
a1d0783 to
8e6a756
Compare
c6a66bc to
2c9e861
Compare
There was a problem hiding this comment.
The install.sh should also be updated
There was a problem hiding this comment.
Thanks - I forgot about that one. Do you know if there is a plan to converge to a single CRD? Duplicate CRDs tend to go out of sync. Happy to contribute something here if you think that is a good change?
There was a problem hiding this comment.
I usually just tell AI to sync them.
There was a problem hiding this comment.
Fair enough haha. Think I broke the tests, let me fix and ping you back for approvals. Feel free to suggest any more changes in the meanwhile.
There was a problem hiding this comment.
Hi - I am a bit perplexed as to why min and max was being rejected for the tier but not for the the other fields like priority, portRange etc. given that min and max are not valid and the correct fields to use is minimum and maximum.
I wanted to look at this more but haven't had time to do so - for now fixed all instances of min and max and think everything is happy now.
…and port matching Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
…ity field Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
eb51b64 to
c6b1f24
Compare
|
Thanks! @abhishek-pandey-1 can you also update the doc in https://github.com/kubeovn/docs/blob/master/docs/vpc/security-group.en.md |
…e-ovn#6330 Co-authored-by: Copilot (copilot@github.com) Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
* Update security-group documentation to match changes from kubeovn/kube-ovn#6330 Co-authored-by: Copilot (copilot@github.com) Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com> * Improve docs Co-authored-by: Copilot (copilot@github.com) Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com> --------- Signed-off-by: Abhishek Pandey <abhpandey@microsoft.com>
Enhances securityGroup API to allow users to fully utilize multiple tiers and do source IP and port filtering if needed.
Pull Request
What type of this PR
This PR contributes a enhancements to the SecurityGroup feature.
More details:
Review of how OVN ACL and kue-ovn
OVN implements a multi-tier ACL:
Total 4 tiers: 0,1,2,3
Each tier can have rules with a priority in the range 0 – 32k.
ACLs are processed starting at tier 0, with tier progressing until a decision is reached.
Tier progression criteria:
If all tiers are exhausted, then ACL option set on port-group/switch is checked to see if the packet should be default deny or default allow.
current KubeOVN ACL Usage
Kubeovn has the following interfaces to create/contribute ACL rules to a the ACL evaluated for a port. These are:
Kubernetes policies
1, 2, and 3 are applied on the default kubernetes network (eth0) of pods selected using namespace or pod selectors.
The behaviour defined by Kubernetes is that:
Admin denies traffic using AdminNetworkPolicies - take precedence over all other network policies and cannot be overridden by network policy.
Admin allows traffic using BaselineAdminNetworkPolicy. Developers can still further restrict this using NetworkPolicies.
KubeOVN current tiered usage
Tier 1 used for admin policies which range from priority 30000 – 20000
Tier 2 used for:
Tier 3 used for BaselinNetworkPolicy which range from priority 1800-1700
This means tier 2 and tier 3 have enough space to expand the priority range and tiers used by SecurityGroups.
Behaviour with the changes in this PR