stringl1l1l1l opened a new pull request, #795: URL: https://github.com/apache/dubbo-kubernetes/pull/795
This PR introduces a foundational architectural enhancement to support **multi-cluster** and **multi-registry** environments. The changes enable the system to connect to, manage, and aggregate services from multiple Kubernetes clusters and various service registries (including Nacos and Zookeeper) simultaneously, providing a unified view of a distributed microservices ecosystem. ## Major Changes ### Multi-Cluster Management System - **New Cluster Manager (`pkg/cluster`)**: A dedicated, thread-safe manager is introduced to handle the lifecycle of multiple Kubernetes clusters. It is responsible for adding, removing, retrieving, and performing periodic health checks on each configured cluster. - **Configuration Driven**: Cluster connections are now managed through a new configuration file (`multi-cluster.yaml`) and corresponding command-line flags, allowing operators to define cluster endpoints, credentials, and metadata like region and priority. - **Health & Recovery**: The manager actively monitors the health of each cluster's API server and attempts to re-initialize clients for unhealthy clusters, improving overall system resilience. ### Multi-Registry Integration Framework - **Nacos & Zookeeper Support**: The service discovery mechanism has been extended to include native support for Nacos and Zookeeper as first-class service registry providers, alongside the existing Kubernetes provider. - **Pluggable Registry Controllers**: New, self-contained controllers for Nacos (`sail/pkg/serviceregistry/nacos`) and Zookeeper (`sail/pkg/serviceregistry/zookeeper`) have been implemented, handling protocol-specific discovery and data conversion. - **Unified Configuration**: A `multi-registry.yaml` configuration file and new CLI flags allow for declaratively defining connections to various registries, each with its own ID, priority, and type-specific parameters. ### Enhanced Registry Aggregator - **Robust Controller Lifecycle**: The core aggregate controller (`aggregate.Controller`) has been significantly improved with better panic recovery for individual registry controllers, ensuring that a single failing registry does not bring down the entire system. - **Advanced Service Merging**: The service merging logic has been enhanced to intelligently combine services from different sources. It now prefixes labels with cluster/registry info to prevent collisions and implements conflict resolution for service ports. - **Dynamic Registry Management**: The aggregator now supports dynamically adding and removing registries at runtime, with improved validation and logging. ### Bootstrap and Configuration - **New Configuration Options**: The bootstrap options (`sail/pkg/bootstrap/options.go`) have been extended with structured types for `MultiClusterOptions` and `MultiRegistryOptions`. - **Initialization Logic**: The server initialization process now reads the multi-cluster and multi-registry configurations to dynamically instantiate and start the necessary cluster managers and service registry controllers. ## Key Features Added 1. **Multi-Cluster Support**: Manage and discover services across multiple, geographically distributed Kubernetes clusters from a single control plane. 2. **Expanded Registry Integration**: Natively connect to Nacos and Zookeeper registries in addition to Kubernetes for service discovery. 3. **Unified Service View**: Aggregate services from all configured clusters and registries, providing a seamless, unified service mesh. 4. **Declarative Configuration**: Easily configure complex distributed topologies using clear, version-controllable YAML files. 5. **Improved Resilience**: Enhanced health checking for clusters and robust panic handling for registry controllers increase system stability. ## Breaking Changes - Introduction of new configuration files (`multi-cluster.yaml`, `multi-registry.yaml`) and a significant number of new CLI flags. While existing single-registry setups may still function, the recommended approach for configuring multiple sources is through the new YAML files. **To help us figure out who should review this PR, please put an X in all the areas that this PR affects.** - [ ] Docs - [ ] Installation - [] User Experience - [ ] Dubboctl - [x] Console - [x] Core Component -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
