-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Description
I want to define a common configuration template for certain plugins (e.g., limit-count) that includes basic connection information (such as Redis host and port). When enabling the plugin on a route, I expect these basic properties to be automatically filled, while allowing the route to override specific properties (such as rate-limiting rules), rather than completely rewriting the entire plugin configuration.
I have tried using Plugin Config and Plugin Metadata, but their behavior does not meet expectations:
- Plugin Metadata: Requires internal plugin support and is not a general solution.
- Conflict between Plugin Config and Route Configuration: According to the official documentation, when the same plugin is configured across multiple objects (e.g., Route and Plugin Config), merging follows the priority order Consumer > Route > Plugin Config > Service. However, only the complete configuration of the highest-priority plugin instance is executed. This means the route configuration entirely replaces the Plugin Config configuration, rather than performing intelligent property-level merging and overriding.
Reproduction Steps and Current Result:
- Create a Plugin Config containing
limit-countconnection information. - Create a route that references
plugin_config_id: test-plugin_config_idand configures thelimit-countplugin in thepluginsfield, specifying only different rate-limiting properties.
Example Configuration:
{
"time_window": 60,
"redis_host": "local",
"count": 5
}Plugin Config Configuration:
{
"rejected_msg": "plugin configs !",
"time_window": 60,
"redis_host": "local",
"count": 2
}- Test the route and observe that the plugin uses the route configuration but loses the
"rejected_msg"information defined in the Plugin Config, resulting in a direct 503 error page (see screenshot: [image placeholder]).
Expected Behavior:
I expect plugin configurations to support an "inheritance" or "default value filling" model. For example, with Redis plugins, the expected merging logic would be:
- Higher level (e.g., Plugin Config): Defines default/basic properties (host, port, password).
- Lower level (e.g., Route): Defines extended or overridden properties (database, timeout).
Final effective configuration: Properties specified at the lower level override those of the same name at the higher level, while unique properties from the higher level are automatically included. Example:
{host, port, password} + {database, timeout} → {host, port, password, database, timeout}.
My Questions:
- In the current APISIX design, is there a way to achieve the "property-level merging" described above?
- If not currently available, does the official team plan to support such functionality in future versions (e.g., enhancing the merging strategy for Plugin Config)?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status