From 357dace3ce849ecb949acde512b33dc994e55d9c Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Wed, 18 Dec 2024 10:47:00 +0100 Subject: [PATCH] made some updates based on Diana's feedback --- app/_gateway_entities/consumer-group.md | 3 +-- app/_gateway_entities/plugin.md | 31 ------------------------- app/plugins/scopes.md | 30 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/app/_gateway_entities/consumer-group.md b/app/_gateway_entities/consumer-group.md index d0144024..1a1d2220 100644 --- a/app/_gateway_entities/consumer-group.md +++ b/app/_gateway_entities/consumer-group.md @@ -37,8 +37,7 @@ faqs: - q: When a Consumer is part of multiple Consumer Groups, how is precedence determined? a: | - When a Consumer is a member of two Consumer Groups, each with a scoped plugin, {{site.base_gateway}} ensures deterministic behavior by executing only one of these plugins. Currently, this is determined by the Group name, in alphabetical order. - However, the specific rules that govern this behavior are not defined and are subject to change in future releases. + Currently, this is determined by the Group name, in alphabetical order. For more details, see [Plugin precedence](/plugins/scopes/#plugin-precedence). --- ## What is a Consumer Group? diff --git a/app/_gateway_entities/plugin.md b/app/_gateway_entities/plugin.md index 2ab2623d..be66cfe6 100644 --- a/app/_gateway_entities/plugin.md +++ b/app/_gateway_entities/plugin.md @@ -43,37 +43,6 @@ The set of plugins you have access to depends on your license tier. You can also develop custom plugins, adding your own custom functionality to {{site.base_gateway}}. -## Plugin precedence - -A single plugin instance always runs _once_ per request. The -configuration with which it runs depends on the entities it has been -configured for. -Plugins can be configured for various entities, combinations of entities, or even globally. -This is useful, for example, when you want to configure a plugin a certain way for most requests but make _authenticated requests_ behave slightly differently. - -Therefore, there is an order of precedence for running a plugin when it has been applied to different entities with different configurations. The number of entities configured to a specific plugin directly correlates to its priority. The more entities a plugin is configured for, the higher its order of precedence. - -The complete order of precedence for plugins configured to multiple entities is: - -1. **Consumer** + **Route** + **Service**: Highest precedence, affecting authenticated requests that match a specific Consumer on a particular Route and Service. -2. **Consumer group** + **Service** + **Route**: Affects groups of authenticated users across specific Services and Routes. -3. **Consumer** + **Route**: Targets authenticated requests from a specific Consumer on a particular Route. -4. **Consumer** + **Service**: Applies to authenticated requests from a specific Consumer accessing any Route within a given Service. -5. **Consumer group** + **Route**: Affects groups of authenticated users on specific Routes. -6. **Consumer group** + **Service**: Applies to all Routes within a specific Service for groups of authenticated users. -7. **Route** + **Service**: Targets all Consumers on a specific Route and Service. -8. **Consumer**: Applies to all requests from a specific, authenticated Consumer across all Routes and Services. -9. **Consumer Group**: Affects all Routes and Services for a designated group of authenticated users. -10. **Route**: Specific to given Route. -11. **Service**: Specific to given Service. -12. **Globally configured plugins**: Lowest precedence, applies to all requests across all Services and Routes regardless of Consumer status. - -{:.info} -> **Note on precedence for Consumer Groups**: -When a Consumer is a member of two Consumer Groups, each with a scoped plugin, -{{site.base_gateway}} ensures deterministic behavior by executing only one of these plugins. -However, the specific rules that govern this behavior are not defined and are subject to change in future releases. - ## Custom plugins Kong provides an entire development environment for developing plugins, including Plugin Development Kits (or PDKs), database abstractions, migrations, and more. diff --git a/app/plugins/scopes.md b/app/plugins/scopes.md index 6dcb006c..63a5b8be 100644 --- a/app/plugins/scopes.md +++ b/app/plugins/scopes.md @@ -47,3 +47,33 @@ Every plugin supports a subset of these scopes. See the following table for plugins and their compatible scopes: [Placeholder for table that gets generated from plugin schemas, which will show all the plugin scope compatibilities (equivalent of [scopes](https://docs.konghq.com/hub/plugins/compatibility/#scopes).)] + +## Plugin precedence + +A single plugin instance always runs _once_ per request. The +configuration with which it runs depends on the entities it has been +configured for. +Plugins can be configured for various entities, combinations of entities, or even globally. +This is useful, for example, when you want to configure a plugin a certain way for most requests but make _authenticated requests_ behave slightly differently. + +Therefore, there is an order of precedence for running a plugin when it has been applied to different entities with different configurations. The number of entities configured to a specific plugin directly correlates to its priority. The more entities a plugin is configured for, the higher its order of precedence. + +The complete order of precedence for plugins configured to multiple entities is: + +1. **Consumer** + **Route** + **Service**: Highest precedence, affecting authenticated requests that match a specific Consumer on a particular Route and Service. +2. **Consumer group** + **Service** + **Route**: Affects groups of authenticated users across specific Services and Routes. +3. **Consumer** + **Route**: Targets authenticated requests from a specific Consumer on a particular Route. +4. **Consumer** + **Service**: Applies to authenticated requests from a specific Consumer accessing any Route within a given Service. +5. **Consumer group** + **Route**: Affects groups of authenticated users on specific Routes. +6. **Consumer group** + **Service**: Applies to all Routes within a specific Service for groups of authenticated users. +7. **Route** + **Service**: Targets all Consumers on a specific Route and Service. +8. **Consumer**: Applies to all requests from a specific, authenticated Consumer across all Routes and Services. +9. **Consumer Group**: Affects all Routes and Services for a designated group of authenticated users. +10. **Route**: Specific to given Route. +11. **Service**: Specific to given Service. +12. **Globally configured plugins**: Lowest precedence, applies to all requests across all Services and Routes regardless of Consumer status. + +{:.info} +> **Note on precedence for Consumer Groups**: +When a Consumer is a member of two Consumer Groups, each with a scoped plugin, {{site.base_gateway}} ensures deterministic behavior by executing only one of these plugins. Currently, this is determined by the Group name, in alphabetical order. +However, the specific rules that govern this behavior are not defined and are subject to change in future releases. \ No newline at end of file