-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[ISSUE #14077] Implement SPI-based plugin discovery and management API #14082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Refactor plugin discovery to use SPI pattern and add REST API for plugin control: SPI-based Discovery: - Replace hard-coded plugin discovery with PluginProvider SPI pattern - Add comprehensive tests for UnifiedPluginManager and PluginStatePersistence - Enable automatic plugin registration for better extensibility Management API: - Add PluginControllerV3 with 5 endpoints (list, detail, status, config, availability) - Create PluginInfoVO and PluginDetailVO for API responses - Create PluginStatusForm and PluginConfigForm for API requests - Integrate plugin state checking into all plugin managers - Add getAllPlugins() methods to expose plugin registries - Fix core module dependency name for custom-environment-plugin
|
Thanks for your this PR. 🙏 感谢您提交的PR。 🙏 |
|
|
|
|
|
|
core/src/main/java/com/alibaba/nacos/core/plugin/CriticalPluginConfig.java
Show resolved
Hide resolved
core/src/main/java/com/alibaba/nacos/core/plugin/UnifiedPluginManager.java
Show resolved
Hide resolved
core/src/main/java/com/alibaba/nacos/core/plugin/storage/PluginStatePersistence.java
Outdated
Show resolved
Hide resolved
|
|
|
|
What is the purpose of the change
This PR implements SPI-based plugin discovery mechanism and adds comprehensive REST API for plugin management. It replaces the hard-coded plugin discovery approach with a more extensible SPI pattern and provides centralized control over plugin lifecycle through REST endpoints.
Closes: #14077
Brief changelog
SPI-based Plugin Discovery:
PluginProviderSPI interface for automatic plugin registrationPluginTypeenum to categorize plugins (auth, datasource, encryption, trace, config)UnifiedPluginManagerto manage all plugin types in a centralized mannerPluginStateCheckerandPluginStateCheckerHolderfor plugin availability verificationPluginConfigSpecandConfigItemDefinitionPluginStatePersistencefor persisting plugin state to diskPlugin Management REST API:
PluginControllerV3with 5 management endpoints:GET /v3/admin/core/plugin/list- List all available pluginsGET /v3/admin/core/plugin/detail- Get detailed plugin informationPUT /v3/admin/core/plugin/status- Enable/disable non-critical pluginsPUT /v3/admin/core/plugin/config- Update plugin configurationGET /v3/admin/core/plugin/availability- Check plugin availability statusPluginInfoVO,PluginDetailVO) for API responsesPluginStatusForm,PluginConfigForm) for API requestsCriticalPluginConfigto protect critical plugins from being disabledPlugin Manager Integration:
PluginProviderSPI:AuthPluginProviderfor authentication pluginsConfigChangePluginProviderfor config change pluginsDatasourceDialectPluginProviderfor datasource pluginsEncryptionPluginProviderfor encryption pluginsTracePluginProviderfor trace pluginsgetAllPlugins()methods to expose plugin registriesVerifying this change
This change adds new features and refactors existing plugin discovery mechanism. Follow these steps to verify:
1. Unit Tests:
./mvnw clean test -pl api,core,plugin/auth,plugin/config,plugin/datasource,plugin/encryption,plugin/trace2. Compile Check:
3. Integration Test:
4. Manual API Testing:
Start Nacos server with auth disabled:
Test plugin management endpoints:
Follow this checklist to help us incorporate your contribution quickly and easily:
[ISSUE #14077] Implement SPI-based plugin discovery and management API. Each commit in the pull request should have a meaningful subject line and body.mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=trueto make sure basic checks pass. Runmvn clean install -DskipITsto make sure unit-test pass. Runmvn clean test-compile failsafe:integration-testto make sure integration-test pass.