Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CSI-244): match subnets if existing in client rule (#315)
### TL;DR Improved NFS client group rule matching to include superset IP networks. ### What changed? - Added `IsSupersetOf` method to `NfsClientGroupRule` to check if a rule covers a larger IP range. - Updated `FindNfsClientGroupRulesByFilter` to include rules that are supersets of the query. - Implemented `GetMaskBits` method for `Network` to calculate CIDR notation. - Enhanced `ContainsIPAddress` method to handle cases where CIDR parsing fails. - Added unit tests for the new `IsSupersetOf` functionality. ### How to test? 1. Run the new unit tests in `nfs_test.go`. 2. Test the `FindNfsClientGroupRulesByFilter` function with various IP ranges and ensure it returns both exact matches and superset rules. 3. Verify that the `ContainsIPAddress` method correctly identifies IP addresses within a given network range. ### Why make this change? This change improves the flexibility and accuracy of NFS client group rule matching. By including superset IP networks, the system can now identify and apply rules that cover a broader range of IP addresses, enhancing the overall functionality of the NFS access control system. When having an extremely large Kubernetes clusters, adding node IP addresses to client group could harm the rule matching performance or hit limits on max. number of rules. This allows using a subnet addresses (those should be configured by administrator) ---
- Loading branch information