You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by Zexuan Luo <sp...@apache.org> on 2021/01/19 02:14:38 UTC

[DISCUSS] APISIX supports reusing plugin configuration

- This idea is to reuse some common plugin configuration between routes.

The solution contains several steps:
1. add namespace `/plugin_configs`
Item in this namespace should have fields below:
* id
* name
* plugins
* create_time
* update_time
(Note: the arguments in plugins should pass the schema check.)

2. bind the plugin_config in route via plugin_config_id
- 3. Like merging service, we merge the plugin_config into route when the
route is hit. Note: should change route's modifiedIndex when plugin_config
changed. When plugin_config and route has the same plugin, the one from
plugin_config will override the one in the route.

What about your opinions?

Re: [DISCUSS] APISIX supports reusing plugin configuration

Posted by Zhang Chao <zc...@gmail.com>.
Vote for plugin_conf_id.

Each plugin is singleton, while they can have multiple incarnations which
has different configuration, what we reference is the incarnations.
Chao Zhang
https://github.com/tokers

On January 20, 2021 at 9:10:57 AM, Zexuan Luo (spacewander@apache.org)
wrote:

I think there is a name convention in it.
service_id is the id for service, so the id for plugin_conf is
plugin_conf_id, as `/plugins` namespace is already used for other purpose.

YuanSheng Wang <me...@apache.org> 于2021年1月19日周二 下午2:40写道:

> nice proposal for me.
>
> only one small point, how about the shorter one? `plugin_config_id` -> `
> plugin_id`
>
> ^_^
>
>
>
>
> On Tue, Jan 19, 2021 at 10:14 AM Zexuan Luo <sp...@apache.org>
> wrote:
>
> > - This idea is to reuse some common plugin configuration between
routes.
> >
> > The solution contains several steps:
> > 1. add namespace `/plugin_configs`
> > Item in this namespace should have fields below:
> > * id
> > * name
> > * plugins
> > * create_time
> > * update_time
> > (Note: the arguments in plugins should pass the schema check.)
> >
> > 2. bind the plugin_config in route via plugin_config_id
> > - 3. Like merging service, we merge the plugin_config into route when
the
> > route is hit. Note: should change route's modifiedIndex when
> plugin_config
> > changed. When plugin_config and route has the same plugin, the one from
> > plugin_config will override the one in the route.
> >
> > What about your opinions?
> >
>
>
> --
>
> *MembPhis*
> My GitHub: https://github.com/membphis
> Apache APISIX: https://github.com/apache/apisix
>

Re: [DISCUSS] APISIX supports reusing plugin configuration

Posted by Zexuan Luo <sp...@apache.org>.
I think there is a name convention in it.
service_id is the id for service, so the id for plugin_conf is
plugin_conf_id, as `/plugins` namespace is already used for other purpose.

YuanSheng Wang <me...@apache.org> 于2021年1月19日周二 下午2:40写道:

> nice proposal for me.
>
> only one small point, how about the shorter one? `plugin_config_id` -> `
> plugin_id`
>
> ^_^
>
>
>
>
> On Tue, Jan 19, 2021 at 10:14 AM Zexuan Luo <sp...@apache.org>
> wrote:
>
> > - This idea is to reuse some common plugin configuration between routes.
> >
> > The solution contains several steps:
> > 1. add namespace `/plugin_configs`
> > Item in this namespace should have fields below:
> > * id
> > * name
> > * plugins
> > * create_time
> > * update_time
> > (Note: the arguments in plugins should pass the schema check.)
> >
> > 2. bind the plugin_config in route via plugin_config_id
> > - 3. Like merging service, we merge the plugin_config into route when the
> > route is hit. Note: should change route's modifiedIndex when
> plugin_config
> > changed. When plugin_config and route has the same plugin, the one from
> > plugin_config will override the one in the route.
> >
> > What about your opinions?
> >
>
>
> --
>
> *MembPhis*
> My GitHub: https://github.com/membphis
> Apache APISIX: https://github.com/apache/apisix
>

Re: [DISCUSS] APISIX supports reusing plugin configuration

Posted by YuanSheng Wang <me...@apache.org>.
nice proposal for me.

only one small point, how about the shorter one? `plugin_config_id` -> `
plugin_id`

^_^




On Tue, Jan 19, 2021 at 10:14 AM Zexuan Luo <sp...@apache.org> wrote:

> - This idea is to reuse some common plugin configuration between routes.
>
> The solution contains several steps:
> 1. add namespace `/plugin_configs`
> Item in this namespace should have fields below:
> * id
> * name
> * plugins
> * create_time
> * update_time
> (Note: the arguments in plugins should pass the schema check.)
>
> 2. bind the plugin_config in route via plugin_config_id
> - 3. Like merging service, we merge the plugin_config into route when the
> route is hit. Note: should change route's modifiedIndex when plugin_config
> changed. When plugin_config and route has the same plugin, the one from
> plugin_config will override the one in the route.
>
> What about your opinions?
>


-- 

*MembPhis*
My GitHub: https://github.com/membphis
Apache APISIX: https://github.com/apache/apisix

Re: [DISCUSS] APISIX supports reusing plugin configuration

Posted by YuanSheng Wang <me...@apache.org>.
> Another question, is it enough to just implement PUT/PATCH/GET/DELETE,
just
> like /global_rules?

this is enough.


On Wed, Jan 20, 2021 at 3:58 PM Zexuan Luo <sp...@apache.org> wrote:

> Another question, is it enough to just implement PUT/PATCH/GET/DELETE, just
> like /global_rules?
>
> Zexuan Luo <sp...@apache.org> 于2021年1月19日周二 上午10:14写道:
>
> >
> >    - This idea is to reuse some common plugin configuration between
> >    routes.
> >
> >
> > The solution contains several steps:
> > 1. add namespace `/plugin_configs`
> > Item in this namespace should have fields below:
> > * id
> > * name
> > * plugins
> > * create_time
> > * update_time
> > (Note: the arguments in plugins should pass the schema check.)
> >
> > 2. bind the plugin_config in route via plugin_config_id
> >
> >    - 3. Like merging service, we merge the plugin_config into route when
> >    the route is hit. Note: should change route's modifiedIndex when
> >    plugin_config changed. When plugin_config and route has the same
> plugin,
> >    the one from plugin_config will override the one in the route.
> >
> >
> > What about your opinions?
> >
> >
>


-- 

*MembPhis*
My GitHub: https://github.com/membphis
Apache APISIX: https://github.com/apache/apisix

Re: [DISCUSS] APISIX supports reusing plugin configuration

Posted by Zexuan Luo <sp...@apache.org>.
Another question, is it enough to just implement PUT/PATCH/GET/DELETE, just
like /global_rules?

Zexuan Luo <sp...@apache.org> 于2021年1月19日周二 上午10:14写道:

>
>    - This idea is to reuse some common plugin configuration between
>    routes.
>
>
> The solution contains several steps:
> 1. add namespace `/plugin_configs`
> Item in this namespace should have fields below:
> * id
> * name
> * plugins
> * create_time
> * update_time
> (Note: the arguments in plugins should pass the schema check.)
>
> 2. bind the plugin_config in route via plugin_config_id
>
>    - 3. Like merging service, we merge the plugin_config into route when
>    the route is hit. Note: should change route's modifiedIndex when
>    plugin_config changed. When plugin_config and route has the same plugin,
>    the one from plugin_config will override the one in the route.
>
>
> What about your opinions?
>
>