[GitHub] [apisix] spacewander commented on issue #1409: request help: routes only ipv4 or ipv6 support
spacewander commented on issue #1409: URL: https://github.com/apache/apisix/issues/1409#issuecomment-706654986 Solved. 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: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #1409: request help: routes only ipv4 or ipv6 support
spacewander closed issue #1409: URL: https://github.com/apache/apisix/issues/1409 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: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #1498: CI: from travis to github actions
spacewander closed issue #1498: URL: https://github.com/apache/apisix/issues/1498 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: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #1498: CI: from travis to github actions
spacewander commented on issue #1498: URL: https://github.com/apache/apisix/issues/1498#issuecomment-706654899 Solved. 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: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #1680: Is etcd configuration support v3 api
spacewander commented on issue #1680: URL: https://github.com/apache/apisix/issues/1680#issuecomment-706654750 Solved. 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: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #1680: Is etcd configuration support v3 api
spacewander closed issue #1680: URL: https://github.com/apache/apisix/issues/1680 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: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #1693: request help: apisix supports running as root user
spacewander closed issue #1693: URL: https://github.com/apache/apisix/issues/1693 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: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #1693: request help: apisix supports running as root user
spacewander commented on issue #1693: URL: https://github.com/apache/apisix/issues/1693#issuecomment-706654655 Considered solved. 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: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #1767: feature: support etcd v3
spacewander commented on issue #1767: URL: https://github.com/apache/apisix/issues/1767#issuecomment-706654468 Solved. 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: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #1767: feature: support etcd v3
spacewander closed issue #1767: URL: https://github.com/apache/apisix/issues/1767 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: us...@infra.apache.org
[GitHub] [apisix] membphis commented on issue #2378: request help: why the uri in route not work
membphis commented on issue #2378: URL: https://github.com/apache/apisix/issues/2378#issuecomment-706653921 I think we can close this issue now 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: us...@infra.apache.org
[GitHub] [apisix] membphis closed issue #2378: request help: why the uri in route not work
membphis closed issue #2378: URL: https://github.com/apache/apisix/issues/2378 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: us...@infra.apache.org
[GitHub] [apisix] membphis commented on issue #2378: request help: why the uri in route not work
membphis commented on issue #2378: URL: https://github.com/apache/apisix/issues/2378#issuecomment-706653895 your case is wrong. here is a correct example, @idbeta you can take a look at it: ``` # should use the original uri value curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d ' { "uri": "/hello\r\n", "upstream": {"nodes": {"127.0.0.1:9666": 1}, "type": "roundrobin"} }' # when we try to hit the route, we should use URL encode way. `\r` -> `%0d`, `\n` -> `%0a` curl -i 'http://127.0.0.1:9080/hello%0d%0a' ``` 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: us...@infra.apache.org
[GitHub] [apisix] spacewander closed pull request #1931: feature: support defined environment variable in config.yaml #1922
spacewander closed pull request #1931: URL: https://github.com/apache/apisix/pull/1931 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: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on pull request #1931: feature: support defined environment variable in config.yaml #1922
spacewander commented on pull request #1931: URL: https://github.com/apache/apisix/pull/1931#issuecomment-706653773 The feature is implemented in #2174. 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: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on pull request #1979: bugfix: empty `allow_admin` means that any IP is allowed to access Ad…
spacewander commented on pull request #1979: URL: https://github.com/apache/apisix/pull/1979#issuecomment-706653728 The `.travis/apisix_cli_test.sh` is in conflicted now. 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: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on pull request #2153: Change: worker and cpu optimization
spacewander commented on pull request #2153: URL: https://github.com/apache/apisix/pull/2153#issuecomment-706653626 Ping @ShiningRush ? 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: us...@infra.apache.org
[GitHub] [apisix] spacewander opened a new pull request #2386: change(hmac-auth): split schema to adapt different occasions
spacewander opened a new pull request #2386: URL: https://github.com/apache/apisix/pull/2386 ### What this PR does / why we need it: ### Pre-submission checklist: * [x] Did you explain what problem does this PR solve? Or what new features have been added? * [x] Have you added corresponding test cases? * [ ] Have you modified the corresponding document? * [ ] Is this PR backward compatible? 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: us...@infra.apache.org
[apisix] branch master updated: CI: run the APISIX instance in an empty folder for `linux_apisix_current_luarocks`. (#2385)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 72eef02 CI: run the APISIX instance in an empty folder for `linux_apisix_current_luarocks`. (#2385) 72eef02 is described below commit 72eef02061a709869d16440490d6103068a8376f Author: YuanSheng Wang AuthorDate: Sun Oct 11 12:59:54 2020 +0800 CI: run the APISIX instance in an empty folder for `linux_apisix_current_luarocks`. (#2385) fix #2384 --- .travis/linux_apisix_current_luarocks_runner.sh | 10 +++--- .travis/linux_apisix_master_luarocks_runner.sh | 9 - 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.travis/linux_apisix_current_luarocks_runner.sh b/.travis/linux_apisix_current_luarocks_runner.sh index 894542a..23bb3f9 100755 --- a/.travis/linux_apisix_current_luarocks_runner.sh +++ b/.travis/linux_apisix_current_luarocks_runner.sh @@ -60,6 +60,8 @@ script() { sudo luarocks install rockspec/apisix-master-0.rockspec --only-deps > build.log 2>&1 || (cat build.log && exit 1) sudo luarocks make rockspec/apisix-master-0.rockspec > build.log 2>&1 || (cat build.log && exit 1) +mkdir cli_tmp && cd cli_tmp + # show install file luarocks show apisix @@ -68,15 +70,17 @@ script() { sudo PATH=$PATH apisix start sudo PATH=$PATH apisix stop -# apisix cli test -sudo PATH=$PATH .travis/apisix_cli_test.sh - cat /usr/local/apisix/logs/error.log | grep '\[error\]' > /tmp/error.log | true if [ -s /tmp/error.log ]; then echo "=found error log=" cat /usr/local/apisix/logs/error.log exit 1 fi + +cd .. + +# apisix cli test +sudo PATH=$PATH .travis/apisix_cli_test.sh } case_opt=$1 diff --git a/.travis/linux_apisix_master_luarocks_runner.sh b/.travis/linux_apisix_master_luarocks_runner.sh index a657d91..1a992ae 100755 --- a/.travis/linux_apisix_master_luarocks_runner.sh +++ b/.travis/linux_apisix_master_luarocks_runner.sh @@ -64,10 +64,6 @@ script() { sudo mkdir -p /usr/local/apisix/deps sudo PATH=$PATH ./utils/install-apisix.sh install > build.log 2>&1 || (cat build.log && exit 1) -# REMOVE ME after PR merged: https://github.com/apache/apisix/pull/2383 -sudo mkdir -p /usr/local/apisix/apisix/ssl/router -sudo wget -P /usr/local/apisix/apisix/ssl/router/ https://raw.githubusercontent.com/apache/apisix/master/apisix/ssl/router/radixtree_sni.lua - sudo PATH=$PATH apisix help sudo PATH=$PATH apisix init sudo PATH=$PATH apisix start @@ -78,11 +74,6 @@ script() { # install APISIX by luarocks sudo luarocks install $APISIX_MAIN > build.log 2>&1 || (cat build.log && exit 1) -# REMOVE ME after PR merged: https://github.com/apache/apisix/pull/2383 -sudo mkdir -p /usr/local/apisix/apisix/ssl/router -sudo wget -P /usr/local/apisix/apisix/ssl/router/ https://raw.githubusercontent.com/apache/apisix/master/apisix/ssl/router/radixtree_sni.lua -ls /usr/local/apisix/apisix/ssl/router - # show install files luarocks show apisix
[GitHub] [apisix] membphis closed issue #2384: CI: linux_apisix_current_luarocks_runner should fail if missing install any Lua code
membphis closed issue #2384: URL: https://github.com/apache/apisix/issues/2384 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: us...@infra.apache.org
[GitHub] [apisix] membphis merged pull request #2385: CI: run the APISIX instance in an empty folder.
membphis merged pull request #2385: URL: https://github.com/apache/apisix/pull/2385 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: us...@infra.apache.org
[GitHub] [apisix] membphis closed issue #2382: bug: failed to load module 'apisix.ssl.router.radixtree_sni' not found
membphis closed issue #2382: URL: https://github.com/apache/apisix/issues/2382 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: us...@infra.apache.org
[GitHub] [apisix] membphis merged pull request #2383: bugfix: install the Lua files in `apisix/ssl/router` .
membphis merged pull request #2383: URL: https://github.com/apache/apisix/pull/2383 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: us...@infra.apache.org
[apisix] branch master updated (647d8d9 -> d6b00bb)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 647d8d9 bugfix: check every etcd version, rather than only check the first one (#2380) add d6b00bb bugfix: install the Lua files in `apisix/ssl/router` . (#2383) No new revisions were added by this update. Summary of changes: .travis/linux_apisix_master_luarocks_runner.sh | 9 + Makefile | 9 ++--- 2 files changed, 15 insertions(+), 3 deletions(-)
[apisix-dashboard] branch feat-route updated (e052cf4 -> 2089682)
This is an automated email from the ASF dual-hosted git repository. sunyi pushed a change to branch feat-route in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from e052cf4 Merge branch 'fe-refactor' into feat-route add 2089682 feat: use upstream component No new revisions were added by this update. Summary of changes: src/pages/Route/Create.tsx | 20 +- .../Route/components/CreateStep4/CreateStep4.tsx | 12 +- .../Route/components/Step1/RequestConfigView.tsx | 8 +- .../Route/components/Step2/RequestRewriteView.tsx | 375 + src/pages/Route/service.ts | 8 +- src/pages/Route/transform.ts | 34 +- src/pages/Route/typing.d.ts| 1 + 7 files changed, 47 insertions(+), 411 deletions(-)
[GitHub] [apisix] membphis commented on pull request #2385: CI: run the APISIX instance in an empty folder.
membphis commented on pull request #2385: URL: https://github.com/apache/apisix/pull/2385#issuecomment-706646643 this PR depends on https://github.com/apache/apisix/pull/2383 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: us...@infra.apache.org
[GitHub] [apisix] membphis opened a new pull request #2385: CI: run the APISIX instance in an empty folder.
membphis opened a new pull request #2385: URL: https://github.com/apache/apisix/pull/2385 ### What this PR does / why we need it: fix #2384 ### Pre-submission checklist: * [ ] Did you explain what problem does this PR solve? Or what new features have been added? * [ ] Have you added corresponding test cases? * [ ] Have you modified the corresponding document? * [ ] Is this PR backward compatible? 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: us...@infra.apache.org
[GitHub] [apisix] membphis opened a new issue #2384: CI: linux_apisix_current_luarocks_runner should fail if missing install any Lua code
membphis opened a new issue #2384: URL: https://github.com/apache/apisix/issues/2384 for example, this commit: https://github.com/apache/apisix/commit/647d8d9a62668aa066775ce2a3dc4c32a9c03209 the CI `linux_apisix_current_luarocks_runner` should fail, but it runs successfully. 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: us...@infra.apache.org
[apisix-dashboard] branch feat-route updated (dd88873 -> e052cf4)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch feat-route in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from dd88873 feat: sync branch from fe-refactor add 871ace3 feat(Upstream): debug API (#550) add 6690bec feat: added default data add 87366a2 feat: added Ref for upstreamForm add 6c3fb3f feat: added lincense add e052cf4 Merge branch 'fe-refactor' into feat-route No new revisions were added by this update. Summary of changes:
[apisix-dashboard] branch feat-route updated (8af4181 -> dd88873)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch feat-route in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from 8af4181 feat: remove WebSocket add dd88873 feat: sync branch from fe-refactor No new revisions were added by this update. Summary of changes: src/components/Upstream/UpstreamForm.tsx | 633 +++ .../components/Upstream/constant.ts| 10 +- .../Metrics => components/Upstream}/index.ts | 4 +- .../Route/components/Step2/RequestRewriteView.tsx | 2 +- src/pages/Upstream/Create.tsx | 61 +- src/pages/Upstream/components/Preview.tsx | 33 - src/pages/Upstream/components/Step1.tsx| 693 + src/pages/Upstream/service.ts | 8 +- src/pages/Upstream/transform.ts| 56 +- src/pages/Upstream/typing.d.ts | 8 +- 10 files changed, 711 insertions(+), 797 deletions(-) create mode 100644 src/components/Upstream/UpstreamForm.tsx copy mock/route.ts => src/components/Upstream/constant.ts (82%) copy src/{pages/Metrics => components/Upstream}/index.ts (91%) delete mode 100644 src/pages/Upstream/components/Preview.tsx
[apisix-dashboard] branch fe-refactor updated (87366a2 -> 6c3fb3f)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch fe-refactor in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from 87366a2 feat: added Ref for upstreamForm add 6c3fb3f feat: added lincense No new revisions were added by this update. Summary of changes: src/components/Upstream/constant.ts | 16 1 file changed, 16 insertions(+)
[apisix-dashboard] branch fe-refactor updated (871ace3 -> 87366a2)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch fe-refactor in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from 871ace3 feat(Upstream): debug API (#550) add 6690bec feat: added default data add 87366a2 feat: added Ref for upstreamForm No new revisions were added by this update. Summary of changes: src/components/Upstream/UpstreamForm.tsx | 959 --- src/components/Upstream/constant.ts | 9 + src/components/Upstream/index.ts | 1 + src/pages/Upstream/Create.tsx| 40 +- src/pages/Upstream/components/Step1.tsx | 19 +- 5 files changed, 539 insertions(+), 489 deletions(-) create mode 100644 src/components/Upstream/constant.ts
[GitHub] [apisix] membphis opened a new pull request #2383: bugfix: install the Lua files in `apisix/ssl/router` .
membphis opened a new pull request #2383: URL: https://github.com/apache/apisix/pull/2383 ### What this PR does / why we need it: fix #2382 ### Pre-submission checklist: * [ ] Did you explain what problem does this PR solve? Or what new features have been added? * [ ] Have you added corresponding test cases? * [ ] Have you modified the corresponding document? * [ ] Is this PR backward compatible? 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: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2367: change: refactor router
membphis commented on a change in pull request #2367: URL: https://github.com/apache/apisix/pull/2367#discussion_r502852727 ## File path: apisix/api_router.lua ## @@ -0,0 +1,76 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local require = require +local router = require("resty.radixtree") +local plugin = require("apisix.plugin") +local core = require("apisix.core") +local ipairs = ipairs + Review comment: it is fine 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: us...@infra.apache.org
[GitHub] [apisix-dashboard] membphis commented on issue #548: bug:enable openid-connect plugin without redirect_uri got 500 error
membphis commented on issue #548: URL: https://github.com/apache/apisix-dashboard/issues/548#issuecomment-706635768 @nic-chen need your help to confirm a mini case 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: us...@infra.apache.org
[apisix-dashboard] branch feat-upstream created (now 5c41a8a)
This is an automated email from the ASF dual-hosted git repository. sunyi pushed a change to branch feat-upstream in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. at 5c41a8a feat: update styles No new revisions were added by this update.
[GitHub] [apisix] membphis commented on issue #2382: bug: failed to load module 'apisix.ssl.router.radixtree_sni' not found
membphis commented on issue #2382: URL: https://github.com/apache/apisix/issues/2382#issuecomment-706629832 @spacewander do you have time to take a look at this issue? 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: us...@infra.apache.org
[apisix-dashboard] branch feat-upstream updated (8a5fa76 -> 5c41a8a)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch feat-upstream in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from 8a5fa76 feat: added license add 5c41a8a feat: update styles No new revisions were added by this update. Summary of changes: src/components/Upstream/UpstreamForm.tsx | 46 +++--- .../Route/components/Step2/RequestRewriteView.tsx | 2 +- 2 files changed, 15 insertions(+), 33 deletions(-)
[GitHub] [apisix-dashboard] LiteSun merged pull request #550: feat(Upstream): debug API
LiteSun merged pull request #550: URL: https://github.com/apache/apisix-dashboard/pull/550 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: us...@infra.apache.org
[apisix-dashboard] branch fe-refactor updated (d229be2 -> 871ace3)
This is an automated email from the ASF dual-hosted git repository. sunyi pushed a change to branch fe-refactor in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from d229be2 fix(Consumer): resolve conflicts add 871ace3 feat(Upstream): debug API (#550) No new revisions were added by this update. Summary of changes: src/components/Upstream/UpstreamForm.tsx | 600 ++ .../CreateStep4 => components/Upstream}/index.ts | 2 +- .../Route/components/Step2/RequestRewriteView.tsx | 2 +- src/pages/Upstream/Create.tsx | 33 +- src/pages/Upstream/components/Preview.tsx | 33 - src/pages/Upstream/components/Step1.tsx| 686 + src/pages/Upstream/service.ts | 8 +- src/pages/Upstream/transform.ts| 56 +- src/pages/Upstream/typing.d.ts | 26 +- 9 files changed, 658 insertions(+), 788 deletions(-) create mode 100644 src/components/Upstream/UpstreamForm.tsx copy src/{pages/Route/components/CreateStep4 => components/Upstream}/index.ts (95%) delete mode 100644 src/pages/Upstream/components/Preview.tsx
[GitHub] [apisix] membphis opened a new issue #2382: bug: failed to load module 'apisix.ssl.router.radixtree_sni' not found
membphis opened a new issue #2382: URL: https://github.com/apache/apisix/issues/2382 https://github.com/apache/apisix/runs/1235803490#step:6:228 ``` Usage: apisix [action] help: show this message, then exit init: initialize the local nginx.conf init_etcd: initialize the data of etcd start: start the apisix server stop: stop the apisix server restart:restart the apisix server reload: reload the apisix server version:print the version of apisix =found error log= Error: /10 15:54:44 [error] 21841#21841: init_worker_by_lua error: /usr/local/apisix//deps/share/lua/5.1/apisix/router.lua:83: module 'apisix.ssl.router.radixtree_sni' not found: no field package.preload['apisix.ssl.router.radixtree_sni'] no file '/usr/local/apisix//deps/share/lua/5.1/apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/apisix//deps/share/lua/5.1/apisix/ssl/router/radixtree_sni/init.lua' no file '/usr/local/apisix/apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/apisix/apisix/ssl/router/radixtree_sni/init.lua' no file '/usr/local/openresty-debug/site/lualib/apisix/ssl/router/radixtree_sni.ljbc' no file '/usr/local/openresty-debug/site/lualib/apisix/ssl/router/radixtree_sni/init.ljbc' no file '/usr/local/openresty-debug/lualib/apisix/ssl/router/radixtree_sni.ljbc' no file '/usr/local/openresty-debug/lualib/apisix/ssl/router/radixtree_sni/init.ljbc' no file '/usr/local/openresty-debug/site/lualib/apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/openresty-debug/site/lualib/apisix/ssl/router/radixtree_sni/init.lua' no file '/usr/local/openresty-debug/lualib/apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/openresty-debug/lualib/apisix/ssl/router/radixtree_sni/init.lua' no file './apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/openresty-debug/luajit/share/luajit-2.1.0-beta3/apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/share/lua/5.1/apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/share/lua/5.1/apisix/ssl/router/radixtree_sni/init.lua' no file '/usr/local/openresty-debug/luajit/share/lua/5.1/apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/openresty-debug/luajit/share/lua/5.1/apisix/ssl/router/radixtree_sni/init.lua' no file '/home/runner/.luarocks/share/lua/5.1/apisix/ssl/router/radixtree_sni.lua' no file '/home/runner/.luarocks/share/lua/5.1/apisix/ssl/router/radixtree_sni/init.lua' no file '/usr/share/lua/5.1/apisix/ssl/router/radixtree_sni.lua' no file '/usr/share/lua/5.1/apisix/ssl/router/radixtree_sni/init.lua' no file './apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/share/lua/5.1/apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/share/lua/5.1/apisix/ssl/router/radixtree_sni/init.lua' no file '/usr/local/lib/lua/5.1/apisix/ssl/router/radixtree_sni.lua' no file '/usr/local/lib/lua/5.1/apisix/ssl/router/radixtree_sni/init.lua' no file '/usr/local/apisix//deps/lib64/lua/5.1/apisix/ssl/router/radixtree_sni.so' no file '/usr/local/apisix//deps/lib/lua/5.1/apisix/ssl/router/radixtree_sni.so' no file '/usr/local/openresty-debug/site/lualib/apisix/ssl/router/radixtree_sni.so' no file '/usr/local/openresty-debug/lualib/apisix/ssl/router/radixtree_sni.so' no file './apisix/ssl/router/radixtree_sni.so' no file '/usr/local/lib/lua/5.1/apisix/ssl/router/radixtree_sni.so' no file '/usr/local/openresty-debug/luajit/lib/lua/5.1/apisix/ssl/router/radixtree_sni.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/home/runner/.luarocks/lib/lua/5.1/apisix/ssl/router/radixtree_sni.so' no file '/usr/lib/lua/5.1/apisix/ssl/router/radixtree_sni.so' no file './apisix/ssl/router/radixtree_sni.so' no file '/usr/local/lib/lua/5.1/apisix/ssl/router/radixtree_sni.so' no file '/usr/lib/x86_64-linux-gnu/lua/5.1/apisix/ssl/router/radixtree_sni.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/usr/local/apisix//deps/lib64/lua/5.1/apisix.so' no file '/usr/local/apisix//deps/lib/lua/5.1/apisix.so' no file '/usr/local/openresty-debug/site/lualib/apisix.so' no file '/usr/local/openresty-debug/lualib/apisix.so' no file './apisix.so' no file '/usr/local/lib/lua/5.1/apisix.so' no file '/usr/local/openresty-debug/luajit/lib/lua/5.1/apisix.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/home/runner/.luarocks/lib/lua/5.1/apisix.so' no file '/usr/lib/lua/5.1/apisix.so' no file './apisix.so' no file '/usr/local/lib/lua/5.1/apisix.so' no file '/usr/lib/x86_64-linux-gnu/lua/5.1/apisix.so' no file
[GitHub] [apisix] juzhiyuan commented on a change in pull request #2340: feature: limit-count use redis cluster
juzhiyuan commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502846095 ## File path: doc/plugins/limit-count.md ## @@ -39,11 +39,12 @@ Limit request rate by a fixed number of requests in a given time window. | time_window| integer | required | | [0,...] | the time window in seconds before the request count is reset. | | key| string | required | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] | the user specified key to limit the rate. | | rejected_code | integer | optional | 503 | [200,600] | The HTTP status code returned when the request exceeds the threshold is rejected, default 503. | -| policy | string | optional | "local" | ["local", "redis"] | The rate-limiting policies to use for retrieving and incrementing the limits. Available values are `local`(the counters will be stored locally in-memory on the node) and `redis`(counters are stored on a Redis server and will be shared across the nodes, usually used it to do the global speed limit). | +| policy | string | optional | "local" | ["local", "redis", "redis-cluster"] | The rate-limiting policies to use for retrieving and incrementing the limits. Available values are `local`(the counters will be stored locally in-memory on the node) and `redis`(counters are stored on a Redis server and will be shared across the nodes, usually used it to do the global speed limit). | Review comment: ![image](https://user-images.githubusercontent.com/2106987/95667420-62798e00-0b98-11eb-88e0-aa254b1e304b.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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502807932 ## File path: doc/plugins/limit-count.md ## @@ -109,6 +110,41 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335 }' ``` +If using redis-cluster: + +```shell +curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' +{ +"uri": "/index.html", +"plugins": { +"limit-count": { +"count": 2, +"time_window": 60, +"rejected_code": 503, +"key": "remote_addr", +"policy": "redis-cluster", +"redis_serv_list": [ + { Review comment: updated 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502807891 ## File path: apisix/plugins/limit-count/limit-count-redis-cluster.lua ## @@ -0,0 +1,127 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local rediscluster = require("resty.rediscluster") +local core = require("apisix.core") +local resty_lock = require("resty.lock") +local assert = assert +local error = error +local setmetatable = setmetatable +local tostring = tostring +local ipairs = ipairs + + +local _M = {version = 0.1} + + +local mt = { +__index = _M +} + +-- https://github.com/steve0511/resty-redis-cluster +local function new_redis_cluster(conf) +local config = { +name = "apisix-rediscluster", +serv_list = {}, +read_timeout = conf.redis_timeout, +auth = conf.redis_password +} + +for i, c in ipairs(conf.redis_serv_list) do +config.serv_list[i] = {ip = c.host, port = c.port} +end + +local red_cli = rediscluster:new(config) +if not red_cli then +error("connect to redis cluster fails") Review comment: updated 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502807866 ## File path: apisix/plugins/limit-count.lua ## @@ -70,11 +74,36 @@ local schema = { type = "string", minLength = 0, }, redis_timeout = { -type = "integer", minimum = 1, -default = 1000, +type = "integer", minimum = 1, default = 1000, }, }, required = {"redis_host"}, +}, +{ +properties = { +policy = { +enum = {"redis-cluster"}, +}, +redis_serv_list = { Review comment: updated to redis_cluster_nodes. 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2339: feature: breaker request by api
liuhengloveyou commented on a change in pull request #2339: URL: https://github.com/apache/apisix/pull/2339#discussion_r502807739 ## File path: apisix/plugins/api-breaker.lua ## @@ -0,0 +1,221 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local plugin_name = "api-breaker" +local ngx = ngx +local math = math +local ipairs = ipairs +local error = error +local core = require("apisix.core") + +local DEFAULT_EXPTIME = 300 -- TODO: user can config + +local shared_buffer = ngx.shared['plugin-'.. plugin_name] +if not shared_buffer then +error("failed to get ngx.shared dict when load plugin " .. plugin_name) +end + + +local schema = { +type = "object", +properties = { +unhealthy_response_code = { +type = "integer", +minimum = 200, +maximum = 599, +}, +unhealthy = { +type = "object", +properties = { +http_statuses = { +type = "array", +minItems = 1, +items = { +type = "integer", +minimum = 500, +maximum = 599, +}, +uniqueItems = true, +default = {500} +}, +failures = { +type = "integer", +minimum = 1, +default = 1, +} +} +}, +healthy = { +type = "object", +properties = { +http_statuses = { +type = "array", +minItems = 1, +items = { +type = "integer", +minimum = 200, +maximum = 499, +}, +uniqueItems = true, +default = {200, 206} +}, +successes = { +type = "integer", +minimum = 1, +default = 1, +} +} +} +}, +required = {"unhealthy_response_code", "unhealthy", "healthy"}, +} + + +local function is_unhealthy(unhealthy_status, upstream_status) +for _, unhealthy in ipairs(unhealthy_status) do +if unhealthy == upstream_status then +return true +end +end + +return false +end + + +local function is_healthy(healthy_status, upstream_status) +for _, healthy in ipairs(healthy_status) do +if healthy == upstream_status then +return true +end +end + +return false +end + Review comment: For the convenience of reading 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2339: feature: breaker request by api
liuhengloveyou commented on a change in pull request #2339: URL: https://github.com/apache/apisix/pull/2339#discussion_r502807481 ## File path: doc/plugins/api-breaker.md ## @@ -0,0 +1,106 @@ + + +- [中文](../zh-cn/plugins/api-blocker.md) + +# Summary + +- [**Name**](#name) +- [**Attributes**](#attributes) +- [**How To Enable**](#how-to-enable) +- [**Test Plugin**](#test-plugin) +- [**Disable Plugin**](#disable-plugin) + +## Name + +The plugin implements API fuse functionality to help us protect our upstream business services. + +About the breaker timeout logic; the current version does not open the relevant configuration items to the user, the code logic automatically **triggers the unhealthy state **incrementation of the number of operations. + +For example, if the upstream service returns `unhealthy.http_statuses` state and reaches `unhealthy.failures` for the first time, **the breaker will take 2 seconds**. Then, after 2 seconds, the upstream service returns `unhealthy.http_statuses` continuously again and reaches to `unhealthy.failures` a second time, **breaker for 4 seconds**. And so on, up to a maximum of 300 seconds is not increased. Review comment: added 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2339: feature: breaker request by api
liuhengloveyou commented on a change in pull request #2339: URL: https://github.com/apache/apisix/pull/2339#discussion_r502807538 ## File path: t/plugin/api-breaker.t ## @@ -0,0 +1,219 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +use t::APISIX 'no_plan'; + +$ENV{TEST_NGINX_HTML_DIR} ||= html_dir(); + +repeat_each(1); +no_long_string(); +no_shuffle(); +no_root_location(); +log_level('info'); +run_tests; + +__DATA__ + +=== TEST 1: sanity +--- config +location /t { +content_by_lua_block { +local plugin = require("apisix.plugins.api-breaker") +local ok, err = plugin.check_schema({ +unhealthy_response_code = 502, +unhealthy = { +http_statuses = {500}, +failures = 1, +}, +healthy = { +http_statuses = {200}, +successes = 1, +}, +}) +if not ok then +ngx.say(err) +end + +ngx.say("done") +} +} +--- request +GET /t +--- response_body +done +--- no_error_log +[error] + + +=== TEST 2: default http_statuses +--- config +location /t { +content_by_lua_block { +local plugin = require("apisix.plugins.api-breaker") +local ok, err = plugin.check_schema({ +unhealthy_response_code = 502, +unhealthy = { +failures = 1, +}, +healthy = { +successes = 1, +}, +}) +if not ok then +ngx.say(err) +end + +ngx.say("done") +} +} +--- request +GET /t +--- response_body +done +--- no_error_log +[error] + + +=== TEST 3: add plugin +--- config +location /t { +content_by_lua_block { +local t = require("lib.test_admin").test +local code, body = t('/apisix/admin/routes/1', +ngx.HTTP_PUT, +[[{ +"plugins": { +"api-breaker": { +"unhealthy_response_code": 502, +"unhealthy": { +"http_statuses": [500, 503], +"failures": 3 +}, +"healthy": { +"http_statuses": [200, 206], +"successes": 3 +} +} +}, +"upstream": { +"nodes": { +"127.0.0.1:1980": 1 +}, +"type": "roundrobin" +}, +"uri": "/api_breaker" +}]] +) + +if code >= 300 then +ngx.status = code +end +ngx.say(body) +} +} +--- request +GET /t +--- response_body +passed +--- no_error_log +[error] + + +=== TEST 4: trigger breaker +--- request eval +["GET /api_breaker?code=200", "GET /api_breaker?code=500", "GET /api_breaker?code=503", "GET /api_breaker?code=500", "GET /api_breaker?code=500", "GET /api_breaker?code=500"] +--- error_code eval +[200, 500, 503, 500, 502, 502] +--- no_error_log +[error] + + +=== TEST 5: trigger reset status +--- request eval +["GET /api_breaker?code=500", "GET /api_breaker?code=500", "GET /api_breaker?code=200", "GET /api_breaker?code=200", "GET /api_breaker?code=200", "GET /api_breaker?code=500", "GET /api_breaker?code=500"] +--- error_code eval +[500, 500, 200, 200, 200, 500, 500] +--- no_error_log +[error] + + +=== TEST 6: trigger del healthy numeration +--- request eval +["GET /api_breaker?code=500", "GET /api_breaker?code=200", "GET /api_breaker?code=500", "GET /api_breaker?code=500", "GET /api_breaker?code=500", "GET /api_breaker?code=500", "GET /api_breaker?code=500"] +--- error_code eval +[500, 200, 500, 500, 502, 502, 502] +--- no_error_log +[error] + + +=== TEST 7: add plugin with default config value +--- config +location /t { +
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2339: feature: breaker request by api
liuhengloveyou commented on a change in pull request #2339: URL: https://github.com/apache/apisix/pull/2339#discussion_r502807439 ## File path: apisix/plugins/api-breaker.lua ## @@ -0,0 +1,221 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local plugin_name = "api-breaker" +local ngx = ngx +local math = math +local ipairs = ipairs +local error = error +local core = require("apisix.core") + +local DEFAULT_EXPTIME = 300 -- TODO: user can config + +local shared_buffer = ngx.shared['plugin-'.. plugin_name] +if not shared_buffer then +error("failed to get ngx.shared dict when load plugin " .. plugin_name) +end + + +local schema = { +type = "object", +properties = { +unhealthy_response_code = { +type = "integer", +minimum = 200, +maximum = 599, +}, +unhealthy = { +type = "object", +properties = { +http_statuses = { +type = "array", +minItems = 1, +items = { +type = "integer", +minimum = 500, +maximum = 599, +}, +uniqueItems = true, +default = {500} +}, +failures = { +type = "integer", +minimum = 1, +default = 1, Review comment: updated to 3 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502805118 ## File path: doc/plugins/limit-count.md ## @@ -39,11 +39,12 @@ Limit request rate by a fixed number of requests in a given time window. | time_window| integer | required | | [0,...] | the time window in seconds before the request count is reset. | | key| string | required | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] | the user specified key to limit the rate. | | rejected_code | integer | optional | 503 | [200,600] | The HTTP status code returned when the request exceeds the threshold is rejected, default 503. | -| policy | string | optional | "local" | ["local", "redis"] | The rate-limiting policies to use for retrieving and incrementing the limits. Available values are `local`(the counters will be stored locally in-memory on the node) and `redis`(counters are stored on a Redis server and will be shared across the nodes, usually used it to do the global speed limit). | +| policy | string | optional | "local" | ["local", "redis", "redis-cluster"] | The rate-limiting policies to use for retrieving and incrementing the limits. Available values are `local`(the counters will be stored locally in-memory on the node) and `redis`(counters are stored on a Redis server and will be shared across the nodes, usually used it to do the global speed limit). | Review comment: where? 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502804881 ## File path: apisix/plugins/limit-count.lua ## @@ -70,11 +74,29 @@ local schema = { type = "string", minLength = 0, }, redis_timeout = { -type = "integer", minimum = 1, -default = 1000, +type = "integer", minimum = 1, default = 1000, }, }, required = {"redis_host"}, +}, +{ +properties = { +policy = { +enum = {"redis-cluster"}, +}, +redis_cluster_nodes = { +type = "array", +minItems = 2, +items = {type = "string", minLength = 2, maxLength = 100}, Review comment: updated 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502804539 ## File path: doc/zh-cn/plugins/limit-count.md ## @@ -26,17 +26,18 @@ ## 参数 -| 名称 | 类型| 必选项 | 默认值 | 有效值 | 描述 | -| -- | --- | | --- | | --- | -| count | integer | 必须 | | [0,...] | 指定时间窗口内的请求数量阈值 | -| time_window| integer | 必须 | | [0,...] | 时间窗口的大小(以秒为单位),超过这个时间就会重置 | -| key| string | 必须 | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] | 用来做请求计数的依据 | -| rejected_code | integer | 可选 | 503 | [200,600] | 当请求超过阈值被拒绝时,返回的 HTTP 状态码 | -| policy | string | 可选 | "local" | ["local", "redis"] | 用于检索和增加限制的速率限制策略。可选的值有:`local`(计数器被以内存方式保存在节点本地,默认选项) 和 `redis`(计数器保存在 Redis 服务节点上,从而可以跨节点共享结果,通常用它来完成全局限速) | -| redis_host | string | `redis` 必须 | | | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的地址。 | -| redis_port | integer | 可选 | 6379| [1,...] | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的端口 | -| redis_password | string | 可选 | | | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的密码。 | -| redis_timeout | integer | 可选 | 1000| [1,...] | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点以毫秒为单位的超时时间 | +| 名称| 类型 | 必选项 | 默认值 | 有效值 | 描述 | +| --- | | | --- | | | +| count | integer | 必须 | | [0,...] | 指定时间窗口内的请求数量阈值 | +| time_window | integer | 必须 | | [0,...] | 时间窗口的大小(以秒为单位),超过这个时间就会重置 | +| key | string | 必须 | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] | 用来做请求计数的依据 | +| rejected_code | integer | 可选 | 503 | [200,600] | 当请求超过阈值被拒绝时,返回的 HTTP 状态码 | Review comment: Should be formatted by the editor, the content has not changed. 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502804384 ## File path: doc/plugins/limit-count.md ## @@ -39,11 +39,12 @@ Limit request rate by a fixed number of requests in a given time window. | time_window| integer | required | | [0,...] | the time window in seconds before the request count is reset. | | key| string | required | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] | the user specified key to limit the rate. | | rejected_code | integer | optional | 503 | [200,600] | The HTTP status code returned when the request exceeds the threshold is rejected, default 503. | -| policy | string | optional | "local" | ["local", "redis"] | The rate-limiting policies to use for retrieving and incrementing the limits. Available values are `local`(the counters will be stored locally in-memory on the node) and `redis`(counters are stored on a Redis server and will be shared across the nodes, usually used it to do the global speed limit). | +| policy | string | optional | "local" | ["local", "redis", "redis-cluster"] | The rate-limiting policies to use for retrieving and incrementing the limits. Available values are `local`(the counters will be stored locally in-memory on the node) and `redis`(counters are stored on a Redis server and will be shared across the nodes, usually used it to do the global speed limit). | | redis_host | string | required for `redis` | | | When using the `redis` policy, this property specifies the address of the Redis server. | | redis_port | integer | optional | 6379| [1,...] | When using the `redis` policy, this property specifies the port of the Redis server. | | redis_password | string | optional | | | When using the `redis` policy, this property specifies the password of the Redis server. | | redis_timeout | integer | optional | 1000| [1,...] | When using the `redis` policy, this property specifies the timeout in milliseconds of any command submitted to the Redis server. | +| redis_serv_list | array | optional | | | When using `redis-cluster` policy,This property is a list of addresses of Redis cluster service nodes. | Review comment: thand you. 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: us...@infra.apache.org
[apisix] branch master updated: bugfix: check every etcd version, rather than only check the first one (#2380)
This is an automated email from the ASF dual-hosted git repository. wenming pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 647d8d9 bugfix: check every etcd version, rather than only check the first one (#2380) 647d8d9 is described below commit 647d8d9a62668aa066775ce2a3dc4c32a9c03209 Author: RocFang AuthorDate: Sat Oct 10 23:53:10 2020 +0800 bugfix: check every etcd version, rather than only check the first one (#2380) --- bin/apisix | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/apisix b/bin/apisix index 32519a6..b37caf4 100755 --- a/bin/apisix +++ b/bin/apisix @@ -1012,8 +1012,6 @@ local function init_etcd(show_output) ", please upgrade your etcd cluster\n") os.exit(1) end - -break end local etcd_ok = false
[GitHub] [apisix] moonming merged pull request #2380: bugfix: check every etcd version, rather than only check the first one
moonming merged pull request #2380: URL: https://github.com/apache/apisix/pull/2380 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: us...@infra.apache.org
[GitHub] [apisix] spacewander opened a new issue #2381: Proposal: sync plugin/plugin attr to node
spacewander opened a new issue #2381: URL: https://github.com/apache/apisix/issues/2381 Targets: 1. make plugins hot load work on node 2. allow user to configure plugin attributes from admin 3. allow adding intercepts like IP-restriction to plugins' route Steps: 1. change plugin syntax in config*.yml to: ```yaml - name: pluginA attrs: a: b - name: pluginB ... ``` 2. sync `plugin` to node, and enable hot reload 3. sync `plugin attr` to node 4. add IP-restriction as a common intercept to plugins' route 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: us...@infra.apache.org
[GitHub] [apisix] spacewander merged pull request #2367: change: refactor router
spacewander merged pull request #2367: URL: https://github.com/apache/apisix/pull/2367 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: us...@infra.apache.org
[apisix] branch master updated: change: refactor router (#2367)
This is an automated email from the ASF dual-hosted git repository. spacewander pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new ac38c29 change: refactor router (#2367) ac38c29 is described below commit ac38c299b4162c6a68a12925d2f3707effc006be Author: 罗泽轩 AuthorDate: Sat Oct 10 23:43:00 2020 +0800 change: refactor router (#2367) 1. rename http/router/radixtree_sni -> ssl/router/radixtree_sni 2. extract API router out from the host/uri router so that we can hide the implementation details and reduce duplicate code. --- apisix/api_router.lua | 76 +++ apisix/http/router/radixtree_host_uri.lua | 21 +--- apisix/http/router/radixtree_uri.lua | 19 +-- apisix/init.lua | 12 +++-- apisix/plugin.lua | 39 -- apisix/router.lua | 4 +- apisix/{http => ssl}/router/radixtree_sni.lua | 0 7 files changed, 89 insertions(+), 82 deletions(-) diff --git a/apisix/api_router.lua b/apisix/api_router.lua new file mode 100644 index 000..b18e823 --- /dev/null +++ b/apisix/api_router.lua @@ -0,0 +1,76 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local require = require +local router = require("resty.radixtree") +local plugin = require("apisix.plugin") +local core = require("apisix.core") +local ipairs = ipairs + + +local _M = {} +local match_opts = {} + + +local fetch_api_router +do +local routes = {} +function fetch_api_router() +core.table.clear(routes) + +for _, plugin in ipairs(plugin.plugins) do +local api_fun = plugin.api +if api_fun then +local api_routes = api_fun() +core.log.debug("fetched api routes: ", + core.json.delay_encode(api_routes, true)) +for _, route in ipairs(api_routes) do +core.table.insert(routes, { +methods = route.methods, +paths = route.uri, +handler = function (...) +local code, body = route.handler(...) +if code or body then +core.response.exit(code, body) +end +end +}) +end +end +end + +return router.new(routes) +end + +end -- do + + +function _M.match(api_ctx) +local api_router = core.lrucache.global("api_router", plugin.load_times, fetch_api_router) +if not api_router then +core.log.error("failed to fetch valid api router") +return false +end + +core.table.clear(match_opts) +match_opts.method = api_ctx.var.request_method + +local ok = api_router:dispatch(api_ctx.var.uri, match_opts, api_ctx) +return ok +end + + +return _M diff --git a/apisix/http/router/radixtree_host_uri.lua b/apisix/http/router/radixtree_host_uri.lua index 8b2841c..ab3ad15 100644 --- a/apisix/http/router/radixtree_host_uri.lua +++ b/apisix/http/router/radixtree_host_uri.lua @@ -17,7 +17,6 @@ local require = require local router = require("resty.radixtree") local core = require("apisix.core") -local plugin = require("apisix.plugin") local ipairs = ipairs local type = type local error = error @@ -113,19 +112,6 @@ local function create_radixtree_router(routes) end -- create router: only_uri_router -local api_routes = plugin.api_routes() -core.log.info("api_routes", core.json.delay_encode(api_routes, true)) - -for _, route in ipairs(api_routes) do -if type(route) == "table" then -core.table.insert(only_uri_routes, { -paths = route.uris or route.uri, -handler = route.handler, -method = route.methods, -}) -end -end - only_uri_router = router.new(only_uri_routes) return true end @@ -153,12 +139,7 @@ function _M.match(api_ctx) end local ok = only_uri_router:dispatch(api_ctx.var.uri, match_opts, api_ctx) -
[GitHub] [apisix] spacewander closed issue #2223: chore: the title of the `basic-auth` JSONSchema is wrong.
spacewander closed issue #2223: URL: https://github.com/apache/apisix/issues/2223 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: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #2223: chore: the title of the `basic-auth` JSONSchema is wrong.
spacewander commented on issue #2223: URL: https://github.com/apache/apisix/issues/2223#issuecomment-706567329 Solved. 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: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #2310: bug: failed to match any routes
spacewander closed issue #2310: URL: https://github.com/apache/apisix/issues/2310 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: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #2310: bug: failed to match any routes
spacewander commented on issue #2310: URL: https://github.com/apache/apisix/issues/2310#issuecomment-706566963 Look like it is fixed by #2312. 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: us...@infra.apache.org
[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #550: feat(Upstream): debug API
LiteSun commented on a change in pull request #550: URL: https://github.com/apache/apisix-dashboard/pull/550#discussion_r502800765 ## File path: src/components/Upstream/UpstreamForm.tsx ## @@ -0,0 +1,602 @@ +import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; +import { Button, Col, Divider, Form, Input, InputNumber, Row, Select, Switch } from 'antd'; +import React, { useEffect, useState } from 'react'; +import { useIntl } from 'umi'; +import type { FormInstance } from 'antd/lib/form'; + +import { PanelSection } from '@api7-dashboard/ui'; + +enum Type { + roundrobin = 'roundrobin', + chash = 'chash', +} + +enum HashOn { + vars = 'vars', + header = 'header', + cookie = 'cookie', + consumer = 'consumer', +} + +enum HashKey { + remote_addr = 'remote_addr', + host = 'host', + uri = 'uri', + server_name = 'server_name', + server_addr = 'server_addr', + request_uri = 'request_uri', + query_string = 'query_string', + remote_port = 'remote_port', + hostname = 'hostname', + arg_id = 'arg_id', +} + +type Upstream = {}; + +type Props = { + form: FormInstance; + upstream?: Upstream; + id?: string; +}; + +const timeoutFields = [ + { +label: '连接超时', +name: ['timeout', 'connect'], + }, + { +label: '发送超时', +name: ['timeout', 'send'], + }, + { +label: '接收超时', +name: ['timeout', 'read'], + }, +]; + +const UpstreamForm: React.FC = ({ form, id }) => { + const [readonly] = useState(false); + const { formatMessage } = useIntl(); + + useEffect(() => { +// TODO: 获取 upstream 列表 + }, []); + + useEffect(() => { +if (id) { + // TODO: 获取 upstream、设置 readonly、填充数据 +} + }, [id]); + + const CHash = () => ( +<> + + + {Object.entries(HashOn).map(([label, value]) => ( + + {label} + + ))} + + + + + {Object.entries(HashKey).map(([label, value]) => ( + + {label} + + ))} + + + + ); + + const TimeUnit = () => ms; + const NodeList = () => ( + + {(fields, { add, remove }) => ( +<> + {fields.map((field, index) => ( + + + + + + + + + + + + + + + + + + + {!readonly && fields.length > 1 && ( + remove(field.name)} /> + )} + + + + ))} + {!readonly && ( + + + +创建节点 + + + )} + + )} + + ); + + const ActiveHealthCheck = () => ( +<> + + + + +s + + + + + + + + + + + + + +健康状态 + + + + + + + + + + + + + +不健康状态 + + + + + + + + + + + + +{(fields, { add, remove }) => ( + <> +{fields.map((field, index) => ( + + Review comment: should use the same code style.`marginBottom: 10` ## File path: src/components/Upstream/UpstreamForm.tsx ## @@ -0,0 +1,602 @@ +import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; +import { Button, Col, Divider, Form, Input, InputNumber, Row, Select, Switch } from 'antd'; +import React, { useEffect, useState } from 'react'; +import { useIntl } from 'umi'; +import type { FormInstance } from 'antd/lib/form'; + +import { PanelSection } from '@api7-dashboard/ui'; + +enum Type { + roundrobin = 'roundrobin', + chash = 'chash', +} + +enum HashOn { + vars = 'vars', + header = 'header', + cookie = 'cookie', + consumer = 'consumer', +} + +enum HashKey { + remote_addr = 'remote_addr', + host = 'host', + uri = 'uri', + server_name = 'server_name', + server_addr = 'server_addr', + request_uri = 'request_uri', + query_string = 'query_string', + remote_port = 'remote_port', + hostname = 'hostname', + arg_id = 'arg_id', +} + +type Upstream = {}; + +type Props = { + form: FormInstance; + upstream?: Upstream; + id?: string; +}; + +const timeoutFields = [ + { +label: '连接超时', +name: ['timeout', 'connect'], + }, + { +label: '发送超时', +name: ['timeout', 'send'], + }, + { +label: '接收超时', +name: ['timeout', 'read'], + }, +]; + +const UpstreamForm: React.FC = ({ form, id }) => { + const [readonly] = useState(false); + const { formatMessage } = useIntl(); + +
[apisix-dashboard] branch feat-upstream updated (d274033 -> 8a5fa76)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch feat-upstream in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from d274033 feat(Upstream): debug api add 2f936fe feat: added license add 8a5fa76 feat: added license No new revisions were added by this update. Summary of changes: src/components/Upstream/UpstreamForm.tsx | 16 src/components/Upstream/index.ts | 16 2 files changed, 32 insertions(+)
[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #550: feat(Upstream): debug API
juzhiyuan commented on pull request #550: URL: https://github.com/apache/apisix-dashboard/pull/550#issuecomment-706565152 @LiteSun Just ignore those checks above for this branch's API test cases are outdated, we just make sure the final PR which will be merged into master should pass all checks. 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: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on issue #533: Put bundled frontend files in Go
juzhiyuan commented on issue #533: URL: https://github.com/apache/apisix-dashboard/issues/533#issuecomment-706564800 @bzp2010 is working on this cc @nic-chen @ShiningRush 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: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on issue #537: bug: respond status of api should keep same as `admin api` do
juzhiyuan commented on issue #537: URL: https://github.com/apache/apisix-dashboard/issues/537#issuecomment-706563608 After discussions, the frontend will use the Logic Code instead of standard HTTP Status code to check if this request is successful. 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: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan closed issue #537: bug: respond status of api should keep same as `admin api` do
juzhiyuan closed issue #537: URL: https://github.com/apache/apisix-dashboard/issues/537 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: us...@infra.apache.org
[GitHub] [apisix] juzhiyuan commented on a change in pull request #2340: feature: limit-count use redis cluster
juzhiyuan commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502799124 ## File path: apisix/plugins/limit-count.lua ## @@ -70,11 +74,29 @@ local schema = { type = "string", minLength = 0, }, redis_timeout = { -type = "integer", minimum = 1, -default = 1000, +type = "integer", minimum = 1, default = 1000, }, }, required = {"redis_host"}, +}, +{ +properties = { +policy = { +enum = {"redis-cluster"}, +}, +redis_cluster_nodes = { +type = "array", +minItems = 2, +items = {type = "string", minLength = 2, maxLength = 100}, Review comment: Looks like we need format those codes to have a uniform code style? ## File path: apisix/plugins/limit-count.lua ## @@ -70,11 +74,29 @@ local schema = { type = "string", minLength = 0, }, redis_timeout = { -type = "integer", minimum = 1, -default = 1000, +type = "integer", minimum = 1, default = 1000, }, }, required = {"redis_host"}, +}, +{ +properties = { +policy = { +enum = {"redis-cluster"}, Review comment: @liuhengloveyou Because this plugin would be shown by UI components on the frontend, could you please have a test on this site[1] using this new schema? or could you please provide the full JSON Schema for this plugin then paste here? I could have a try myself. [1] https://rjsf-team.github.io/react-jsonschema-form/ ## File path: apisix/plugins/limit-count/limit-count-redis-cluster.lua ## @@ -0,0 +1,141 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local rediscluster = require("resty.rediscluster") +local core = require("apisix.core") +local resty_lock = require("resty.lock") +local assert = assert +local error = error +local setmetatable = setmetatable +local tostring = tostring +local ipairs = ipairs + +local _M = {} + +local mt = { +__index = _M +} + + +local function split(inputstr, sep) +if sep == nil then + sep = "%s" +end + +local t={} +for str in string.gmatch(inputstr, "([^"..sep.."]+)") do + table.insert(t, str) +end + +return t + end + + +-- https://github.com/steve0511/resty-redis-cluster +local function new_redis_cluster(conf) +local config = { +name = "apisix-rediscluster", +serv_list = {}, +read_timeout = conf.redis_timeout, +auth = conf.redis_password +} + +for i, conf_item in ipairs(conf.redis_cluster_nodes) do +local ip, port = split(conf_item, ":") +config.serv_list[i] = {ip = ip, port = port} +end + +local red_cli = rediscluster:new(config) +if not red_cli then +error("limit-count-redis: connect to redis cluster fails") Review comment: failed ## File path: apisix/plugins/limit-count/limit-count-redis-cluster.lua ## @@ -0,0 +1,141 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed
[GitHub] [apisix] moonming edited a comment on issue #2377: bug:Use zipkin plugin and limit-req plugin together, zipkin plugin can not work when is limit
moonming edited a comment on issue #2377: URL: https://github.com/apache/apisix/issues/2377#issuecomment-706562402 I think if API has been limited, because of the priority, apisix should not run the zipkin 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] moonming commented on issue #2377: bug:Use zipkin plugin and limit-req plugin together, zipkin plugin can not work when is limit
moonming commented on issue #2377: URL: https://github.com/apache/apisix/issues/2377#issuecomment-706562402 I think if APIhas been limited, because of the priority, apisix should not run the zipkin 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2339: feature: breaker request by api
membphis commented on a change in pull request #2339: URL: https://github.com/apache/apisix/pull/2339#discussion_r502797834 ## File path: t/plugin/api-breaker.t ## @@ -0,0 +1,358 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +use t::APISIX 'no_plan'; + +repeat_each(1); +no_long_string(); +no_shuffle(); +no_root_location(); +log_level('info'); +run_tests; + +__DATA__ + +=== TEST 1: sanity +--- config +location /t { +content_by_lua_block { +local plugin = require("apisix.plugins.api-breaker") +local ok, err = plugin.check_schema({ +unhealthy_response_code = 502, +unhealthy = { +http_statuses = {500}, +failures = 1, +}, +healthy = { +http_statuses = {200}, +successes = 1, +}, +}) +if not ok then +ngx.say(err) +end + +ngx.say("done") +} +} +--- request +GET /t +--- response_body +done +--- no_error_log +[error] + + + +=== TEST 2: default http_statuses +--- config +location /t { +content_by_lua_block { +local plugin = require("apisix.plugins.api-breaker") +local ok, err = plugin.check_schema({ +unhealthy_response_code = 502, +unhealthy = { +failures = 1, +}, +healthy = { +successes = 1, +}, +}) +if not ok then +ngx.say(err) +end + +ngx.say("done") +} +} +--- request +GET /t +--- response_body +done +--- no_error_log +[error] + + + +=== TEST 3: add plugin +--- config +location /t { +content_by_lua_block { +local t = require("lib.test_admin").test +local code, body = t('/apisix/admin/routes/1', +ngx.HTTP_PUT, +[[{ +"plugins": { +"api-breaker": { +"unhealthy_response_code": 502, +"unhealthy": { +"http_statuses": [500, 503], +"failures": 3 +}, +"healthy": { +"http_statuses": [200, 206], +"successes": 3 +} +} +}, +"upstream": { +"nodes": { +"127.0.0.1:1980": 1 +}, +"type": "roundrobin" +}, +"uri": "/api_breaker" +}]] +) + +if code >= 300 then +ngx.status = code +end +ngx.say(body) +} +} +--- request +GET /t +--- response_body +passed +--- no_error_log +[error] + + + +=== TEST 4: trigger breaker +--- request eval +["GET /api_breaker?code=200", "GET /api_breaker?code=500", "GET /api_breaker?code=503", "GET /api_breaker?code=500", "GET /api_breaker?code=500", "GET /api_breaker?code=500"] +--- error_code eval +[200, 500, 503, 500, 502, 502] +--- no_error_log +[error] + + + +=== TEST 5: trigger reset status +--- request eval +["GET /api_breaker?code=500", "GET /api_breaker?code=500", "GET /api_breaker?code=200", "GET /api_breaker?code=200", "GET /api_breaker?code=200", "GET /api_breaker?code=500", "GET /api_breaker?code=500"] +--- error_code eval +[500, 500, 200, 200, 200, 500, 500] +--- no_error_log +[error] + + + +=== TEST 6: trigger del healthy numeration +--- request eval +["GET /api_breaker?code=500", "GET /api_breaker?code=200", "GET /api_breaker?code=500", "GET /api_breaker?code=500", "GET /api_breaker?code=500", "GET /api_breaker?code=500", "GET /api_breaker?code=500"] +--- error_code eval +[500, 200, 500, 500, 502, 502, 502] +--- no_error_log +[error] + + + +=== TEST 7: add plugin with default config value +--- config +location /t { +content_by_lua_block { +
[GitHub] [apisix] juzhiyuan commented on a change in pull request #2367: change: refactor router
juzhiyuan commented on a change in pull request #2367: URL: https://github.com/apache/apisix/pull/2367#discussion_r502795981 ## File path: apisix/api_router.lua ## @@ -0,0 +1,76 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local require = require +local router = require("resty.radixtree") +local plugin = require("apisix.plugin") +local core = require("apisix.core") +local ipairs = ipairs + Review comment: Not sure if we need 2 empty lines here, but looks good to me anyway 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: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2340: feature: limit-count use redis cluster
membphis commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502795882 ## File path: rockspec/apisix-master-0.rockspec ## @@ -54,6 +54,7 @@ dependencies = { "skywalking-nginx-lua-plugin = 1.0-0", "base64 = 1.5-2", "dkjson = 2.5-2", +"resty-redis-cluster = 1.02-4", Review comment: https://luarocks.org/modules/steve0511/resty-redis-cluster 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: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on issue #548: bug:enable openid-connect plugin without redirect_uri got 500 error
juzhiyuan commented on issue #548: URL: https://github.com/apache/apisix-dashboard/issues/548#issuecomment-706555989 Here is the doc for openid-connect, cc @membphis https://github.com/apache/apisix/blob/master/doc/plugins/openid-connect.md 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: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan closed issue #549: 同步etcd和mysql配置的功能在开发吗?
juzhiyuan closed issue #549: URL: https://github.com/apache/apisix-dashboard/issues/549 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: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on issue #549: 同步etcd和mysql配置的功能在开发吗?
juzhiyuan commented on issue #549: URL: https://github.com/apache/apisix-dashboard/issues/549#issuecomment-706555660 MySQL would be deprecated in 1.6 https://github.com/apache/apisix-dashboard/milestone/4 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: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2340: feature: limit-count use redis cluster
membphis commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502794290 ## File path: rockspec/apisix-master-0.rockspec ## @@ -54,6 +54,7 @@ dependencies = { "skywalking-nginx-lua-plugin = 1.0-0", "base64 = 1.5-2", "dkjson = 2.5-2", +"resty-redis-cluster = 1.02-4", Review comment: it is the right 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] RocFang opened a new pull request #2380: bugfix: check every etcd version, rather than only check the first one
RocFang opened a new pull request #2380: URL: https://github.com/apache/apisix/pull/2380 ### What this PR does / why we need it: IMHO, the operation of "check the etcd cluster version" should check every etcd version in the yaml_conf.etcd.host list. But the `break` make it only check the first one. ### Pre-submission checklist: * [x] Did you explain what problem does this PR solve? Or what new features have been added? * [ ] Have you added corresponding test cases? * [ ] Have you modified the corresponding document? * [x] Is this PR backward compatible? 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: us...@infra.apache.org
[GitHub] [apisix] moonming commented on a change in pull request #2340: feature: limit-count use redis cluster
moonming commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502789923 ## File path: apisix/plugins/limit-count.lua ## @@ -70,11 +74,36 @@ local schema = { type = "string", minLength = 0, }, redis_timeout = { -type = "integer", minimum = 1, -default = 1000, +type = "integer", minimum = 1, default = 1000, }, }, required = {"redis_host"}, +}, +{ +properties = { +policy = { +enum = {"redis-cluster"}, +}, +redis_serv_list = { Review comment: `redis_serv_list` is not a good name, how about `nodes`? ## File path: apisix/plugins/limit-count.lua ## @@ -119,6 +148,11 @@ local function create_limit_obj(conf) conf.count, conf.time_window, conf) end +if conf.policy == "redis-cluster" then +return limit_redis_cluster_new("plugin-" .. plugin_name,conf.count, Review comment: Add a space after `,` ## File path: doc/zh-cn/plugins/limit-count.md ## @@ -26,17 +26,18 @@ ## 参数 -| 名称 | 类型| 必选项 | 默认值 | 有效值 | 描述 | -| -- | --- | | --- | | --- | -| count | integer | 必须 | | [0,...] | 指定时间窗口内的请求数量阈值 | -| time_window| integer | 必须 | | [0,...] | 时间窗口的大小(以秒为单位),超过这个时间就会重置 | -| key| string | 必须 | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] | 用来做请求计数的依据 | -| rejected_code | integer | 可选 | 503 | [200,600] | 当请求超过阈值被拒绝时,返回的 HTTP 状态码 | -| policy | string | 可选 | "local" | ["local", "redis"] | 用于检索和增加限制的速率限制策略。可选的值有:`local`(计数器被以内存方式保存在节点本地,默认选项) 和 `redis`(计数器保存在 Redis 服务节点上,从而可以跨节点共享结果,通常用它来完成全局限速) | -| redis_host | string | `redis` 必须 | | | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的地址。 | -| redis_port | integer | 可选 | 6379| [1,...] | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的端口 | -| redis_password | string | 可选 | | | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的密码。 | -| redis_timeout | integer | 可选 | 1000| [1,...] | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点以毫秒为单位的超时时间 | +| 名称| 类型 | 必选项 | 默认值 | 有效值 | 描述 | +| --- | | | --- |
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502789411 ## File path: doc/zh-cn/plugins/limit-count.md ## @@ -26,17 +26,18 @@ ## 参数 -| 名称 | 类型| 必选项 | 默认值 | 有效值 | 描述 | -| -- | --- | | --- | | --- | -| count | integer | 必须 | | [0,...] | 指定时间窗口内的请求数量阈值 | -| time_window| integer | 必须 | | [0,...] | 时间窗口的大小(以秒为单位),超过这个时间就会重置 | -| key| string | 必须 | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] | 用来做请求计数的依据 | -| rejected_code | integer | 可选 | 503 | [200,600] | 当请求超过阈值被拒绝时,返回的 HTTP 状态码 | -| policy | string | 可选 | "local" | ["local", "redis"] | 用于检索和增加限制的速率限制策略。可选的值有:`local`(计数器被以内存方式保存在节点本地,默认选项) 和 `redis`(计数器保存在 Redis 服务节点上,从而可以跨节点共享结果,通常用它来完成全局限速) | -| redis_host | string | `redis` 必须 | | | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的地址。 | -| redis_port | integer | 可选 | 6379| [1,...] | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的端口 | -| redis_password | string | 可选 | | | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的密码。 | -| redis_timeout | integer | 可选 | 1000| [1,...] | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点以毫秒为单位的超时时间 | +| 名称| 类型 | 必选项 | 默认值 | 有效值 | 描述 | +| --- | | | --- | | | +| count | integer | 必须 | | [0,...] | 指定时间窗口内的请求数量阈值 | +| time_window | integer | 必须 | | [0,...] | 时间窗口的大小(以秒为单位),超过这个时间就会重置 | +| key | string | 必须 | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] | 用来做请求计数的依据 | +| rejected_code | integer | 可选 | 503 | [200,600] | 当请求超过阈值被拒绝时,返回的 HTTP 状态码 | +| policy | string | 可选 | "local" | ["local", "redis", "redis-cluster"] | 用于检索和增加限制的速率限制策略。可选的值有:`local`(计数器被以内存方式保存在节点本地,默认选项) 和 `redis`(计数器保存在 Redis 服务节点上,从而可以跨节点共享结果,通常用它来完成全局限速);以及`redis-cluster`,跟redis功能一样,只是使用redis集群方式。 | +| redis_host | string | `redis` 必须 | | | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的地址。 | +| redis_port
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502789195 ## File path: apisix/plugins/limit-count/limit-count-redis-cluster.lua ## @@ -0,0 +1,127 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local rediscluster = require("resty.rediscluster") +local core = require("apisix.core") +local resty_lock = require("resty.lock") +local assert = assert +local error = error +local setmetatable = setmetatable +local tostring = tostring +local ipairs = ipairs + + +local _M = {version = 0.1} + + +local mt = { +__index = _M +} + +-- https://github.com/steve0511/resty-redis-cluster +local function new_redis_cluster(conf) +local config = { +name = "apisix-rediscluster", +serv_list = {}, +read_timeout = conf.redis_timeout, +auth = conf.redis_password +} + +for i, c in ipairs(conf.redis_serv_list) do +config.serv_list[i] = {ip = c.host, port = c.port} +end + +local red_cli = rediscluster:new(config) +if not red_cli then +error("connect to redis cluster fails") Review comment: updated 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: us...@infra.apache.org
[GitHub] [apisix] membphis commented on pull request #2340: feature: limit-count use redis cluster
membphis commented on pull request #2340: URL: https://github.com/apache/apisix/pull/2340#issuecomment-706545779 @liuhengloveyou no test case? 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: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2340: feature: limit-count use redis cluster
membphis commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502787623 ## File path: apisix/plugins/limit-count/limit-count-redis-cluster.lua ## @@ -0,0 +1,127 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local rediscluster = require("resty.rediscluster") +local core = require("apisix.core") +local resty_lock = require("resty.lock") +local assert = assert +local error = error +local setmetatable = setmetatable +local tostring = tostring +local ipairs = ipairs + + +local _M = {version = 0.1} Review comment: this version is useless, we can remove it ## File path: apisix/plugins/limit-count.lua ## @@ -119,6 +148,11 @@ local function create_limit_obj(conf) conf.count, conf.time_window, conf) end +if conf.policy == "redis-cluster" then +return limit_redis_cluster_new("plugin-" .. plugin_name,conf.count, Review comment: style: need a space between different argument items ## File path: apisix/plugins/limit-count/limit-count-redis-cluster.lua ## @@ -0,0 +1,127 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local rediscluster = require("resty.rediscluster") +local core = require("apisix.core") +local resty_lock = require("resty.lock") +local assert = assert +local error = error +local setmetatable = setmetatable +local tostring = tostring +local ipairs = ipairs + + +local _M = {version = 0.1} + + +local mt = { +__index = _M +} + +-- https://github.com/steve0511/resty-redis-cluster +local function new_redis_cluster(conf) +local config = { +name = "apisix-rediscluster", +serv_list = {}, +read_timeout = conf.redis_timeout, +auth = conf.redis_password +} + +for i, c in ipairs(conf.redis_serv_list) do +config.serv_list[i] = {ip = c.host, port = c.port} +end + +local red_cli = rediscluster:new(config) +if not red_cli then +error("connect to redis cluster fails") Review comment: Please confirm if we can capture more error messages ## File path: doc/zh-cn/plugins/limit-count.md ## @@ -26,17 +26,18 @@ ## 参数 -| 名称 | 类型| 必选项 | 默认值 | 有效值 | 描述 | -| -- | --- | | --- | | --- | -| count | integer | 必须 | | [0,...] | 指定时间窗口内的请求数量阈值 | -| time_window| integer | 必须 | | [0,...] | 时间窗口的大小(以秒为单位),超过这个时间就会重置 | -|
[GitHub] [apisix] membphis merged pull request #2376: fix: wget -O always leave a file enven though download fail
membphis merged pull request #2376: URL: https://github.com/apache/apisix/pull/2376 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: us...@infra.apache.org
[apisix] branch master updated: fix: wget -O always leave a file enven though download fail (#2376)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new f05cba0 fix: wget -O always leave a file enven though download fail (#2376) f05cba0 is described below commit f05cba014524b89cf3e712a5410933741944ab3a Author: RocFang AuthorDate: Sat Oct 10 20:49:14 2020 +0800 fix: wget -O always leave a file enven though download fail (#2376) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 665271e..cd80123 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ endif .PHONY: utils utils: ifeq ("$(wildcard utils/lj-releng)", "") - wget -O utils/lj-releng https://raw.githubusercontent.com/iresty/openresty-devel-utils/master/lj-releng + wget -P utils https://raw.githubusercontent.com/iresty/openresty-devel-utils/master/lj-releng chmod a+x utils/lj-releng endif
[GitHub] [apisix] spacewander opened a new issue #2379: missing doc for plugin `node-status`
spacewander opened a new issue #2379: URL: https://github.com/apache/apisix/issues/2379 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on pull request #2340: URL: https://github.com/apache/apisix/pull/2340#issuecomment-706541484 > please fix the old issue first fixed 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502785396 ## File path: doc/zh-cn/plugins/limit-count.md ## @@ -26,17 +26,18 @@ ## 参数 -| 名称 | 类型| 必选项 | 默认值 | 有效值 | 描述 | -| -- | --- | | --- | | --- | -| count | integer | 必须 | | [0,...] | 指定时间窗口内的请求数量阈值 | -| time_window| integer | 必须 | | [0,...] | 时间窗口的大小(以秒为单位),超过这个时间就会重置 | -| key| string | 必须 | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] | 用来做请求计数的依据 | -| rejected_code | integer | 可选 | 503 | [200,600] | 当请求超过阈值被拒绝时,返回的 HTTP 状态码 | -| policy | string | 可选 | "local" | ["local", "redis"] | 用于检索和增加限制的速率限制策略。可选的值有:`local`(计数器被以内存方式保存在节点本地,默认选项) 和 `redis`(计数器保存在 Redis 服务节点上,从而可以跨节点共享结果,通常用它来完成全局限速) | -| redis_host | string | `redis` 必须 | | | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的地址。 | -| redis_port | integer | 可选 | 6379| [1,...] | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的端口 | -| redis_password | string | 可选 | | | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点的密码。 | -| redis_timeout | integer | 可选 | 1000| [1,...] | 当使用 `redis` 限速策略时,该属性是 Redis 服务节点以毫秒为单位的超时时间 | +| 名称| 类型 | 必选项 | 默认值 | 有效值 | 描述 | +| --- | | | --- | | | +| count | integer | 必须 | | [0,...] | 指定时间窗口内的请求数量阈值 | +| time_window | integer | 必须 | | [0,...] | 时间窗口的大小(以秒为单位),超过这个时间就会重置 | +| key | string | 必须 | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] | 用来做请求计数的依据 | +| rejected_code | integer | 可选 | 503 | [200,600] | 当请求超过阈值被拒绝时,返回的 HTTP 状态码 | +| policy | string | 可选 | "local" | ["local", "redis", "redis-cluster"] | 用于检索和增加限制的速率限制策略。可选的值有:`local`(计数器被以内存方式保存在节点本地,默认选项) 和 `redis`(计数器保存在 Redis 服务节点上,从而可以跨节点共享结果,通常用它来完成全局限速);以及`redis-cluster`,跟redis功能一样,只是使用redis集群方式。 | Review comment: The content is correct This is an automated message from the Apache Git Service. To
[GitHub] [apisix] liuhengloveyou removed a comment on pull request #2340: feature: limit-count use redis cluster
liuhengloveyou removed a comment on pull request #2340: URL: https://github.com/apache/apisix/pull/2340#issuecomment-706539087 > @liuhengloveyou is this PR still a draft? 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on a change in pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502784661 ## File path: apisix/plugins/limit-count.lua ## @@ -70,11 +74,36 @@ local schema = { type = "string", minLength = 0, }, redis_timeout = { -type = "integer", minimum = 1, -default = 1000, +type = "integer", minimum = 1, default = 1000, }, }, required = {"redis_host"}, +}, +{ +properties = { +policy = { +enum = {"redis-cluster"}, +}, +redis_serv_list = { +type = "array", +minItems = 2, +items = { +type = "object", +properties = { +redis_host = {type = "string", minLength = 2}, +redis_port = {type = "integer", minimum = 1}, Review comment: updated 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou closed pull request #2340: feature: limit-count use redis cluster
liuhengloveyou closed pull request #2340: URL: https://github.com/apache/apisix/pull/2340 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: us...@infra.apache.org
[GitHub] [apisix] liuhengloveyou commented on pull request #2340: feature: limit-count use redis cluster
liuhengloveyou commented on pull request #2340: URL: https://github.com/apache/apisix/pull/2340#issuecomment-706539087 > @liuhengloveyou is this PR still a draft? 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: us...@infra.apache.org
[GitHub] [apisix] membphis commented on a change in pull request #2339: feature: breaker request by api
membphis commented on a change in pull request #2339: URL: https://github.com/apache/apisix/pull/2339#discussion_r502780370 ## File path: apisix/plugins/api-breaker.lua ## @@ -0,0 +1,221 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local plugin_name = "api-breaker" +local ngx = ngx +local math = math +local ipairs = ipairs +local error = error +local core = require("apisix.core") + +local DEFAULT_EXPTIME = 300 -- TODO: user can config + +local shared_buffer = ngx.shared['plugin-'.. plugin_name] +if not shared_buffer then +error("failed to get ngx.shared dict when load plugin " .. plugin_name) +end + + +local schema = { +type = "object", +properties = { +unhealthy_response_code = { +type = "integer", +minimum = 200, +maximum = 599, +}, +unhealthy = { +type = "object", +properties = { +http_statuses = { +type = "array", +minItems = 1, +items = { +type = "integer", +minimum = 500, +maximum = 599, +}, +uniqueItems = true, +default = {500} +}, +failures = { +type = "integer", +minimum = 1, +default = 1, Review comment: I think it can be larger ## File path: apisix/plugins/api-breaker.lua ## @@ -0,0 +1,221 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local plugin_name = "api-breaker" +local ngx = ngx +local math = math +local ipairs = ipairs +local error = error +local core = require("apisix.core") + +local DEFAULT_EXPTIME = 300 -- TODO: user can config + +local shared_buffer = ngx.shared['plugin-'.. plugin_name] +if not shared_buffer then +error("failed to get ngx.shared dict when load plugin " .. plugin_name) +end + + +local schema = { +type = "object", +properties = { +unhealthy_response_code = { +type = "integer", +minimum = 200, +maximum = 599, +}, +unhealthy = { +type = "object", +properties = { +http_statuses = { +type = "array", +minItems = 1, +items = { +type = "integer", +minimum = 500, +maximum = 599, +}, +uniqueItems = true, +default = {500} +}, +failures = { +type = "integer", +minimum = 1, +default = 1, +} +} +}, +healthy = { +type = "object", +properties = { +http_statuses = { +type = "array", +minItems = 1, +items = { +type = "integer", +minimum = 200, +maximum = 499, +}, +uniqueItems = true, +default = {200, 206} +}, +successes = { +type = "integer", +minimum = 1, +default = 1, Review
[GitHub] [apisix] membphis commented on a change in pull request #2340: feature: limit-count use redis cluster
membphis commented on a change in pull request #2340: URL: https://github.com/apache/apisix/pull/2340#discussion_r502777237 ## File path: apisix/plugins/limit-count.lua ## @@ -119,6 +148,11 @@ local function create_limit_obj(conf) conf.count, conf.time_window, conf) end +if conf.policy == "redis-cluster" then +return limit_redis_cluster_new("plugin-" .. plugin_name, + conf.count, conf.time_window, conf) Review comment: bad indentation ## File path: apisix/plugins/limit-count.lua ## @@ -70,11 +74,36 @@ local schema = { type = "string", minLength = 0, }, redis_timeout = { -type = "integer", minimum = 1, -default = 1000, +type = "integer", minimum = 1, default = 1000, }, }, required = {"redis_host"}, +}, +{ +properties = { +policy = { +enum = {"redis-cluster"}, +}, +redis_serv_list = { +type = "array", +minItems = 2, +items = { +type = "object", +properties = { +redis_host = {type = "string", minLength = 2}, +redis_port = {type = "integer", minimum = 1}, Review comment: `max` ? ## File path: apisix/plugins/limit-count/limit-count-redis-cluster.lua ## @@ -0,0 +1,141 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local core = require("apisix.core") +local resty_lock = require("resty.lock") +local assert = assert +local error = error +local setmetatable = setmetatable +local tostring = tostring +local require = require +local ipairs = ipairs + + +local _M = {version = 0.1} + + +local mt = { +__index = _M +} + +-- https://github.com/steve0511/resty-redis-cluster +local function new_redis_cluster(conf) +local config = { +name = "apisix-rediscluster", --rediscluster name +enable_slave_read = true, +keepalive_timeout = 6, --redis connection pool idle timeout +keepalive_cons = 1000, --redis connection pool size +connect_timeout = 1000, --timeout while connecting +send_timeout = 1000,--timeout while sending +max_redirection = 5,--maximum retry attempts for redirection +max_connection_attempts = 1,--maximum retry attempts for connection +serv_list = {}, +read_timeout = conf.redis_timeout, +auth = conf.redis_password --set password while setting auth +} + +for key, value in ipairs(conf.redis_serv_list) do +if value['redis_host'] and value['redis_port'] then +config.serv_list[key] = {ip = value['redis_host'], port = value['redis_port']} +end +end + + +local redis_cluster = require "resty.rediscluster" +local red_c = redis_cluster:new(config) +if not red_c then +error("connect to redis cluster fails") +end + +return red_c +end + + +function _M.new(plugin_name, limit, window, conf) +assert(limit > 0 and window > 0) + +_M.red_c = new_redis_cluster(conf) Review comment: that is wrong!! a bug, we need to fix it ## File path: apisix/plugins/limit-count/limit-count-redis-cluster.lua ## @@ -0,0 +1,141 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the
[GitHub] [apisix] nic-chen commented on issue #2366: bug: gRPC transcoding plugin how to support import other proto file?
nic-chen commented on issue #2366: URL: https://github.com/apache/apisix/issues/2366#issuecomment-706530549 > @nic-chen > > Do you means copy the import content to the same file proto and use the apisix/admin/proto to put this merge proto content? Yes, it could be solved in this way. Proto import is quite troublesome to implement and would not be considered in the near future. 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: us...@infra.apache.org
[GitHub] [apisix] idbeta opened a new issue #2378: request help: why the uri in route not work
idbeta opened a new issue #2378: URL: https://github.com/apache/apisix/issues/2378 ### Issue description ```shell $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '{"uri": "/helloOQ%26F8G%23J%27K%2C-f4BT%5Ba%7EN_%3A6C3UkMmgpeVyu72RjL%2A%5D%24", "upstream": {"nodes": {"127.0.0.1:9666": 1}, "type": "roundrobin"}}' HTTP/1.1 200 OK ... ... ``` test ```shell $ curl -i 'http://127.0.0.1:9080/helloOQ%26F8G%23J%27K%2C-f4BT%5Ba%7EN_%3A6C3UkMmgpeVyu72RjL%2A%5D%24' HTTP/1.1 404 Not Found ... ... ``` ### Environment * apisix version (cmd: `apisix version`): master * OS: mac 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: us...@infra.apache.org
[GitHub] [apisix] idbeta removed a comment on issue #2375: request help: setted a special uri in route,when request it,it return 404
idbeta removed a comment on issue #2375: URL: https://github.com/apache/apisix/issues/2375#issuecomment-706519431 > > ```shell > > /helloh~E]ftXnj2Hs > > ``` > > it is not a valid URI address, the Admin API should return 400 for this case. how about this uri? ```shell $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d ' { "uri": "/helloF.C6ITO~HSRgJ)JRF3x7CEBnQNyBI1lbjz$R8GXLKpDfTcwwk-nS4~(iprHlA3Qe5:cX(fY-1blh(C,tMKD_dbw;HxCxZadT$8Ae.w-N~TU)24udFogqufYx6Lu@v,XWrdauEI9Eq_6O340,2e,Z$Zhot+nPK3gSU6j$P0z6ts+V5VU:xMo49/IimOS5plD~UA3sreDjU+yEJ7W;;,zpf~_q7qihB0sPe-F@/1)XFG9LP:avzhOELhW0M$8Y9(V_i_KQYnvbyA(/2zR.L:)@-kkH8k;CorXcdsbHqMny;Nv+V97cBMOA:4cIS2m+JmaRumV", "upstream": {"nodes": {"127.0.0.1:9666": 1}, "type": "roundrobin"} }' HTTP/1.1 200 OK Date: Sat, 10 Oct 2020 08:22:37 GMT Content-Type: application/json ... ... ``` when I request the uri ```shell $ curl -i 'http://127.0.0.1:9080/helloF.C6ITO~HSRgJ)JRF3x7CEBnQNyBI1lbjz$R8GXLKpDfTcwwk-nS4~(iprHlA3Qe5:cX(fY-1blh(C,tMKD_dbw;HxCxZadT$8Ae.w-N~TU)24udFogqufYx6Lu@v,XWrdauEI9Eq_6O340,2e,Z$Zhot+nPK3gSU6j$P0z6ts+V5VU:xMo49/IimOS5plD~UA3sreDjU+yEJ7W;;,zpf~_q7qihB0sPe-F@/1)XFG9LP:avzhOELhW0M$8Y9(V_i_KQYnvbyA(/2zR.L:)@-kkH8k;CorXcdsbHqMny;Nv+V97cBMOA:4cIS2m+JmaRumV' HTTP/1.1 404 Not Found ... ... ``` also, I tried the following two URIs and have the same problem: 'http://127.0.0.1:9080/hello-n~U.X-C_Px/gB_t.Y/./i' 'http://127.0.0.1:9080/hello-A~L~s-z.~L_e-H//Q' 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: us...@infra.apache.org
[GitHub] [apisix] RocFang edited a comment on pull request #2376: fix: wget -O always leave a file enven though download fail
RocFang edited a comment on pull request #2376: URL: https://github.com/apache/apisix/pull/2376#issuecomment-706524157 for some reason we know, raw.githubusercontent.com can't accessed normally, when it fail, the error message get confusing when you try next time because of the zero size file the last wget command left there. and that's how i found this problem. @moonming 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: us...@infra.apache.org
[GitHub] [apisix-dashboard] moonming commented on issue #547: bug: API后端服务配置域名的bug
moonming commented on issue #547: URL: https://github.com/apache/apisix-dashboard/issues/547#issuecomment-706526401 @tangjun2012 welcome PR to fix it, thx 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: us...@infra.apache.org