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 2020/11/13 03:52:48 UTC

[GitHub] [apisix] liuxiran opened a new issue #2737: Proposal: Support enable/disable route

liuxiran opened a new issue #2737:
URL: https://github.com/apache/apisix/issues/2737


   ### Issue description
   
   We could add enable/disable status to route so that it would support online / offline feature.
   
   refer to:  https://github.com/apache/apisix-dashboard/issues/611#issuecomment-722256486
   
   
   


----------------------------------------------------------------
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.

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



[GitHub] [apisix] liuxiran commented on issue #2737: Proposal: Support enable/disable route

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


   Ok, then we'll do this by adding a new field :) 
   
   Since we are not much familiar with the logic of the route, we will try to sort out the existing logic and list the solution


----------------------------------------------------------------
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.

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



[GitHub] [apisix] liuxiran commented on issue #2737: Proposal: Support enable/disable route

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


   I have a question: how does apisix watch the changes of etcd and update the nginx config?  
   
   my current implementation idea is that 
   
   1. add a field `status` in route`s schema, like  https://github.com/apache/apisix/blob/d7593a0ac3f960ab23d5a71d98cf1666e21b207c/apisix/schema_def.lua#L621
   
   1. write the route to etcd after it is created, and remove it from the nginx configuration when it is discovered that the status of the route is 0 (offline).
   
   as for the second step I didn't find the relevant code , so do we have any reference codes or documentations?
   
   Thanks and looking forward to your reply😊
   
   cc @membphis @moonming @spacewander 
   
   


----------------------------------------------------------------
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.

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



[GitHub] [apisix] membphis commented on issue #2737: Proposal: Support enable/disable route

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


   I write an example, follow @liuxiran design: add new field `status`. I think this way is good.
   
   ```
   {
       "uri": "/hello",    # uri
       "status": 0,        # integer value: 1 - online(default value), 0 - offline
       ... ...
   }
   ```


----------------------------------------------------------------
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.

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



[GitHub] [apisix] moonming commented on issue #2737: Proposal: Support enable/disable route

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


   ping @membphis 


----------------------------------------------------------------
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.

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



[GitHub] [apisix] liuxiran commented on issue #2737: Proposal: Support enable/disable route

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


   > > Yes, indeed, I haven't found the clue yet, how to let the route with `status=0` not take effect, I have not found reference codes
   > 
   > welcome PR for this new feature. the APISIX does not support this feature now.
   > 
   > Does anyone want to handle this problem?
   
   OK,thanks a lot, then my teammate will try to handle it later.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] juzhiyuan edited a comment on issue #2737: Proposal: Support enable/disable route

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


   @liuxiran  If this is ok, kindly remove the `discuss` label and add `enhancement`.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] liuxiran commented on issue #2737: Proposal: Support enable/disable route

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


   > do we need to add a new field to `route` for this feature? @liuxiran
   
   We need a field to mark the status of the route:
   
   - add a new field, that would be the most straightforward way
   
   - add a specific property to the `labels`, that would be  a kind of extensibility way
   
   We think both ways are okay, which one would you prefer @membphis ?
   


----------------------------------------------------------------
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.

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



[GitHub] [apisix] juzhiyuan commented on issue #2737: Proposal: Support enable/disable route

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


   I would prefer using standalone field, for labels are used to add description for target. 


----------------------------------------------------------------
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.

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



[GitHub] [apisix] moonming commented on issue #2737: Proposal: Support enable/disable route

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


   add a new field is good for me


----------------------------------------------------------------
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.

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



[GitHub] [apisix] tzssangglass edited a comment on issue #2737: Proposal: Support enable/disable route

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


   to let the route with `status=0` not take effect, can only remove this route from the `radixtree`?


----------------------------------------------------------------
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.

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



[GitHub] [apisix] liuxiran commented on issue #2737: Proposal: Support enable/disable route

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


   > > as for the second step I didn't find the relevant code , so do we have any reference codes or documentations?
   > 
   > Just to make sure, @membphis please take a look at here.
   
   Yes, indeed, I haven't found the clue yet, how to let the route with `status=0` not take effect, I have not found reference codes


----------------------------------------------------------------
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.

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



[GitHub] [apisix] juzhiyuan commented on issue #2737: Proposal: Support enable/disable route

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


   If this is ok, kindly remove the `discuss` label and add `enhancement`.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] membphis commented on issue #2737: Proposal: Support enable/disable route

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


   > Yes, indeed, I haven't found the clue yet, how to let the route with `status=0` not take effect, I have not found reference codes
   
   welcome PR for this new feature. the APISIX does not support this feature now.
   
   Does anyone want to handle this problem?


----------------------------------------------------------------
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.

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



[GitHub] [apisix] tzssangglass commented on issue #2737: Proposal: Support enable/disable route

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


   to let the route with status=0 not take effect, can only remove this route from the radetree?


----------------------------------------------------------------
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.

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



[GitHub] [apisix] spacewander closed issue #2737: Proposal: Support enable/disable route

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #2737:
URL: https://github.com/apache/apisix/issues/2737


   


----------------------------------------------------------------
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.

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



[GitHub] [apisix] membphis commented on issue #2737: Proposal: Support enable/disable route

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


   do we need to add a new field to `route` for this feature? @liuxiran 


----------------------------------------------------------------
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.

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



[GitHub] [apisix] juzhiyuan commented on issue #2737: Proposal: Support enable/disable route

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


   > as for the second step I didn't find the relevant code , so do we have any reference codes or documentations?
   
   Just to make sure, @membphis please take a look at here.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] membphis commented on issue #2737: Proposal: Support enable/disable route

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


   > add a new field is good for me
   
   +1


----------------------------------------------------------------
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.

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



[GitHub] [apisix] tzssangglass commented on issue #2737: Proposal: Support enable/disable route

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


   get, let me study it.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] membphis commented on issue #2737: Proposal: Support enable/disable route

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


   > to let the route with `status=0` not take effect, can only remove this route from the `radixtree`?
   
   @tzssangglass @moonming 
   
   for router `radixtree_uri`, we can add a new process here: 
   https://github.com/apache/apisix/blob/master/apisix/http/router/radixtree_uri.lua#L42
   
   ```lua
       for _, route in ipairs(routes) do
           if type(route) == "table" then
               if route.status and route.status ~= 1 then   -- check the status
                   goto CONTINUE
               end
   
               ... ...
               ::CONTINUE::
           end
       end
   ```
   
   and we need to update the router `adixtree_host_uri` too, use the same way.


----------------------------------------------------------------
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.

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