Skip to content

Conversation

@WangzJi
Copy link
Contributor

@WangzJi WangzJi commented Dec 30, 2025

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:

  • Introduce PluginProvider SPI interface for automatic plugin registration
  • Add PluginType enum to categorize plugins (auth, datasource, encryption, trace, config)
  • Implement UnifiedPluginManager to manage all plugin types in a centralized manner
  • Add PluginStateChecker and PluginStateCheckerHolder for plugin availability verification
  • Create plugin configuration specifications with PluginConfigSpec and ConfigItemDefinition
  • Implement PluginStatePersistence for persisting plugin state to disk

Plugin Management REST API:

  • Add PluginControllerV3 with 5 management endpoints:
    • GET /v3/admin/core/plugin/list - List all available plugins
    • GET /v3/admin/core/plugin/detail - Get detailed plugin information
    • PUT /v3/admin/core/plugin/status - Enable/disable non-critical plugins
    • PUT /v3/admin/core/plugin/config - Update plugin configuration
    • GET /v3/admin/core/plugin/availability - Check plugin availability status
  • Create VO classes (PluginInfoVO, PluginDetailVO) for API responses
  • Create Form classes (PluginStatusForm, PluginConfigForm) for API requests
  • Add CriticalPluginConfig to protect critical plugins from being disabled

Plugin Manager Integration:

  • Update existing plugin managers to implement PluginProvider SPI:
    • AuthPluginProvider for authentication plugins
    • ConfigChangePluginProvider for config change plugins
    • DatasourceDialectPluginProvider for datasource plugins
    • EncryptionPluginProvider for encryption plugins
    • TracePluginProvider for trace plugins
  • Add getAllPlugins() methods to expose plugin registries
  • Integrate plugin state checking into all plugin managers

Verifying 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/trace

2. Compile Check:

./mvnw -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true

3. Integration Test:

./mvnw clean test-compile failsafe:integration-test

4. Manual API Testing:

Start Nacos server with auth disabled:

java -jar distribution/target/nacos-server.jar --nacos.core.auth.enabled=false

Test plugin management endpoints:

# List all plugins
curl -s "http://localhost:8848/nacos/v3/admin/core/plugin/list"

# Get plugin detail
curl -s "http://localhost:8848/nacos/v3/admin/core/plugin/detail?pluginType=auth&pluginName=nacos"

# Check plugin availability
curl -s "http://localhost:8848/nacos/v3/admin/core/plugin/availability?pluginType=auth&pluginName=nacos"

# Disable a non-critical plugin (if available)
curl -X PUT "http://localhost:8848/nacos/v3/admin/core/plugin/status" \
  -H "Content-Type: application/json" \
  -d '{"pluginType":"trace","pluginName":"example","enabled":false}'

# Update plugin config (if plugin supports configuration)
curl -X PUT "http://localhost:8848/nacos/v3/admin/core/plugin/config" \
  -H "Content-Type: application/json" \
  -d '{"pluginType":"auth","pluginName":"nacos","config":"{\"key\":\"value\"}"}'

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #14077] Implement SPI-based plugin discovery and management API. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.

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
@github-actions
Copy link

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API新增配置参数修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@wuyfee
Copy link

wuyfee commented Jan 5, 2026

$\color{red}{FAILURE}$
DETAILS
✅ - docker: success
❌ - deploy (standalone & cluster & standalone_auth): failure
❌ - e2e-java-test (standalone & cluster & standalone_auth): skipped
❌ - e2e-go-test (standalone & cluster): skipped
❌ - e2e-cpp-test (standalone & cluster): skipped
❌ - e2e-csharp-test (standalone & cluster): skipped
❌ - e2e-nodejs-test (standalone & cluster): skipped
❌ - e2e-python-test (standalone & cluster): skipped
✅ - clean (standalone & cluster & standalone_auth): success

@WangzJi WangzJi changed the title feat(plugin): implement SPI-based plugin discovery and management API [ISSUE #14077] Implement SPI-based plugin discovery and management API Jan 5, 2026
@wuyfee
Copy link

wuyfee commented Jan 5, 2026

$\color{red}{FAILURE}$
DETAILS
✅ - docker: success
❌ - deploy (standalone & cluster & standalone_auth): failure
❌ - e2e-java-test (standalone & cluster & standalone_auth): skipped
❌ - e2e-go-test (standalone & cluster): skipped
❌ - e2e-cpp-test (standalone & cluster): skipped
❌ - e2e-csharp-test (standalone & cluster): skipped
❌ - e2e-nodejs-test (standalone & cluster): skipped
❌ - e2e-python-test (standalone & cluster): skipped
✅ - clean (standalone & cluster & standalone_auth): success

@wuyfee
Copy link

wuyfee commented Jan 5, 2026

$\color{red}{FAILURE}$
DETAILS
✅ - docker: success
❌ - deploy (standalone & cluster & standalone_auth): failure
❌ - e2e-java-test (standalone & cluster & standalone_auth): skipped
❌ - e2e-go-test (standalone & cluster): skipped
❌ - e2e-cpp-test (standalone & cluster): skipped
❌ - e2e-csharp-test (standalone & cluster): skipped
❌ - e2e-nodejs-test (standalone & cluster): skipped
❌ - e2e-python-test (standalone & cluster): skipped
✅ - clean (standalone & cluster & standalone_auth): success

@wuyfee
Copy link

wuyfee commented Jan 7, 2026

$\color{red}{FAILURE}$
DETAILS
✅ - docker: success
❌ - deploy (standalone & cluster & standalone_auth): failure
❌ - e2e-java-test (standalone & cluster & standalone_auth): skipped
❌ - e2e-go-test (standalone & cluster): skipped
❌ - e2e-cpp-test (standalone & cluster): skipped
❌ - e2e-csharp-test (standalone & cluster): skipped
❌ - e2e-nodejs-test (standalone & cluster): skipped
❌ - e2e-python-test (standalone & cluster): skipped
✅ - clean (standalone & cluster & standalone_auth): success

@wuyfee
Copy link

wuyfee commented Jan 8, 2026

$\color{red}{FAILURE}$
DETAILS
✅ - docker: success
❌ - deploy (standalone & cluster & standalone_auth): failure
❌ - e2e-java-test (standalone & cluster & standalone_auth): skipped
❌ - e2e-go-test (standalone & cluster): skipped
❌ - e2e-cpp-test (standalone & cluster): skipped
❌ - e2e-csharp-test (standalone & cluster): skipped
❌ - e2e-nodejs-test (standalone & cluster): skipped
❌ - e2e-python-test (standalone & cluster): skipped
✅ - clean (standalone & cluster & standalone_auth): success

@KomachiSion KomachiSion merged commit bb26607 into alibaba:develop Jan 9, 2026
3 checks passed
@KomachiSion KomachiSion added this to the 3.2.0 milestone Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Unified Plugin Management - Core Framework and Plugin Integration (Part 1/3)

3 participants