[Feature][Admin] Provisioning hook for out-of-tree plugins on client registration
Background
Shenyu supports loading custom plugins through the gateway ext-plugin mechanism (shenyu.extPlugin.*) and registering them in the admin plugin management. However, the admin-side provisioning such plugins need is only generated for built-in plugins:
pluginrows are seeded fromPluginEnum;namespace_plugin_relrows make the plugin visible in the admin UI;- button permissions (
plugin:<name>Selector:add|edit|delete|query,plugin:<name>Rule:*,plugin:<name>:modify) drive the admin UI action buttons; ShenyuClientRegisterServiceimplementations create selector/rule for built-in plugins when a business service registers, and are dispatched by rpcType only (shenyuClientRegisterService.get(meta.getRpcType())), where"http"is exclusively owned byShenyuClientRegisterDivideServiceImpl.
As a result, every deployment of an out-of-tree plugin (e.g. a custom auth plugin loaded as an ext-plugin jar) currently requires manual SQL across six tables (plugin, namespace_plugin_rel, resource, permission, selector_condition/rule_condition, selector, rule), otherwise the plugin is invisible in the UI, renders no action buttons, and never executes in the gateway chain.
Expected behavior
An optional hook so out-of-tree plugins can participate in client-registration provisioning without patching shenyu source code, keeping built-in plugin behavior untouched.
Proposal
Add a small SPI invoked after the matching ShenyuClientRegisterService finishes processing a registration:
public interface ClientRegisterProvisioner {
String pluginName();
default boolean supports(final MetaDataRegisterDTO metaDataRegisterDTO) {
return true;
}
void provision(final MetaDataRegisterDTO metaDataRegisterDTO);
}
- Implementations are Spring beans and may ship inside the plugin jar placed on the admin classpath (same distribution story as gateway ext-plugin jars);
MetadataExecutorSubscriberinvokes matching provisioners afterShenyuClientRegisterService#register(MetaDataRegisterDTO)completes;- Failures are logged and isolated, so built-in registration is never affected;
- With no implementations registered, behavior is unchanged.
A minimal implementation sketch is ready and tested locally (SPI + wiring in RegisterCenterConfiguration / RegisterClientServerDisruptorPublisher / MetadataExecutorSubscriber + unit tests). I'm willing to submit a PR.
Related gaps observed while integrating a custom auth plugin
pluginrow must be inserted manually (no UI/API provisioning for out-of-tree plugins);namespace_plugin_relmust be inserted manually, otherwise the plugin is invisible in the admin plugin list;- Button permissions must be inserted manually, otherwise no "add" buttons render on the plugin page;
- Selector/rule must be created manually (only divide auto-creates them from client registration).
Related work
- #8199 / #7294 - plugin store / out-of-tree plugin infrastructure: this hook is the admin-side piece that out-of-tree plugins will need;
- #8301 - selector configuration export (adjacent provisioning topic).