You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by JunXu Chen <ch...@apache.org> on 2020/09/26 15:50:30 UTC
[DISCUSS] Implement route debug and release feature
Hi, community,
@liuxiran previously submitted a nice PR that implements route publish and
offline feature [1].
We hope that instead of releasing a route immediately, we can test it
first, and release it after the test result is OK.
So we think it is more suitable to implement this feature directly in
`Apache APISIX` instead of dashboard.
Here is the implementation steps in my mind:
1. Add an `enable` field, or another more suitable field to the route
configuration, and the default value of the field is false when adding a
route. Which means the route is not released.
2. Add a matching item `enable` similar to `host` or `method` in the
`lua-resty-radixtree` library.
When matching a route for client request, If the value of `enable` is
false, skip the route directly.
But when there is `X-APISIX-ROUTE-DEBUG` in the http header and the value
is true, routes which `enable` are false can be matched according to other
conditions.
3. Now, normal client requests will skip routes not released, and requests
for testing by specifying the http header `X-APISIX-ROUTE-DEBUG` can match
routes not released, thus realizing our needs.
Example:
1. Create a route (it's not released by default)
```shell
$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1'-X PUT -i -d'
{
"Uri": "/route-debug-test",
"Upstream": {
"Type": "roundrobin",
"node":{
"127.0.0.1:80": 1
}
}
}'
```
2. Normal request (404 not found)
```
curl 127.0.0.1:9080/route-debug-test
```
3. Debugging (200)
```
curl 127.0.0.1:9080/route-debug-test -H "X-APISIX-ROUTE-DEBUG: true"
```
4. Release the route
```
$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
{
"Status": 0
}'
```
5. Normal access (200)
```
curl 127.0.0.1:9080/route-debug-test
```
[1] https://github.com/apache/apisix-dashboard/pull/451
Re: [DISCUSS] Implement route debug and release feature
Posted by JunXu Chen <ch...@apache.org>.
@Ming
This logic is quite simple, so I think it is ok to control the risk.
And if it is in the production system, it will not be able to test on the
true product env.
On Sun, Sep 27, 2020 at 11:02 AM JunXu Chen <ch...@apache.org> wrote:
> @Zhiyuan
> 1. disabled could be used as an option
> 2. I originally used two fields `status` and `enable` for choosing, but to
> avoid confusion, I deleted `status`, but I forgot to change it in the
> example
>
> Thanks!
>
> On Sun, Sep 27, 2020 at 9:31 AM Ming Wen <we...@apache.org> wrote:
>
>> I have a concern. The debug/disabled state routera are also in the
>> production system. If there is a bug, it will be very serious.
>>
>> Thanks,
>> Ming Wen, Apache APISIX & Apache SkyWalking
>> Twitter: _WenMing
>>
>>
>> JunXu Chen <ch...@apache.org> 于2020年9月26日周六 下午11:50写道:
>>
>> > Hi, community,
>> >
>> > @liuxiran previously submitted a nice PR that implements route publish
>> and
>> > offline feature [1].
>> >
>> > We hope that instead of releasing a route immediately, we can test it
>> > first, and release it after the test result is OK.
>> >
>> > So we think it is more suitable to implement this feature directly in
>> > `Apache APISIX` instead of dashboard.
>> >
>> > Here is the implementation steps in my mind:
>> >
>> > 1. Add an `enable` field, or another more suitable field to the route
>> > configuration, and the default value of the field is false when adding a
>> > route. Which means the route is not released.
>> >
>> > 2. Add a matching item `enable` similar to `host` or `method` in the
>> > `lua-resty-radixtree` library.
>> > When matching a route for client request, If the value of `enable` is
>> > false, skip the route directly.
>> > But when there is `X-APISIX-ROUTE-DEBUG` in the http header and the
>> value
>> > is true, routes which `enable` are false can be matched according to
>> other
>> > conditions.
>> >
>> > 3. Now, normal client requests will skip routes not released, and
>> requests
>> > for testing by specifying the http header `X-APISIX-ROUTE-DEBUG` can
>> match
>> > routes not released, thus realizing our needs.
>> >
>> > Example:
>> >
>> > 1. Create a route (it's not released by default)
>> >
>> > ```shell
>> > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
>> > edd1c9f034335f136f87ad84b625c8f1'-X PUT -i -d'
>> > {
>> > "Uri": "/route-debug-test",
>> > "Upstream": {
>> > "Type": "roundrobin",
>> > "node":{
>> > "127.0.0.1:80": 1
>> > }
>> > }
>> > }'
>> > ```
>> > 2. Normal request (404 not found)
>> > ```
>> > curl 127.0.0.1:9080/route-debug-test
>> > ```
>> >
>> > 3. Debugging (200)
>> > ```
>> > curl 127.0.0.1:9080/route-debug-test -H "X-APISIX-ROUTE-DEBUG: true"
>> > ```
>> >
>> > 4. Release the route
>> > ```
>> > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
>> > edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
>> > {
>> > "Status": 0
>> > }'
>> > ```
>> >
>> > 5. Normal access (200)
>> > ```
>> > curl 127.0.0.1:9080/route-debug-test
>> > ```
>> >
>> >
>> > [1] https://github.com/apache/apisix-dashboard/pull/451
>> >
>>
>
Re: Re: [DISCUSS] Implement route debug and release feature
Posted by dabue <88...@qq.com>.
Hi,
1. agree with using 'disabled, enabled' to instead of 'disable, enable'
2. suggest the default value is true, this will keep the status of routes existed, and we can import a new option to set disabled when publish a new route.
88786912@qq.com
From: YuanSheng Wang
Date: 2020-09-27 15:00
To: dev@apisix.apache.org
Subject: Re: [DISCUSS] Implement route debug and release feature
Using Boolean values, although simple and clear, but can only express two
states.
Perhaps it is more flexible to use strings here.
On Sun, Sep 27, 2020 at 12:00 PM JunXu Chen <ch...@apache.org> wrote:
> @Yuansheng
>
> The 4sd step should be :
>
> 4. Release the route
> ```
> $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
> {
> "enable": true
> }'
> ```
>
> Thanks!
>
> On Sun, Sep 27, 2020 at 11:41 AM YuanSheng Wang <me...@apache.org>
> wrote:
>
> > > but I forgot to change it in the example
> >
> > Please provide the correct example, I am also confused by the current
> > example.
> >
> > ^_^
> >
> >
> > On Sun, Sep 27, 2020 at 11:02 AM JunXu Chen <ch...@apache.org>
> wrote:
> >
> > > @Zhiyuan
> > > 1. disabled could be used as an option
> > > 2. I originally used two fields `status` and `enable` for choosing, but
> > to
> > > avoid confusion, I deleted `status`, but I forgot to change it in the
> > > example
> > >
> > > Thanks!
> > >
> > > On Sun, Sep 27, 2020 at 9:31 AM Ming Wen <we...@apache.org> wrote:
> > >
> > > > I have a concern. The debug/disabled state routera are also in the
> > > > production system. If there is a bug, it will be very serious.
> > > >
> > > > Thanks,
> > > > Ming Wen, Apache APISIX & Apache SkyWalking
> > > > Twitter: _WenMing
> > > >
> > > >
> > > > JunXu Chen <ch...@apache.org> 于2020年9月26日周六 下午11:50写道:
> > > >
> > > > > Hi, community,
> > > > >
> > > > > @liuxiran previously submitted a nice PR that implements route
> > publish
> > > > and
> > > > > offline feature [1].
> > > > >
> > > > > We hope that instead of releasing a route immediately, we can test
> it
> > > > > first, and release it after the test result is OK.
> > > > >
> > > > > So we think it is more suitable to implement this feature directly
> in
> > > > > `Apache APISIX` instead of dashboard.
> > > > >
> > > > > Here is the implementation steps in my mind:
> > > > >
> > > > > 1. Add an `enable` field, or another more suitable field to the
> route
> > > > > configuration, and the default value of the field is false when
> > adding
> > > a
> > > > > route. Which means the route is not released.
> > > > >
> > > > > 2. Add a matching item `enable` similar to `host` or `method` in
> the
> > > > > `lua-resty-radixtree` library.
> > > > > When matching a route for client request, If the value of `enable`
> is
> > > > > false, skip the route directly.
> > > > > But when there is `X-APISIX-ROUTE-DEBUG` in the http header and the
> > > value
> > > > > is true, routes which `enable` are false can be matched according
> to
> > > > other
> > > > > conditions.
> > > > >
> > > > > 3. Now, normal client requests will skip routes not released, and
> > > > requests
> > > > > for testing by specifying the http header `X-APISIX-ROUTE-DEBUG`
> can
> > > > match
> > > > > routes not released, thus realizing our needs.
> > > > >
> > > > > Example:
> > > > >
> > > > > 1. Create a route (it's not released by default)
> > > > >
> > > > > ```shell
> > > > > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> > > > > edd1c9f034335f136f87ad84b625c8f1'-X PUT -i -d'
> > > > > {
> > > > > "Uri": "/route-debug-test",
> > > > > "Upstream": {
> > > > > "Type": "roundrobin",
> > > > > "node":{
> > > > > "127.0.0.1:80": 1
> > > > > }
> > > > > }
> > > > > }'
> > > > > ```
> > > > > 2. Normal request (404 not found)
> > > > > ```
> > > > > curl 127.0.0.1:9080/route-debug-test
> > > > > ```
> > > > >
> > > > > 3. Debugging (200)
> > > > > ```
> > > > > curl 127.0.0.1:9080/route-debug-test -H "X-APISIX-ROUTE-DEBUG:
> true"
> > > > > ```
> > > > >
> > > > > 4. Release the route
> > > > > ```
> > > > > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> > > > > edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
> > > > > {
> > > > > "Status": 0
> > > > > }'
> > > > > ```
> > > > >
> > > > > 5. Normal access (200)
> > > > > ```
> > > > > curl 127.0.0.1:9080/route-debug-test
> > > > > ```
> > > > >
> > > > >
> > > > > [1] https://github.com/apache/apisix-dashboard/pull/451
> > > > >
> > > >
> > >
> >
> >
> > --
> >
> > *MembPhis*
> > My GitHub: https://github.com/membphis
> > Apache APISIX: https://github.com/apache/incubator-apisix
> >
>
--
*MembPhis*
My GitHub: https://github.com/membphis
Apache APISIX: https://github.com/apache/incubator-apisix
Re: [DISCUSS] Implement route debug and release feature
Posted by YuanSheng Wang <me...@apache.org>.
Using Boolean values, although simple and clear, but can only express two
states.
Perhaps it is more flexible to use strings here.
On Sun, Sep 27, 2020 at 12:00 PM JunXu Chen <ch...@apache.org> wrote:
> @Yuansheng
>
> The 4sd step should be :
>
> 4. Release the route
> ```
> $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
> {
> "enable": true
> }'
> ```
>
> Thanks!
>
> On Sun, Sep 27, 2020 at 11:41 AM YuanSheng Wang <me...@apache.org>
> wrote:
>
> > > but I forgot to change it in the example
> >
> > Please provide the correct example, I am also confused by the current
> > example.
> >
> > ^_^
> >
> >
> > On Sun, Sep 27, 2020 at 11:02 AM JunXu Chen <ch...@apache.org>
> wrote:
> >
> > > @Zhiyuan
> > > 1. disabled could be used as an option
> > > 2. I originally used two fields `status` and `enable` for choosing, but
> > to
> > > avoid confusion, I deleted `status`, but I forgot to change it in the
> > > example
> > >
> > > Thanks!
> > >
> > > On Sun, Sep 27, 2020 at 9:31 AM Ming Wen <we...@apache.org> wrote:
> > >
> > > > I have a concern. The debug/disabled state routera are also in the
> > > > production system. If there is a bug, it will be very serious.
> > > >
> > > > Thanks,
> > > > Ming Wen, Apache APISIX & Apache SkyWalking
> > > > Twitter: _WenMing
> > > >
> > > >
> > > > JunXu Chen <ch...@apache.org> 于2020年9月26日周六 下午11:50写道:
> > > >
> > > > > Hi, community,
> > > > >
> > > > > @liuxiran previously submitted a nice PR that implements route
> > publish
> > > > and
> > > > > offline feature [1].
> > > > >
> > > > > We hope that instead of releasing a route immediately, we can test
> it
> > > > > first, and release it after the test result is OK.
> > > > >
> > > > > So we think it is more suitable to implement this feature directly
> in
> > > > > `Apache APISIX` instead of dashboard.
> > > > >
> > > > > Here is the implementation steps in my mind:
> > > > >
> > > > > 1. Add an `enable` field, or another more suitable field to the
> route
> > > > > configuration, and the default value of the field is false when
> > adding
> > > a
> > > > > route. Which means the route is not released.
> > > > >
> > > > > 2. Add a matching item `enable` similar to `host` or `method` in
> the
> > > > > `lua-resty-radixtree` library.
> > > > > When matching a route for client request, If the value of `enable`
> is
> > > > > false, skip the route directly.
> > > > > But when there is `X-APISIX-ROUTE-DEBUG` in the http header and the
> > > value
> > > > > is true, routes which `enable` are false can be matched according
> to
> > > > other
> > > > > conditions.
> > > > >
> > > > > 3. Now, normal client requests will skip routes not released, and
> > > > requests
> > > > > for testing by specifying the http header `X-APISIX-ROUTE-DEBUG`
> can
> > > > match
> > > > > routes not released, thus realizing our needs.
> > > > >
> > > > > Example:
> > > > >
> > > > > 1. Create a route (it's not released by default)
> > > > >
> > > > > ```shell
> > > > > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> > > > > edd1c9f034335f136f87ad84b625c8f1'-X PUT -i -d'
> > > > > {
> > > > > "Uri": "/route-debug-test",
> > > > > "Upstream": {
> > > > > "Type": "roundrobin",
> > > > > "node":{
> > > > > "127.0.0.1:80": 1
> > > > > }
> > > > > }
> > > > > }'
> > > > > ```
> > > > > 2. Normal request (404 not found)
> > > > > ```
> > > > > curl 127.0.0.1:9080/route-debug-test
> > > > > ```
> > > > >
> > > > > 3. Debugging (200)
> > > > > ```
> > > > > curl 127.0.0.1:9080/route-debug-test -H "X-APISIX-ROUTE-DEBUG:
> true"
> > > > > ```
> > > > >
> > > > > 4. Release the route
> > > > > ```
> > > > > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> > > > > edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
> > > > > {
> > > > > "Status": 0
> > > > > }'
> > > > > ```
> > > > >
> > > > > 5. Normal access (200)
> > > > > ```
> > > > > curl 127.0.0.1:9080/route-debug-test
> > > > > ```
> > > > >
> > > > >
> > > > > [1] https://github.com/apache/apisix-dashboard/pull/451
> > > > >
> > > >
> > >
> >
> >
> > --
> >
> > *MembPhis*
> > My GitHub: https://github.com/membphis
> > Apache APISIX: https://github.com/apache/incubator-apisix
> >
>
--
*MembPhis*
My GitHub: https://github.com/membphis
Apache APISIX: https://github.com/apache/incubator-apisix
Re: [DISCUSS] Implement route debug and release feature
Posted by JunXu Chen <ch...@apache.org>.
@Yuansheng
The 4sd step should be :
4. Release the route
```
$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
{
"enable": true
}'
```
Thanks!
On Sun, Sep 27, 2020 at 11:41 AM YuanSheng Wang <me...@apache.org> wrote:
> > but I forgot to change it in the example
>
> Please provide the correct example, I am also confused by the current
> example.
>
> ^_^
>
>
> On Sun, Sep 27, 2020 at 11:02 AM JunXu Chen <ch...@apache.org> wrote:
>
> > @Zhiyuan
> > 1. disabled could be used as an option
> > 2. I originally used two fields `status` and `enable` for choosing, but
> to
> > avoid confusion, I deleted `status`, but I forgot to change it in the
> > example
> >
> > Thanks!
> >
> > On Sun, Sep 27, 2020 at 9:31 AM Ming Wen <we...@apache.org> wrote:
> >
> > > I have a concern. The debug/disabled state routera are also in the
> > > production system. If there is a bug, it will be very serious.
> > >
> > > Thanks,
> > > Ming Wen, Apache APISIX & Apache SkyWalking
> > > Twitter: _WenMing
> > >
> > >
> > > JunXu Chen <ch...@apache.org> 于2020年9月26日周六 下午11:50写道:
> > >
> > > > Hi, community,
> > > >
> > > > @liuxiran previously submitted a nice PR that implements route
> publish
> > > and
> > > > offline feature [1].
> > > >
> > > > We hope that instead of releasing a route immediately, we can test it
> > > > first, and release it after the test result is OK.
> > > >
> > > > So we think it is more suitable to implement this feature directly in
> > > > `Apache APISIX` instead of dashboard.
> > > >
> > > > Here is the implementation steps in my mind:
> > > >
> > > > 1. Add an `enable` field, or another more suitable field to the route
> > > > configuration, and the default value of the field is false when
> adding
> > a
> > > > route. Which means the route is not released.
> > > >
> > > > 2. Add a matching item `enable` similar to `host` or `method` in the
> > > > `lua-resty-radixtree` library.
> > > > When matching a route for client request, If the value of `enable` is
> > > > false, skip the route directly.
> > > > But when there is `X-APISIX-ROUTE-DEBUG` in the http header and the
> > value
> > > > is true, routes which `enable` are false can be matched according to
> > > other
> > > > conditions.
> > > >
> > > > 3. Now, normal client requests will skip routes not released, and
> > > requests
> > > > for testing by specifying the http header `X-APISIX-ROUTE-DEBUG` can
> > > match
> > > > routes not released, thus realizing our needs.
> > > >
> > > > Example:
> > > >
> > > > 1. Create a route (it's not released by default)
> > > >
> > > > ```shell
> > > > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> > > > edd1c9f034335f136f87ad84b625c8f1'-X PUT -i -d'
> > > > {
> > > > "Uri": "/route-debug-test",
> > > > "Upstream": {
> > > > "Type": "roundrobin",
> > > > "node":{
> > > > "127.0.0.1:80": 1
> > > > }
> > > > }
> > > > }'
> > > > ```
> > > > 2. Normal request (404 not found)
> > > > ```
> > > > curl 127.0.0.1:9080/route-debug-test
> > > > ```
> > > >
> > > > 3. Debugging (200)
> > > > ```
> > > > curl 127.0.0.1:9080/route-debug-test -H "X-APISIX-ROUTE-DEBUG: true"
> > > > ```
> > > >
> > > > 4. Release the route
> > > > ```
> > > > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> > > > edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
> > > > {
> > > > "Status": 0
> > > > }'
> > > > ```
> > > >
> > > > 5. Normal access (200)
> > > > ```
> > > > curl 127.0.0.1:9080/route-debug-test
> > > > ```
> > > >
> > > >
> > > > [1] https://github.com/apache/apisix-dashboard/pull/451
> > > >
> > >
> >
>
>
> --
>
> *MembPhis*
> My GitHub: https://github.com/membphis
> Apache APISIX: https://github.com/apache/incubator-apisix
>
Re: [DISCUSS] Implement route debug and release feature
Posted by YuanSheng Wang <me...@apache.org>.
> but I forgot to change it in the example
Please provide the correct example, I am also confused by the current
example.
^_^
On Sun, Sep 27, 2020 at 11:02 AM JunXu Chen <ch...@apache.org> wrote:
> @Zhiyuan
> 1. disabled could be used as an option
> 2. I originally used two fields `status` and `enable` for choosing, but to
> avoid confusion, I deleted `status`, but I forgot to change it in the
> example
>
> Thanks!
>
> On Sun, Sep 27, 2020 at 9:31 AM Ming Wen <we...@apache.org> wrote:
>
> > I have a concern. The debug/disabled state routera are also in the
> > production system. If there is a bug, it will be very serious.
> >
> > Thanks,
> > Ming Wen, Apache APISIX & Apache SkyWalking
> > Twitter: _WenMing
> >
> >
> > JunXu Chen <ch...@apache.org> 于2020年9月26日周六 下午11:50写道:
> >
> > > Hi, community,
> > >
> > > @liuxiran previously submitted a nice PR that implements route publish
> > and
> > > offline feature [1].
> > >
> > > We hope that instead of releasing a route immediately, we can test it
> > > first, and release it after the test result is OK.
> > >
> > > So we think it is more suitable to implement this feature directly in
> > > `Apache APISIX` instead of dashboard.
> > >
> > > Here is the implementation steps in my mind:
> > >
> > > 1. Add an `enable` field, or another more suitable field to the route
> > > configuration, and the default value of the field is false when adding
> a
> > > route. Which means the route is not released.
> > >
> > > 2. Add a matching item `enable` similar to `host` or `method` in the
> > > `lua-resty-radixtree` library.
> > > When matching a route for client request, If the value of `enable` is
> > > false, skip the route directly.
> > > But when there is `X-APISIX-ROUTE-DEBUG` in the http header and the
> value
> > > is true, routes which `enable` are false can be matched according to
> > other
> > > conditions.
> > >
> > > 3. Now, normal client requests will skip routes not released, and
> > requests
> > > for testing by specifying the http header `X-APISIX-ROUTE-DEBUG` can
> > match
> > > routes not released, thus realizing our needs.
> > >
> > > Example:
> > >
> > > 1. Create a route (it's not released by default)
> > >
> > > ```shell
> > > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> > > edd1c9f034335f136f87ad84b625c8f1'-X PUT -i -d'
> > > {
> > > "Uri": "/route-debug-test",
> > > "Upstream": {
> > > "Type": "roundrobin",
> > > "node":{
> > > "127.0.0.1:80": 1
> > > }
> > > }
> > > }'
> > > ```
> > > 2. Normal request (404 not found)
> > > ```
> > > curl 127.0.0.1:9080/route-debug-test
> > > ```
> > >
> > > 3. Debugging (200)
> > > ```
> > > curl 127.0.0.1:9080/route-debug-test -H "X-APISIX-ROUTE-DEBUG: true"
> > > ```
> > >
> > > 4. Release the route
> > > ```
> > > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> > > edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
> > > {
> > > "Status": 0
> > > }'
> > > ```
> > >
> > > 5. Normal access (200)
> > > ```
> > > curl 127.0.0.1:9080/route-debug-test
> > > ```
> > >
> > >
> > > [1] https://github.com/apache/apisix-dashboard/pull/451
> > >
> >
>
--
*MembPhis*
My GitHub: https://github.com/membphis
Apache APISIX: https://github.com/apache/incubator-apisix
Re: [DISCUSS] Implement route debug and release feature
Posted by JunXu Chen <ch...@apache.org>.
@Zhiyuan
1. disabled could be used as an option
2. I originally used two fields `status` and `enable` for choosing, but to
avoid confusion, I deleted `status`, but I forgot to change it in the
example
Thanks!
On Sun, Sep 27, 2020 at 9:31 AM Ming Wen <we...@apache.org> wrote:
> I have a concern. The debug/disabled state routera are also in the
> production system. If there is a bug, it will be very serious.
>
> Thanks,
> Ming Wen, Apache APISIX & Apache SkyWalking
> Twitter: _WenMing
>
>
> JunXu Chen <ch...@apache.org> 于2020年9月26日周六 下午11:50写道:
>
> > Hi, community,
> >
> > @liuxiran previously submitted a nice PR that implements route publish
> and
> > offline feature [1].
> >
> > We hope that instead of releasing a route immediately, we can test it
> > first, and release it after the test result is OK.
> >
> > So we think it is more suitable to implement this feature directly in
> > `Apache APISIX` instead of dashboard.
> >
> > Here is the implementation steps in my mind:
> >
> > 1. Add an `enable` field, or another more suitable field to the route
> > configuration, and the default value of the field is false when adding a
> > route. Which means the route is not released.
> >
> > 2. Add a matching item `enable` similar to `host` or `method` in the
> > `lua-resty-radixtree` library.
> > When matching a route for client request, If the value of `enable` is
> > false, skip the route directly.
> > But when there is `X-APISIX-ROUTE-DEBUG` in the http header and the value
> > is true, routes which `enable` are false can be matched according to
> other
> > conditions.
> >
> > 3. Now, normal client requests will skip routes not released, and
> requests
> > for testing by specifying the http header `X-APISIX-ROUTE-DEBUG` can
> match
> > routes not released, thus realizing our needs.
> >
> > Example:
> >
> > 1. Create a route (it's not released by default)
> >
> > ```shell
> > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> > edd1c9f034335f136f87ad84b625c8f1'-X PUT -i -d'
> > {
> > "Uri": "/route-debug-test",
> > "Upstream": {
> > "Type": "roundrobin",
> > "node":{
> > "127.0.0.1:80": 1
> > }
> > }
> > }'
> > ```
> > 2. Normal request (404 not found)
> > ```
> > curl 127.0.0.1:9080/route-debug-test
> > ```
> >
> > 3. Debugging (200)
> > ```
> > curl 127.0.0.1:9080/route-debug-test -H "X-APISIX-ROUTE-DEBUG: true"
> > ```
> >
> > 4. Release the route
> > ```
> > $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> > edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
> > {
> > "Status": 0
> > }'
> > ```
> >
> > 5. Normal access (200)
> > ```
> > curl 127.0.0.1:9080/route-debug-test
> > ```
> >
> >
> > [1] https://github.com/apache/apisix-dashboard/pull/451
> >
>
Re: [DISCUSS] Implement route debug and release feature
Posted by Ming Wen <we...@apache.org>.
I have a concern. The debug/disabled state routera are also in the
production system. If there is a bug, it will be very serious.
Thanks,
Ming Wen, Apache APISIX & Apache SkyWalking
Twitter: _WenMing
JunXu Chen <ch...@apache.org> 于2020年9月26日周六 下午11:50写道:
> Hi, community,
>
> @liuxiran previously submitted a nice PR that implements route publish and
> offline feature [1].
>
> We hope that instead of releasing a route immediately, we can test it
> first, and release it after the test result is OK.
>
> So we think it is more suitable to implement this feature directly in
> `Apache APISIX` instead of dashboard.
>
> Here is the implementation steps in my mind:
>
> 1. Add an `enable` field, or another more suitable field to the route
> configuration, and the default value of the field is false when adding a
> route. Which means the route is not released.
>
> 2. Add a matching item `enable` similar to `host` or `method` in the
> `lua-resty-radixtree` library.
> When matching a route for client request, If the value of `enable` is
> false, skip the route directly.
> But when there is `X-APISIX-ROUTE-DEBUG` in the http header and the value
> is true, routes which `enable` are false can be matched according to other
> conditions.
>
> 3. Now, normal client requests will skip routes not released, and requests
> for testing by specifying the http header `X-APISIX-ROUTE-DEBUG` can match
> routes not released, thus realizing our needs.
>
> Example:
>
> 1. Create a route (it's not released by default)
>
> ```shell
> $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> edd1c9f034335f136f87ad84b625c8f1'-X PUT -i -d'
> {
> "Uri": "/route-debug-test",
> "Upstream": {
> "Type": "roundrobin",
> "node":{
> "127.0.0.1:80": 1
> }
> }
> }'
> ```
> 2. Normal request (404 not found)
> ```
> curl 127.0.0.1:9080/route-debug-test
> ```
>
> 3. Debugging (200)
> ```
> curl 127.0.0.1:9080/route-debug-test -H "X-APISIX-ROUTE-DEBUG: true"
> ```
>
> 4. Release the route
> ```
> $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
> {
> "Status": 0
> }'
> ```
>
> 5. Normal access (200)
> ```
> curl 127.0.0.1:9080/route-debug-test
> ```
>
>
> [1] https://github.com/apache/apisix-dashboard/pull/451
>
Re: [DISCUSS] Implement route debug and release feature
Posted by Zhiyuan Ju <ju...@apache.org>.
LGTM, but there have 2 confusion points.
1. Could we use `disabled ` instead of `disable`?
2. In step4, why there is a status field?
Best Regards!
@ Zhiyuan Ju <https://www.shaoyaoju.org/>
JunXu Chen <ch...@apache.org> 于2020年9月26日周六 下午11:50写道:
> Hi, community,
>
> @liuxiran previously submitted a nice PR that implements route publish and
> offline feature [1].
>
> We hope that instead of releasing a route immediately, we can test it
> first, and release it after the test result is OK.
>
> So we think it is more suitable to implement this feature directly in
> `Apache APISIX` instead of dashboard.
>
> Here is the implementation steps in my mind:
>
> 1. Add an `enable` field, or another more suitable field to the route
> configuration, and the default value of the field is false when adding a
> route. Which means the route is not released.
>
> 2. Add a matching item `enable` similar to `host` or `method` in the
> `lua-resty-radixtree` library.
> When matching a route for client request, If the value of `enable` is
> false, skip the route directly.
> But when there is `X-APISIX-ROUTE-DEBUG` in the http header and the value
> is true, routes which `enable` are false can be matched according to other
> conditions.
>
> 3. Now, normal client requests will skip routes not released, and requests
> for testing by specifying the http header `X-APISIX-ROUTE-DEBUG` can match
> routes not released, thus realizing our needs.
>
> Example:
>
> 1. Create a route (it's not released by default)
>
> ```shell
> $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> edd1c9f034335f136f87ad84b625c8f1'-X PUT -i -d'
> {
> "Uri": "/route-debug-test",
> "Upstream": {
> "Type": "roundrobin",
> "node":{
> "127.0.0.1:80": 1
> }
> }
> }'
> ```
> 2. Normal request (404 not found)
> ```
> curl 127.0.0.1:9080/route-debug-test
> ```
>
> 3. Debugging (200)
> ```
> curl 127.0.0.1:9080/route-debug-test -H "X-APISIX-ROUTE-DEBUG: true"
> ```
>
> 4. Release the route
> ```
> $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY:
> edd1c9f034335f136f87ad84b625c8f1'-X PATCH -i -d'
> {
> "Status": 0
> }'
> ```
>
> 5. Normal access (200)
> ```
> curl 127.0.0.1:9080/route-debug-test
> ```
>
>
> [1] https://github.com/apache/apisix-dashboard/pull/451
>