Feat/flexible topology config#273
Open
Transcendental-Programmer wants to merge 34 commits intokubeslice:masterfrom
Open
Feat/flexible topology config#273Transcendental-Programmer wants to merge 34 commits intokubeslice:masterfrom
Transcendental-Programmer wants to merge 34 commits intokubeslice:masterfrom
Conversation
Added topology configuration API to SliceConfig CRD to enable hub-spoke, partial-mesh, and custom connectivity patterns, moving away from hardcoded full-mesh topology. Changes include: - Extended SliceConfig API with TopologyConfig struct supporting multiple topology types (auto, full-mesh, hub-spoke, partial-mesh, custom) - Added hub-spoke configuration with allowSpokeToSpoke flag - Added custom connectivity matrix for explicit cluster-to-cluster routing - Added cluster VPN role assignment (auto, server, client) - Added policy nodes for security-aware routing in auto topology mode - Updated CRD OpenAPI schema with validation rules and defaults - Added three sample SliceConfig manifests demonstrating topology patterns API changes are backward compatible - existing SliceConfigs without topologyConfig will default to 'auto' mode. Signed-off-by: Priyansh Saxena <priyena.programming@gmail.com> Signed-off-by: “Transcendental-Programmer” <“priyena.programming@gmail.com”> Signed-off-by: Priyansh Saxena <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
- Add TopologyConfig with 5 topology types (full-mesh, hub-spoke, auto, custom, isolated) - Implement AutoTopologyOptions with int-based relativeThresholdPercent (1-500 = 0.1%-50.0%) - Add HubSpokeConfig with SpokeConnectivity for selective spoke-to-spoke connections - Create TopologyValidator service for comprehensive validation - Integrate validation into SliceConfig admission webhook - Generate CRD with topology fields and validation constraints - Maintain backward compatibility (nil topologyConfig defaults to full-mesh) Tested: - ✅ Legacy SliceConfig without topology (backward compatible) - ✅ Hub-spoke topology with spoke connectivity - ✅ Auto topology with integer threshold - ✅ CRD validation rejects out-of-range values (1000 > 500) Week 1-2 deliverable: API specification and validation logic Signed-off-by: Priyansh Saxena <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
…tom, and full-mesh support Signed-off-by: Priyansh Saxena <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
…tility Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
…ustom) Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Replace deprecated PolicyNodes/ClusterRoles API with ForbiddenEdges for explicit edge blacklisting in topology configuration. Changes: - Remove ClusterRole struct (ClusterName, VPNRole fields) - Add ForbiddenEdge struct (SourceCluster, TargetClusters fields) - Replace TopologyConfig.ClusterRoles with ForbiddenEdges - Replace TopologyConfig.PolicyNodes with ForbiddenEdges - Update CRD OpenAPI schema to reflect new field structure - Regenerate deepcopy code for ForbiddenEdge type Rationale: ForbiddenEdges provides simpler, more predictable topology control compared to PolicyNodes' implicit isolation behavior. Part-of: Week 1 API changes Related-to: #topology-refactor Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Add sample topology configurations for auto-secure, full-mesh, and custom-matrix topology types. Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Update slice configuration validation and service logic related to topology implementation. Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Add and update tests for slice configuration webhook validation related to topology implementation. Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Update worker slice gateway service logic related to topology implementation. Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Add and update tests for worker slice gateway service related to topology implementation. Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
This change updates the default topology type from 'auto' to 'full-mesh' in both the Go types and CRD specification. It also removes some unnecessary comments in the slice config service. Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
- Remove AutoOptions struct containing telemetry fields - Remove telemetry-specific configuration options - Keep topology type enum with 'auto', 'full-mesh', and 'custom' values - Update TopologyConfig to only include connectivity-based options This removes all telemetry-based autotopology functionality while maintaining the same API interface Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
- Remove AutoOptions struct containing telemetry fields - Remove telemetry-specific configuration options - Keep topology type enum with 'auto', 'full-mesh', and 'custom' values - Update TopologyConfig to only include connectivity-based options This removes all telemetry-based autotopology functionality while maintaining the same API interface Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
- Move GatewayPair struct from slice_config_service.go to util/common.go - Update all service files to use util.GatewayPair - Regenerate mocks with updated interface signature - Fix test compilation by using util.GatewayPair in tests - This resolves circular dependency issue in mocks package Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
…ling tests - Rename TestResolveTopologyPairs_AutoTopology to TestResolveTopologyPairs_RestrictedTopology - Rename TestResolveTopologyPairs_AutoTopologyNoForbidden to TestResolveTopologyPairs_RestrictedTopologyNoForbidden - Rename TestResolveAutoTopology to TestResolveRestrictedTopology - Remove PartitionedTopology and FourClustersWithBridge subtests that relied on removed partition healing logic These renames align test names with the TopologyRestricted type and remove tests that validated the partition healing feature which was intentionally removed to simplify the topology resolution logic. Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
…ster detection Changes: - Remove Bidirectional field from util.GatewayPair struct - Update resolveFullMeshTopology to create all directional pairs (n*(n-1) pairs for n clusters) - Update resolveCustomTopology to remove Bidirectional initialization - Update buildForbiddenSet and filterForbiddenPairs to use directional keys - Implement validateRestrictedTopology with O(n²) BFS connectivity check - Detect isolated clusters and reject topologies with unreachable clusters - Add buildForbiddenSetStatic helper for webhook validation (O(n) complexity) - Add tests for isolated cluster validation scenarios - Update all service tests to expect directional pairs instead of bidirectional Gateway pairs now explicitly represent directional connections. For full-mesh with 3 clusters, creates 6 pairs (c1->c2, c1->c3, c2->c1, c2->c3, c3->c1, c3->c2) instead of 3 bidirectional pairs. Webhook validation ensures forbidden edges do not partition the cluster graph by performing reachability analysis using BFS algorithm on the complement graph. Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> This commit includes: - Added comprehensive integration tests for topology features - Fixed bidirectional filtering in restricted topology - Updated unit tests for topology validation and service logic - Removed obsolete auto topology tests Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
…solete auto tests Changes: - Restore 7 topology integration test cases in sliceconfig_controller_test.go * Full-mesh topology tests * Custom topology tests * Restricted topology tests * Multiple topology types validation - Add NetworkPresent and ClusterHealth status fields to clusters in integration tests - Remove obsolete TestValidateTopologyConfig_AutoWithOptions and TestValidateTopologyConfig_AutoInvalidThreshold - These Auto tests were redundant with Restricted topology tests since topology type was renamed Integration tests verify: - Full-mesh topology creates correct gateway pairs - Custom connectivity matrix is respected - Restricted topology with forbidden edges works correctly - Topology changes during slice lifecycle Signed-off-by: $(git config user.name) <$(git config user.email)> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
- Add TopologyConfig field to WorkerSliceConfigSpec to propagate topology info to workers - Regenerate deepcopy methods and CRDs - This enables the hub to send topology type to worker clusters Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Transcendental-Programmer <priyena.programming@gmail.com> Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
d37a8e9 to
2ec29fb
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.
Description
This PR implements flexible topology configuration for SliceConfig, enabling hub-spoke, custom connectivity patterns, and restricted topologies to replace the hardcoded full-mesh model.
What changed:
API types (
apis/controller/v1alpha1/sliceconfig_types.go):TopologyConfigwith 3 topology types:full-mesh(default),custom,restrictedConnectivityMatrixfor explicit source→target definitions (custom mode)ForbiddenEdgesto exclude specific cluster pairs (restricted mode)Service layer (
service/topology_service.go):TopologyServicewith dependency injection patternresolveTopologyPairs()- main entry point returning gateway pairsresolveFullMeshTopology()- creates n*(n-1)/2 bidirectional pairsresolveCustomTopology()- processes connectivity matrix entriesresolveRestrictedTopology()- full-mesh minus forbidden edgesfilterForbiddenPairs()- bidirectional filtering (blocks both A→B and B→A)Validation (
service/slice_config_webhook_validation.go):validateTopologyConfig()- orchestrates all topology validationvalidateCustomTopology()- ensures all clusters in matrix exist in spec.clustersvalidateRestrictedTopology()- validates forbidden edge clustersvalidateForbiddenEdges()- checks source/target cluster validityfield.ErrorListfor API server integrationGateway integration (
service/worker_slice_gateway_service.go):CreateMinimumWorkerSliceGateways()to use topology serviceIntegration tests (
controllers/controller/sliceconfig_controller_test.go):CRD updates (
config/crd/bases/controller.kubeslice.io_sliceconfigs.yaml):topologyTypeArchitecture highlights:
{A,B}set creates bothslice-A-Bandslice-B-A)main.goand passed to gateway serviceBackward compatibility:
SliceConfigs without
topologyConfigdefault to full-mesh (maintains existing behavior). No breaking changes.Fixes: #253
How Has This Been Tested?
Unit tests:
Integration tests:
Manual verification in kind cluster:
Checklist:
Does this PR introduce a breaking change?
No. All topology fields are optional. Existing SliceConfigs continue to work with full-mesh default.