You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/02/18 05:45:26 UTC

[GitHub] [apisix] jagerzhang opened a new issue #6368: request help: can Admin API supports route hit detection?

jagerzhang opened a new issue #6368:
URL: https://github.com/apache/apisix/issues/6368


   ### Issue description
   
   Hi,我想请教下APISIX有没有可能提供一个探测路由配置是否命中的接口?比如想 admin-api POST 一个新的路由配置Body,api告诉这个配置是否命中存量路由。
   
   ```
   POST /apisix/admin/routes/probe
   {
     "uris": [
       "/demo"
     ],
     "methods": [
       "GET",
       "POST",
       "HEAD"
     ],
     "hosts": [
       "demo.domain1.com",
       "demo.domain2.com",
     ]
   }
   ```
   比如命中可以返回命中的路由ID等信息:
   ```
   {
   "msg": "hit",
   "route_id": "xxxx"
   "code": 200
   }
   ```
   
   ### 可能这个需求有点偏,不过还是想请教下。下面是我的场景描述:
   =============================================
   ### 背景
   我们想基于APISIX包装一个HTTP 7层业务网关服务,每个业务在门户中设置租户隔离,业务只能看到和自己相关的服务、上游、路由以及消费者等,业务之间可以通过服务自带的消费者去申请调用权限,其他则不在有数据上的交叉。
   
   ### 问题
   在这个背景下,希望业务方在添加路由的时候,能够主动探测路由冲突情况,判断是否会覆盖掉现有路由,导致故障。但是APISIX好像并没有这种检测机制,可以随便添加相同或相近的路由配置。
   
   ###  解决
   方案1:我们在设计网关服务的时候增加限制逻辑,会持久化记录路由配置信息,比如请求方法、域名、url等,然后在业务添加路由的时候判断是否冲突,再做后续的限制或提示逻辑。
   
   方案2:和方案1类似增加限制逻辑,但是判断是否冲突**是通过APISIX的接口**来查询是否命中已有路由,整体更加简单,数据都在APISIX,不额外增加其他存储。
   
   
   ### Environment
   
   - apisix version (cmd: `apisix version`): 2.12.0
   - OS (cmd: `uname -a`): docker-centos


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on issue #6368: request help: can Admin API supports route probe?

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #6368:
URL: https://github.com/apache/apisix/issues/6368#issuecomment-1047404686


   > Another way is to provide an interface in which to run route match and return the results?
   
   How does this interface distinguish `path` from the HTTP request? As we need to use a special path to reach the interface.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #6368: request help: can Admin API supports route probe?

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6368:
URL: https://github.com/apache/apisix/issues/6368#issuecomment-1048740459


   > When the request hits `/control/v1/probe`, how can it pass its real path (and host)?
   
   Put in the request body? Seems like a bit of a hassle too. It seems like a good option to add a parameter inside debug mode to control this functionality.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jagerzhang commented on issue #6368: request help: can Admin API supports route probe?

Posted by GitBox <gi...@apache.org>.
jagerzhang commented on issue #6368:
URL: https://github.com/apache/apisix/issues/6368#issuecomment-1046845360


   > Another way is to provide an interface in which to run route match and return the results?
   
   如果能做到,这个方案应该更简洁一些,如果不好实现的话,罗总提到的特殊实例+debug这个方案应该也可以满足。
   
   我们这边讨论了下,考虑先在管理层自己做一下限制,有需要的同学可以参考:
   ![image](https://user-images.githubusercontent.com/9711651/154958695-c477c21a-f408-4965-994a-9deb6eb68ec4.png)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #6368: request help: can Admin API supports route probe?

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6368:
URL: https://github.com/apache/apisix/issues/6368#issuecomment-1047015965


   Tying the domain name to the business system and dividing the detection area works, I have done a similar design.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #6368: request help: can Admin API supports route probe?

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6368:
URL: https://github.com/apache/apisix/issues/6368#issuecomment-1046442484


   Another way is to provide an interface in which to run route match and return the results?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jagerzhang edited a comment on issue #6368: request help: can Admin API supports route probe?

Posted by GitBox <gi...@apache.org>.
jagerzhang edited a comment on issue #6368:
URL: https://github.com/apache/apisix/issues/6368#issuecomment-1046845360


   > Another way is to provide an interface in which to run route match and return the results?
   
   如果能做到,这个方案应该更简洁一些,如果不好实现的话,罗总提到的特殊实例+debug这个方案应该也可以满足。
   
   我们这边讨论了下,考虑先在管理层自己做一下限制,大家可以探讨一下:
   
   ![image](https://user-images.githubusercontent.com/9711651/154964284-dbdc1278-63e5-4abe-b5c7-c7746ebcad2b.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #6368: request help: can Admin API supports route probe?

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6368:
URL: https://github.com/apache/apisix/issues/6368#issuecomment-1047424093


   > How does this interface distinguish `path` from the HTTP request? As we need to use a special path to reach the interface.
   
   can we add a control API and call 
   
   ```lua
   local router          = require("apisix.router")
   
   router.router_http.match(api_ctx)
   ```
   
   in control API function.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on issue #6368: request help: can Admin API supports route probe?

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #6368:
URL: https://github.com/apache/apisix/issues/6368#issuecomment-1048395742


   When the request hits `/control/v1/probe`, how can it pass its real path (and host)?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on issue #6368: request help: can Admin API supports route probe?

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #6368:
URL: https://github.com/apache/apisix/issues/6368#issuecomment-1046201289


   Look like we can add a match_only option to the debug.yaml?
   When this option is on, we just return matched router so we can deploy a special APISIX instance to check if there is conflict.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jagerzhang edited a comment on issue #6368: request help: can Admin API supports route probe?

Posted by GitBox <gi...@apache.org>.
jagerzhang edited a comment on issue #6368:
URL: https://github.com/apache/apisix/issues/6368#issuecomment-1046845360


   > Another way is to provide an interface in which to run route match and return the results?
   
   如果能做到,这个方案应该更简洁一些,如果不好实现的话,罗总提到的特殊实例+debug这个方案应该也可以满足,只是复杂度有所上升。
   
   我们这边讨论了下,考虑先在管理层自己做一下限制,大家可以探讨一下:
   
   ![image](https://user-images.githubusercontent.com/9711651/154964284-dbdc1278-63e5-4abe-b5c7-c7746ebcad2b.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org