You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "0prodigy (via GitHub)" <gi...@apache.org> on 2023/02/17 19:45:28 UTC

[GitHub] [apisix] 0prodigy opened a new issue, #8880: bug: traffic-split not routing traffic using upstream_id

0prodigy opened a new issue, #8880:
URL: https://github.com/apache/apisix/issues/8880

   ### Current Behavior
   
   ```
   {
     "uri": "/s9xu90sq/*",
     "name": "s",
     "plugins": {
       "key-auth": {
         "header": "nbx-key",
         "hide_credentials": false,
         "query": "nbx-key"
       },
       "proxy-rewrite": {
         "regex_uri": [
           "^(/[^/]+)([/:].*)",
           "$2"
         ],
         "use_real_request_uri_unsafe": false
       },
       "traffic-split": {
         "rules": [
           {
             "weighted_upstreams": [
               {
                 "upstream_id": "3sdsshxf",
                 "weight": 5
               },
               {
                 "weight": 1
               }
             ]
           }
         ]
       }
     },
     "upstream_id": "2kkhtea5",
     "labels": {
       "serving_id": "s9xu90sq",
       "traffic_strategy": "custom_weights"
     },
     "status": 1
   }
   ```
   
   Above configuration doesn't route traffic based on weight every call is forward to upstream set on route no effect of traffic-split plugin 
   
   ### Expected Behavior
   
   API call should be distributed based on weight set in traffic-split which 5:1 
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   1. Create upstreams
   2. Create route using upstream id 
   
   
   ### Environment
   
   - APISIX version (run apisix version): 3.0.0
   - Operating system (run uname -a): Linux (x86_64 GNU/Linux)
   - OpenResty / Nginx version (run openresty -V or nginx -V): openresty/1.21.4.1
   - etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run luarocks --version):


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

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


[GitHub] [apisix] monkeyDluffy6017 commented on issue #8880: bug: traffic-split plugin doesn't work with key-auth

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on issue #8880:
URL: https://github.com/apache/apisix/issues/8880#issuecomment-1437819727

   I test `key-auth` and `traffic-split`,  the two plugins could work together, are there any other prlblems?
   ```
   === TEST 1: add consumer with username and plugins
   --- config
       location /t {
           content_by_lua_block {
               local t = require("lib.test_admin").test
               local code, body = t('/apisix/admin/consumers',
                   ngx.HTTP_PUT,
                   [[{
                       "username": "jack",
                       "plugins": {
                           "key-auth": {
                               "key": "auth-one"
                           }
                       }
                   }]]
                   )
   
               if code >= 300 then
                   ngx.status = code
               end
               ngx.say(body)
           }
       }
   --- request
   GET /t
   --- response_body
   passed
   
   
   
   === TEST 2: mock Grayscale Release
   --- config
       location /t {
           content_by_lua_block {
               local t = require("lib.test_admin").test
               local json = require("toolkit.json")
   
               local data = {
                   uri = "/server_port",
                   plugins = {
                       ["key-auth"] = {},
                       ["traffic-split"] = {
                           rules = {{
                               weighted_upstreams = {
                                   {
                                       upstream = {
                                           name = "upstream_A",
                                           type = "roundrobin",
                                           nodes = {["127.0.0.1:1981"] = 1}
                                       },
                                       weight = 2
                                   },
                                   {
                                       weight = 1
                                   }
                               }
                           }}
                       }
                   },
                   upstream = {
                       type = "roundrobin",
                       nodes = {["127.0.0.1:1980"] = 1}
                   }
               }
   
               local code, body = t('/apisix/admin/routes/1',
                   ngx.HTTP_PUT,
                   json.encode(data)
               )
               if code >= 300 then
                   ngx.status = code
               end
               ngx.say(body)
           }
       }
   --- request
   GET /t
   --- response_body
   passed
   
   
   
   === TEST 3: 2/3 request traffic hits the upstream of the plugin, 1/3 request traffic hits the upstream of `route`
   --- config
   location /t {
       content_by_lua_block {
           local t = require("lib.test_admin").test
           local bodys = {}
           for i = 1, 6 do
               local _, _, body = t('/server_port', ngx.HTTP_GET, nil, nil, {apikey = "auth-one"})
               bodys[i] = body
           end
           table.sort(bodys)
           ngx.say(table.concat(bodys, ", "))
       }
   }
   --- request
   GET /t
   --- response_body
   1980, 1980, 1981, 1981, 1981, 1981
   ```


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


Re: [I] bug: traffic-split plugin doesn't work with key-auth [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #8880: bug: traffic-split plugin doesn't work with key-auth
URL: https://github.com/apache/apisix/issues/8880


-- 
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] 0prodigy commented on issue #8880: bug: traffic-split plugin doesn't work with key-auth

Posted by "0prodigy (via GitHub)" <gi...@apache.org>.
0prodigy commented on issue #8880:
URL: https://github.com/apache/apisix/issues/8880#issuecomment-1437871742

   But in my case when i use `key-auth` plugin route always respond with upstream set in route not in `traffic-split` when i remove the `key-auth` plugin route return as expected. What other info i can provide you to understand the problem? 
   
   There is no major in change in config file as well.
   


-- 
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] tokers commented on issue #8880: bug: traffic-split plugin doesn't work with key-auth

Posted by "tokers (via GitHub)" <gi...@apache.org>.
tokers commented on issue #8880:
URL: https://github.com/apache/apisix/issues/8880#issuecomment-1435907789

   The title says the `traffic-split` plugin doesn't work with the `key-auth` plugin. Did you try to remove the `key-auth` plugin and see if the `traffic-split` plugin works?


-- 
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] 0prodigy commented on issue #8880: bug: traffic-split plugin doesn't work with key-auth

Posted by "0prodigy (via GitHub)" <gi...@apache.org>.
0prodigy commented on issue #8880:
URL: https://github.com/apache/apisix/issues/8880#issuecomment-1435910321

   Yes, I have tried it and it works without key-auth plugin


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


Re: [I] bug: traffic-split plugin doesn't work with key-auth [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8880:
URL: https://github.com/apache/apisix/issues/8880#issuecomment-1750325503

   This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.


-- 
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] shreemaan-abhishek commented on issue #8880: bug: traffic-split plugin doesn't work with key-auth

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #8880:
URL: https://github.com/apache/apisix/issues/8880#issuecomment-1706409054

   @0prodigy, do you find any message in the error logs?


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


Re: [I] bug: traffic-split plugin doesn't work with key-auth [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8880:
URL: https://github.com/apache/apisix/issues/8880#issuecomment-1742734069

   Due to lack of the reporter's response this issue has been labeled with "no response". It will be close in 3 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


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