feat: Preflight checks for validating pod and service CIDRs#1493
Open
feat: Preflight checks for validating pod and service CIDRs#1493
Conversation
Add NutanixCIDRValidation preflight check to validate Pod and Service CIDR sizes before cluster deployment: - Block Pod CIDRs /24 or smaller (supports only 1 node with /24 node mask) - Warn on Pod CIDRs /21-/23 with max-node capacity calculation - Block Service CIDRs /24 or smaller (insufficient service IP capacity) - Warn on Service CIDRs /21-/23 (tight capacity) This prevents cluster deployment failures caused by IP exhaustion during node scaling or upgrades.
Extend CIDR validation preflight check to detect and block overlapping Pod and Service CIDR ranges. Overlapping Pod and Service CIDRs cause routing conflicts in the Kubernetes cluster network, leading to service connectivity failures.
Extend CIDR validation to detect overlaps between Pod/Service CIDRs and node subnet CIDRs by querying Nutanix Prism Central: - Collect subnet identifiers from Control Plane and Worker configs - Resolve subnet CIDRs from Prism Central API (GetSubnetById/ListSubnets) - Extract IPv4 prefixes from subnet ipConfig - Detect Pod/Service CIDR overlaps with node subnets - Gracefully handle missing Prism Central connection This prevents infrastructure network conflicts where Pod or Service traffic could be misrouted to node networks.
5f47ed3 to
de82fa9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?:
Adding Preflight checks for Pod and Service CIDR.
Cases:
Pod CIDR vs Service CIDR
Pod CIDR vs Subnet CIDR
Service CIDR vs Subnet CIDR
Which issue(s) this PR fixes:
Fixes #
https://jira.nutanix.com/browse/NCN-112546
How Has This Been Tested?:
Manually Verified:
Special notes for your reviewer:
Most of the code was generated with Cursor AI, would appreciate any inputs on organizing.