[GitHub] [apisix-dashboard] Jaycean commented on a change in pull request #1465: feat(be): Online debug function adds support for transfer files
Jaycean commented on a change in pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#discussion_r580827765 ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string, error) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType, nil + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + return nil, "", err + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + return nil, "", err + } + _, err = io.Copy(part, file) + defer file.Close() + } + for k, v := range reqParams { + if err := writer.WriteField(k, v); err != nil { + return nil, "", err + } + } + if err := writer.Close(); err != nil { + return nil, "", err + } + return body, writer.FormDataContentType(), nil + } + + urlValues := url.Values{} + for key, val := range reqParams { + urlValues.Set(key, val) + } + + reqBody := urlValues.Encode() + + return strings.NewReader(reqBody), contentType, nil Review comment: @liuxiran Because the front-end has cross-domain problems, it needs to conduct a transparent transmission through the manage API. Here, the front-end places the file bytes in the body and transfers them to the back-end, and then directly transmits them through the back-end. Therefore, the E2E test needs to read the file here. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] frf12 commented on issue #3642: bug: /apisix/admin 不能被正确的转发
frf12 commented on issue #3642: URL: https://github.com/apache/apisix/issues/3642#issuecomment-783984601 > To use APISIX proxy Dashboard, you need to set enable admin to false (because the path of the Admin API and the path of the Manager API are the same, not setting it to false will request to apis of Admin API), and then follow the normal route configuration. 这能解决使用apisix代理apisix dashboard的问题。但如果我的服务中正好有个api是/apisix/admin呢,那也只能通过设置apisix.enable_admin为false来解决吗?这似乎不合理? 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] Firstsawyou commented on issue #3642: bug: /apisix/admin 不能被正确的转发
Firstsawyou commented on issue #3642: URL: https://github.com/apache/apisix/issues/3642#issuecomment-783978473 To use APISIX proxy Dashboard, you need to set enable admin to false (because the path of the Admin API and the path of the Manager API are the same, not setting it to false will request to apis of Admin API), and then follow the normal route configuration. 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] nic-chen commented on a change in pull request #1465: feat(be): Online debug function adds support for transfer files
nic-chen commented on a change in pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#discussion_r580819191 ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string, error) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType, nil + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + return nil, "", err + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + return nil, "", err + } + _, err = io.Copy(part, file) + defer file.Close() + } + for k, v := range reqParams { + if err := writer.WriteField(k, v); err != nil { + return nil, "", err + } + } + if err := writer.Close(); err != nil { + return nil, "", err + } + return body, writer.FormDataContentType(), nil + } + + urlValues := url.Values{} + for key, val := range reqParams { + urlValues.Set(key, val) + } + + reqBody := urlValues.Encode() + + return strings.NewReader(reqBody), contentType, nil Review comment: I feel that there is a problem with this. The content of the file should not be read in the test case, but the content of the uploaded file should be read in the main program. 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] frf12 opened a new issue #3642: bug: /apisix/admin 不能被正确的转发
frf12 opened a new issue #3642: URL: https://github.com/apache/apisix/issues/3642 ### Issue description 使用apisix代理apisix dashboard时发现所有的/apisix/admin的路径会因为匹配/apisix/admin而被转发给apisix admin模块 ### Environment * apisix version (cmd: `apisix version`): 2.3 * OS (cmd: `uname -a`): centos7 * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):1.19.3.1 * etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):3.4.0 * apisix-dashboard version, if have:2.3 ### Minimal test code / Steps to reproduce the issue 1.创建一个路由,将foo.com域名的请求都转发到127.0.0.1: curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d ' { "uri": "/*", "hosts": ["foo.com"], "methods": ["PUT", "GET"], "upstream": { "type": "roundrobin", "nodes": { "127.0.0.1:": 1 } } }' 2.尝试请求http://foo.com/apisix/admin/user/login curl 'http://foo.com/apisix/admin/user/login' \ --data-raw '{"username":"admin","password":"admin"}' \ --compressed \ --insecure -v ### What's the actual result? (including assertion message & call stack if applicable) 返回401。观察logs/error.log发现,请求被认为是apisix admin的请求,被转发到了apisix admin模块。因为请求没有带key,所有返回401 ### What's the expected result? 请求应该转发到127.0.0.1: This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] nic-chen commented on issue #1500: Feat: Rewrite all E2E tests using the Ginkgo
nic-chen commented on issue #1500: URL: https://github.com/apache/apisix-dashboard/issues/1500#issuecomment-783974256 Thanks @Jaycean I think we could list a todo list by module 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-docker] starsz commented on a change in pull request #133: CI: add apisix-docker test
starsz commented on a change in pull request #133: URL: https://github.com/apache/apisix-docker/pull/133#discussion_r580815925 ## File path: .github/workflows/apisix-alpine-docker-test.yaml ## @@ -0,0 +1,31 @@ +name: APISIX Alpine docker Test + +on: + push: +branches: + - master + pull_request: +branches: + - master + +jobs: + build: +runs-on: ubuntu-latest +steps: + - uses: actions/checkout@v2 + + - name: Build and run +run: | + docker build -t apisix:alpine -f ./alpine/Dockerfile . + docker-compose -f ./alpine/docker-compose.yaml up -d + sleep 30 + docker logs docker_apisix_1 + + - name: Test +run: | + curl http://127.0.0.1:9080/apisix/admin/schema/service -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' + code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/apisix/admin/schema/service -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1') + if [ ! $code -eq 200 ]; then Review comment: How is it going? 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] starsz commented on issue #1500: Feat: Rewrite all E2E tests using the Ginkgo
starsz commented on issue #1500: URL: https://github.com/apache/apisix-dashboard/issues/1500#issuecomment-783971732 Yeah. Much appreciated. As far as I know, @nic-chen had finished part of them but hadn't created PR. 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] starsz commented on a change in pull request #1465: feat(be): Online debug function adds support for transfer files
starsz commented on a change in pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#discussion_r580814371 ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string, error) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType, nil + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + return nil, "", err + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + return nil, "", err + } + _, err = io.Copy(part, file) + defer file.Close() + } + for k, v := range reqParams { + if err := writer.WriteField(k, v); err != nil { + return nil, "", err + } + } + if err := writer.Close(); err != nil { + return nil, "", err + } + return body, writer.FormDataContentType(), nil + } + + urlValues := url.Values{} + for key, val := range reqParams { + urlValues.Set(key, val) + } + + reqBody := urlValues.Encode() + + return strings.NewReader(reqBody), contentType, nil Review comment: @nic-chen Do you know about this? 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-docker] lingsamuel closed issue #59: gcr.azk8s.cn no longer public
lingsamuel closed issue #59: URL: https://github.com/apache/apisix-docker/issues/59 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] Jaycean commented on issue #1500: Feat: Rewrite all E2E tests using the Ginkgo
Jaycean commented on issue #1500: URL: https://github.com/apache/apisix-dashboard/issues/1500#issuecomment-783968106 The PR and issue of the completed E2E can be associated and recorded. cc @nic-chen @starsz @imjoey 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] Jaycean opened a new issue #1500: Feat: Rewrite all E2E tests using the Ginkgo
Jaycean opened a new issue #1500: URL: https://github.com/apache/apisix-dashboard/issues/1500 # Feature request Rewrite all E2E tests using the Ginkgo. There are a lot of E2E tests that need to be rewritten, so we record the rewriting of E2E in 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
[GitHub] [apisix-website] dependabot[bot] opened a new pull request #200: chore(deps): bump actions/setup-node from v2.1.4 to v2.1.5
dependabot[bot] opened a new pull request #200: URL: https://github.com/apache/apisix-website/pull/200 Bumps [actions/setup-node](https://github.com/actions/setup-node) from v2.1.4 to v2.1.5. Release notes Sourced from https://github.com/actions/setup-node/releases";>actions/setup-node's releases. v2.1.5 Release Improve error and warning line number handling (problem matcher regex) Commits https://github.com/actions/setup-node/commit/46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea";>46071b5 Fix TypeScript error line/column (https://github-redirect.dependabot.com/actions/setup-node/issues/125";>#125) https://github.com/actions/setup-node/commit/05f0551dbd620d7be8d92f9f7c1674ebf6bcb0eb";>05f0551 chore: operating-system -> os (https://github-redirect.dependabot.com/actions/setup-node/issues/184";>#184) https://github.com/actions/setup-node/commit/23bdee16bc6fd30e6ad43a07967df709cd7ef1a8";>23bdee1 Clarifications to the README (https://github-redirect.dependabot.com/actions/setup-node/issues/167";>#167) (https://github-redirect.dependabot.com/actions/setup-node/issues/229";>#229) https://github.com/actions/setup-node/commit/4257181919f94362b6137aa288b487191f812e1b";>4257181 Bump acorn from 5.7.3 to 5.7.4 (https://github-redirect.dependabot.com/actions/setup-node/issues/122";>#122) https://github.com/actions/setup-node/commit/7f4d5225d8c13fce67be36260ffb5c10b3fdaa84";>7f4d522 Bump lodash from 4.17.15 to 4.17.19 (https://github-redirect.dependabot.com/actions/setup-node/issues/174";>#174) https://github.com/actions/setup-node/commit/68fafecfa471220042b49240ef2621c40c87577f";>68fafec refactor: use core.info instead of console.log (https://github-redirect.dependabot.com/actions/setup-node/issues/185";>#185) See full diff in https://github.com/actions/setup-node/compare/v2.1.4...46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea";>compare view Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) 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-website] branch dependabot/github_actions/actions/setup-node-v2.1.5 created (now 2cba54d)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/github_actions/actions/setup-node-v2.1.5 in repository https://gitbox.apache.org/repos/asf/apisix-website.git. at 2cba54d chore(deps): bump actions/setup-node from v2.1.4 to v2.1.5 No new revisions were added by this update.
[GitHub] [apisix] Firstsawyou commented on a change in pull request #3637: fix: we should ensure one upstream only have one determinable scheme
Firstsawyou commented on a change in pull request #3637: URL: https://github.com/apache/apisix/pull/3637#discussion_r580807083 ## File path: doc/plugins/proxy-rewrite.md ## @@ -35,7 +35,7 @@ The `proxy-rewrite` is an upstream proxy information rewriting plugin, which sup | Name | Type | Requirement | Default | Valid | Description | | - | - | --- | --- | - | | -| scheme| string| optional| "http" | ["http", "https"] | Upstream new `schema` forwarding protocol. | +| scheme| string| optional| "http" | ["http", "https"] | Deprecated. It's recommended to set the proxy `scheme` in the Upstream object's `scheme` field instead.| Review comment: I think in the `Description` part, a description should be added or the original description should be retained. such as: Upstream new `schema` forwarding protocol (Deprecated. It's recommended to set the proxy `scheme` in the Upstream object's `scheme` field instead). 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] codecov-io edited a comment on pull request #1465: feat(be): Online debug function adds support for transfer files
codecov-io edited a comment on pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#issuecomment-775915860 # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=h1) Report > Merging [#1465](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=desc) (f8d1436) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/bd5ed03e3256437ed3b54ad10b0ab7b30bbb0b50?el=desc) (bd5ed03) will **decrease** coverage by `6.76%`. > The diff coverage is `74.07%`. [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=tree) ```diff @@Coverage Diff @@ ## master#1465 +/- ## == - Coverage 68.95% 62.19% -6.77% == Files 48 48 Lines3038 3047 +9 == - Hits 2095 1895 -200 - Misses705 901 +196 - Partials 238 251 +13 ``` | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [...l/handler/route\_online\_debug/route\_online\_debug.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcm91dGVfb25saW5lX2RlYnVnL3JvdXRlX29ubGluZV9kZWJ1Zy5nbw==) | `74.50% <74.07%> (+0.70%)` | :arrow_up: | | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `56.25% <0.00%> (-43.75%)` | :arrow_down: | | [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `35.08% <0.00%> (-29.84%)` | :arrow_down: | | [api/internal/utils/consts/api\_error.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2NvbnN0cy9hcGlfZXJyb3IuZ28=) | `25.00% <0.00%> (-25.00%)` | :arrow_down: | | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `31.93% <0.00%> (-23.53%)` | :arrow_down: | | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `54.08% <0.00%> (-20.41%)` | :arrow_down: | | [api/internal/log/log.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2xvZy9sb2cuZ28=) | `30.00% <0.00%> (-20.00%)` | :arrow_down: | | [api/internal/handler/global\_rule/global\_rule.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZ2xvYmFsX3J1bGUvZ2xvYmFsX3J1bGUuZ28=) | `66.12% <0.00%> (-17.75%)` | :arrow_down: | | [api/internal/utils/utils.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3V0aWxzLmdv) | `52.94% <0.00%> (-12.95%)` | :arrow_down: | | [api/internal/utils/json\_patch.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2pzb25fcGF0Y2guZ28=) | `48.27% <0.00%> (-10.35%)` | :arrow_down: | | ... and [8 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree-more) | | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=footer). Last update [bd5ed03...f8d1436](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). 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] codecov-io edited a comment on pull request #1465: feat(be): Online debug function adds support for transfer files
codecov-io edited a comment on pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#issuecomment-775915860 # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=h1) Report > Merging [#1465](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=desc) (f8d1436) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/bd5ed03e3256437ed3b54ad10b0ab7b30bbb0b50?el=desc) (bd5ed03) will **decrease** coverage by `17.32%`. > The diff coverage is `n/a`. [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master#1465 +/- ## === - Coverage 68.95% 51.63% -17.33% === Files 48 39-9 Lines3038 2597 -441 === - Hits 2095 1341 -754 - Misses705 1082 +377 + Partials 238 174 -64 ``` | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [api/internal/utils/version.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3ZlcnNpb24uZ28=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: | | [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: | | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: | | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `0.00% <0.00%> (-74.49%)` | :arrow_down: | | [api/internal/filter/cors.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9jb3JzLmdv) | `0.00% <0.00%> (-66.67%)` | :arrow_down: | | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `0.00% <0.00%> (-55.47%)` | :arrow_down: | | [api/internal/utils/consts/api\_error.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2NvbnN0cy9hcGlfZXJyb3IuZ28=) | `0.00% <0.00%> (-50.00%)` | :arrow_down: | | [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `27.41% <0.00%> (-37.50%)` | :arrow_down: | | [api/internal/handler/server\_info/server\_info.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmVyX2luZm8vc2VydmVyX2luZm8uZ28=) | `57.14% <0.00%> (-33.34%)` | :arrow_down: | | [api/internal/utils/closer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2Nsb3Nlci5nbw==) | `0.00% <0.00%> (-33.34%)` | :arrow_down: | | ... and [28 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1465/diff?src=pr&el=tree-more) | | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=footer). Last update [bd5ed03...f8d1436](https://codecov.io/gh/apache/apisix-dashboard/pull/1465?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). 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] Jaycean commented on a change in pull request #1465: feat(be): Online debug function adds support for transfer files
Jaycean commented on a change in pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#discussion_r580806605 ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string, error) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType, nil + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + return nil, "", err + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + return nil, "", err + } + _, err = io.Copy(part, file) + defer file.Close() Review comment: Yes, this is my negligence. Done. Thks. 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] Jaycean commented on a change in pull request #1465: feat(be): Online debug function adds support for transfer files
Jaycean commented on a change in pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#discussion_r580805498 ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string, error) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType, nil + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + return nil, "", err + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + return nil, "", err + } + _, err = io.Copy(part, file) + defer file.Close() + } + for k, v := range reqParams { + if err := writer.WriteField(k, v); err != nil { + return nil, "", err + } + } + if err := writer.Close(); err != nil { + return nil, "", err + } + return body, writer.FormDataContentType(), nil + } + + urlValues := url.Values{} + for key, val := range reqParams { + urlValues.Set(key, val) + } + + reqBody := urlValues.Encode() + + return strings.NewReader(reqBody), contentType, nil Review comment: http.go In the getReader function, It from the old E2E/ http.go. My idea is that E2E will be rewritten with the new ginkgo, so I migrate it directly here without modifying the code. My understanding here is to deal with a variety of data formats, such as form-data, JSON, files. The incoming params may be in a variety of situations. Here is the third one url.Values set reqParams map[string]string 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 issue #1399: support to show raw data for Route, Upstream, Service and so on
LiteSun commented on issue #1399: URL: https://github.com/apache/apisix-dashboard/issues/1399#issuecomment-783952635 ## Solutions design: On the page, in the list of route, service, consumer and upstream, add a view button. When the user clicks view, a Drawer will pop up on the right side, and the corresponding data will be displayed in the form of json in the Drawer. ![image](https://user-images.githubusercontent.com/31329157/108809901-cc914d80-75e4-11eb-9115-a4be803288b2.png) ![image](https://user-images.githubusercontent.com/31329157/108809910-d450f200-75e4-11eb-9913-97db3fc3fd93.png) The code editor uses codemirror, the same as the plugin editor; - documents: When clicked, it will jump to the corresponding document. - format: When clicked, it will format the current code. - copy: When clicked, the code will be copied to the clipboard for testing and debugging purposes. ## Discussion needed: If the user uses raw data for editing, the edited data is missing fields that the front-end depends on, which can cause the page to crash. For example, the following issue: https://github.com/apache/apisix-dashboard/issues/1234 Can we use jsonchema to verify that the data entered by the user is legitimate, just like we verify that the plugin is legitimate? @juzhiyuan @nic-chen @liuxiran This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander opened a new pull request #3641: feat: don't log uninitialized access log variable when the HTTP reque…
spacewander opened a new pull request #3641: URL: https://github.com/apache/apisix/pull/3641 …st is malformed Signed-off-by: spacewander ### 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? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first** 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-ingress-controller] tokers commented on pull request #262: feat: ApisixRoute v2alpha1
tokers commented on pull request #262: URL: https://github.com/apache/apisix-ingress-controller/pull/262#issuecomment-783950278 @gxthrj Please take a look when you have time. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-ingress-controller] tokers opened a new pull request #262: feat: ApisixRoute v2alpha1
tokers opened a new pull request #262: URL: https://github.com/apache/apisix-ingress-controller/pull/262 Please answer these questions before submitting a pull request - Why submit this pull request? - [ ] Bugfix - [x] New feature provided - [ ] Improve performance - [ ] Backport patches - Related issues #248 ___ ### New feature or improvement - Describe the details and related test reports. This PR implemented the ApisixRoute.apisix.apache.org/v2/alpha1 resource. 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-ingress-controller] zhangxiaohui123456 commented on issue #248: discuss: ApisixRoute change struct
zhangxiaohui123456 commented on issue #248: URL: https://github.com/apache/apisix-ingress-controller/issues/248#issuecomment-783949954 Will the routing rules under Ingress be the same as the standard version of Apisix? 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] Jaycean commented on a change in pull request #1465: feat(be): Online debug function adds support for transfer files
Jaycean commented on a change in pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#discussion_r580799536 ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string, error) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType, nil + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + return nil, "", err + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + return nil, "", err + } + _, err = io.Copy(part, file) + defer file.Close() + } + for k, v := range reqParams { + if err := writer.WriteField(k, v); err != nil { + return nil, "", err + } + } + if err := writer.Close(); err != nil { + return nil, "", err + } + return body, writer.FormDataContentType(), nil + } + + urlValues := url.Values{} + for key, val := range reqParams { + urlValues.Set(key, val) + } + + reqBody := urlValues.Encode() + + return strings.NewReader(reqBody), contentType, nil Review comment: Yes, because the sending file is added, the data type in the body is bytes. If it is put in the body, it is not convenient to read. So I communicated with @liuxiran at that time, so it can only put other parameters in the header. Do you have a better suggestion? 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-ingress-controller] tokers edited a comment on issue #248: discuss: ApisixRoute change struct
tokers edited a comment on issue #248: URL: https://github.com/apache/apisix-ingress-controller/issues/248#issuecomment-781125680 The `ApisixRoute` should leverage the advantages of APISIX Routes as soon as possible, for instance, the flexible route match, native plugins support. ```yaml apiVersion: apisix.apache.org/v2alpha1 kind: ApisixRoute metadata: name: httpbin-route spec: http: - priority: 10 match: paths: - "/a" - "/bb*" methods: - GET - POST hosts: - a.com - aa.com remote_addrs: - 192.168.1.0/24 - 10.0.5.12 nginxVars: - subject: "$remote_addr" op: in array: - 127.0.0.1 - 10.0.5.11 backend: serviceName: httpbin servicePort: 8080 resolveGranularity: endpoint # by default is endpoint, optional value can be "service". plugins: - name: redirect enable: true config: aaa: bbb ccc: ddd ``` The `scripts` are used by plugin orchestration, we don't use it. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] starsz commented on a change in pull request #1498: ci: add ci check for gofmt
starsz commented on a change in pull request #1498: URL: https://github.com/apache/apisix-dashboard/pull/1498#discussion_r580797776 ## File path: .github/workflows/go-lint.yml ## @@ -10,9 +10,26 @@ on: jobs: golangci: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - name: run lint run: make go-lint + + gofmt: +runs-on: ubuntu-latest +steps: + - uses: actions/checkout@v2 + - name: setup go +uses: actions/setup-go@v1 +with: + go-version: '1.13' + - name: check gofmt +working-directory: ./ +run: | + diffs=`gofmt -l .` Review comment: IMO, `gofmt -l -d .` would be better. 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] dependabot[bot] opened a new pull request #1499: chore(deps): bump actions/setup-node from v2.1.4 to v2.1.5
dependabot[bot] opened a new pull request #1499: URL: https://github.com/apache/apisix-dashboard/pull/1499 Bumps [actions/setup-node](https://github.com/actions/setup-node) from v2.1.4 to v2.1.5. Release notes Sourced from https://github.com/actions/setup-node/releases";>actions/setup-node's releases. v2.1.5 Release Improve error and warning line number handling (problem matcher regex) Commits https://github.com/actions/setup-node/commit/46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea";>46071b5 Fix TypeScript error line/column (https://github-redirect.dependabot.com/actions/setup-node/issues/125";>#125) https://github.com/actions/setup-node/commit/05f0551dbd620d7be8d92f9f7c1674ebf6bcb0eb";>05f0551 chore: operating-system -> os (https://github-redirect.dependabot.com/actions/setup-node/issues/184";>#184) https://github.com/actions/setup-node/commit/23bdee16bc6fd30e6ad43a07967df709cd7ef1a8";>23bdee1 Clarifications to the README (https://github-redirect.dependabot.com/actions/setup-node/issues/167";>#167) (https://github-redirect.dependabot.com/actions/setup-node/issues/229";>#229) https://github.com/actions/setup-node/commit/4257181919f94362b6137aa288b487191f812e1b";>4257181 Bump acorn from 5.7.3 to 5.7.4 (https://github-redirect.dependabot.com/actions/setup-node/issues/122";>#122) https://github.com/actions/setup-node/commit/7f4d5225d8c13fce67be36260ffb5c10b3fdaa84";>7f4d522 Bump lodash from 4.17.15 to 4.17.19 (https://github-redirect.dependabot.com/actions/setup-node/issues/174";>#174) https://github.com/actions/setup-node/commit/68fafecfa471220042b49240ef2621c40c87577f";>68fafec refactor: use core.info instead of console.log (https://github-redirect.dependabot.com/actions/setup-node/issues/185";>#185) See full diff in https://github.com/actions/setup-node/compare/v2.1.4...46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea";>compare view Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) 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 dependabot/github_actions/actions/setup-node-v2.1.5 created (now fe45d39)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/github_actions/actions/setup-node-v2.1.5 in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. at fe45d39 chore(deps): bump actions/setup-node from v2.1.4 to v2.1.5 No new revisions were added by this update.
[GitHub] [apisix] Firstsawyou opened a new pull request #3640: chore: fix the traffic-split plugin doc
Firstsawyou opened a new pull request #3640: URL: https://github.com/apache/apisix/pull/3640 ### What this PR does / why we need it: Fix the example of traffic-split plugin documentation and delete useless request parameters. ### 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? * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first** 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] spawnris commented on issue #487: Who is using APISIX?(欢迎使用 APISIX 的个人和公司在此留言)
spawnris commented on issue #487: URL: https://github.com/apache/apisix/issues/487#issuecomment-783945544 组织:腾讯游戏 地址:中国深圳 联系方式:spawnris...@tencent.com 使用场景:腾讯游戏社区APP的后台服务网关 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-ingress-controller] tokers edited a comment on issue #248: discuss: ApisixRoute change struct
tokers edited a comment on issue #248: URL: https://github.com/apache/apisix-ingress-controller/issues/248#issuecomment-781125680 The `ApisixRoute` should leverage the advantages of APISIX Routes as soon as possible, for instance, the flexible route match, native plugins support. ```yaml apiVersion: apisix.apache.org/v2alpha1 kind: ApisixRoute metadata: name: httpbin-route spec: http: - priority: 10 match: paths: - "/a" - "/bb*" methods: - GET - POST hosts: - a.com - aa.com remote_addrs: - 192.168.1.0/24 - 10.0.5.12 nginxVars: - subject: "$remote_addr" op: in value: set: - 127.0.0.1 - 10.0.5.11 backend: serviceName: httpbin servicePort: 8080 resolveGranularity: endpoint # by default is endpoint, optional value can be "service". plugins: - name: redirect enable: true config: aaa: bbb ccc: ddd ``` The `scripts` are used by plugin orchestration, we don't use it. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] starsz commented on a change in pull request #1465: feat(be): Online debug function adds support for transfer files
starsz commented on a change in pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#discussion_r580794487 ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string, error) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType, nil + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + return nil, "", err + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + return nil, "", err + } + _, err = io.Copy(part, file) + defer file.Close() + } + for k, v := range reqParams { + if err := writer.WriteField(k, v); err != nil { + return nil, "", err + } + } + if err := writer.Close(); err != nil { + return nil, "", err + } + return body, writer.FormDataContentType(), nil + } + + urlValues := url.Values{} + for key, val := range reqParams { + urlValues.Set(key, val) + } + + reqBody := urlValues.Encode() + + return strings.NewReader(reqBody), contentType, nil Review comment: Put the `param` to the body? This confused me. ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string, error) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType, nil + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + return nil, "", err + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + return nil, "", err + } + _, err = io.Copy(part, file) + defer file.Close() Review comment: `defer file.Close()` should be put when the file is opened. At line 121. Else if the writer.CreateFormFile's err is not nil, the file wouldn't be closed. This will cause `fd leak`. 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-ingress-controller] tokers edited a comment on issue #248: discuss: ApisixRoute change struct
tokers edited a comment on issue #248: URL: https://github.com/apache/apisix-ingress-controller/issues/248#issuecomment-781125680 The `ApisixRoute` should leverage the advantages of APISIX Routes as soon as possible, for instance, the flexible route match, native plugins support. ```yaml apiVersion: apisix.apache.org/v2alpha1 kind: ApisixRoute metadata: name: httpbin-route spec: http: - priority: 10 match: paths: - "/a" - "/bb*" methods: - GET - POST hosts: - a.com - aa.com remote_addrs: - 192.168.1.0/24 - 10.0.5.12 nginxVars: - subject: "$remote_addr" op: in value: - 127.0.0.1 - 10.0.5.11 backend: serviceName: httpbin servicePort: 8080 resolveGranularity: endpoint # by default is endpoint, optional value can be "service". plugins: - name: redirect enable: true config: aaa: bbb ccc: ddd ``` The `scripts` are used by plugin orchestration, we don't use it. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-ingress-controller] zhangxiaohui123456 opened a new issue #261: request help: ingress-ui
zhangxiaohui123456 opened a new issue #261: URL: https://github.com/apache/apisix-ingress-controller/issues/261 ### Issue description The current version does not support interface operations,I wonder if you can provide an API or other form of direct interface control of the configuration of these Ingress. ### Environment * your apisix-ingress-controller version (output of `apisix-ingress-controller version --long`); * your Kubernetes cluster version (output of `kubectl version`); * if you run apisix-ingress-controller in Bare-metal environment, also show your OS version (`uname -a`). 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] Jaycean commented on a change in pull request #1465: feat(be): Online debug function adds support for transfer files
Jaycean commented on a change in pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#discussion_r580786927 ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + panic(err) Review comment: done. 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-ingress-controller] tokers edited a comment on issue #248: discuss: ApisixRoute change struct
tokers edited a comment on issue #248: URL: https://github.com/apache/apisix-ingress-controller/issues/248#issuecomment-781125680 The `ApisixRoute` should leverage the advantages of APISIX Routes as soon as possible, for instance, the flexible route match, native plugins support. ```yaml apiVersion: apisix.apache.org/v2alpha1 kind: ApisixRoute metadata: name: httpbin-route spec: http: - priority: 10 match: paths: - "/a" - "/bb*" methods: - GET - POST hosts: - a.com - aa.com remote_addrs: - 192.168.1.0/24 - 10.0.5.12 nginxVars: - subject: "$remote_addr" op: in value: - 127.0.0.1 - 10.0.5.11 backend: serviceName: httpbin servicePort: 8080 serviceLevel: endpoint # by default is endpoint, optional value can be "service". plugins: - name: redirect enable: true config: aaa: bbb ccc: ddd ``` The `scripts` are used by plugin orchestration, we don't use it. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-ingress-controller] tokers edited a comment on issue #248: discuss: ApisixRoute change struct
tokers edited a comment on issue #248: URL: https://github.com/apache/apisix-ingress-controller/issues/248#issuecomment-781125680 The `ApisixRoute` should leverage the advantages of APISIX Routes as soon as possible, for instance, the flexible route match, native plugins support. ```yaml apiVersion: apisix.apache.org/v2alpha1 kind: ApisixRoute metadata: name: httpbin-route spec: http: - priority: 10 match: paths: - "/a" - "/bb*" methods: - GET - POST hosts: - a.com - aa.com remote_addrs: - 192.168.1.0/24 - 10.0.5.12 nginxVars: - subject: "$remote_addr" op: in value: - 127.0.0.1 - 10.0.5.11 backend: serviceName: httpbin servicePort: 8080 serviceLevel: endpoint # by default is endpoint, optional value can be "service". plugins: - name: redirect enable: true config: aaa: bbb ccc: ddd ``` The `scripts` are used by plugin orchestration, we don't use it. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on a change in pull request #3636: docs: FAQ doc added make deps execution failed
Firstsawyou commented on a change in pull request #3636: URL: https://github.com/apache/apisix/pull/3636#discussion_r580780192 ## File path: FAQ.md ## @@ -355,3 +355,19 @@ The high availability of APISIX can be divided into two parts: 1. The data plane of Apache APISIX is stateless and can be elastically scaled at will. Just add a layer of LB in front. 2. The control plane of Apache APISIX relies on the highly available implementation of `etcd cluster` and does not require any relational database dependency. + +## Why does the `make deps` command fail in source installation? + +When executing the `make deps` command, an error such as the one shown below occurs. This is caused by the missing dependency of `openresty-openssl111-devel`, you need to execute `yum install -y openresty-openssl111-devel` to install it first. 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] idbeta opened a new pull request #3639: test: add fuzzing case for the route with serverless-post-function
idbeta opened a new pull request #3639: URL: https://github.com/apache/apisix/pull/3639 ### What this PR does / why we need it: relate #3340 fuzzing for the route with `post` and `serverless-post-function` ### 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? * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first** 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-ingress-controller] tokers commented on pull request #252: feat: add support for Endpointslices
tokers commented on pull request #252: URL: https://github.com/apache/apisix-ingress-controller/pull/252#issuecomment-783918896 @lianghao208 Any updates? 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-ingress-controller] tokers commented on pull request #258: chore: migrate chart to repo apisix-helm-charts
tokers commented on pull request #258: URL: https://github.com/apache/apisix-ingress-controller/pull/258#issuecomment-783917764 @Junnplus Please merge the newest master branch when you have time, the CI failure was 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] idbeta commented on pull request #3573: docs: added users to PoweredBy
idbeta commented on pull request #3573: URL: https://github.com/apache/apisix/pull/3573#issuecomment-783867761 > @idbeta > Should be solved by #3609. thanks. 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 pull request #1498: ci: add ci check for gofmt
juzhiyuan commented on pull request #1498: URL: https://github.com/apache/apisix-dashboard/pull/1498#issuecomment-783867613 @nic-chen would better request reviewers so they could see the notification. 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 #3638: fix: correct the template of dns_resolver_valid
membphis merged pull request #3638: URL: https://github.com/apache/apisix/pull/3638 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: correct the template of dns_resolver_valid (#3638)
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 7edf9d6 fix: correct the template of dns_resolver_valid (#3638) 7edf9d6 is described below commit 7edf9d6ed49b35059fb966b54348e14029d0d9ba Author: 罗泽轩 AuthorDate: Tue Feb 23 11:59:33 2021 +0800 fix: correct the template of dns_resolver_valid (#3638) --- .travis/apisix_cli_test/test_dns.sh | 61 + apisix/cli/ngx_tpl.lua | 4 +-- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/.travis/apisix_cli_test/test_dns.sh b/.travis/apisix_cli_test/test_dns.sh new file mode 100755 index 000..d1aca15 --- /dev/null +++ b/.travis/apisix_cli_test/test_dns.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# +# 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. +# + +# 'make init' operates scripts and related configuration files in the current directory +# The 'apisix' command is a command in the /usr/local/apisix, +# and the configuration file for the operation is in the /usr/local/apisix/conf + +. ./.travis/apisix_cli_test/common.sh + +# dns_resolver_valid +echo ' +apisix: + dns_resolver: +- 127.0.0.1 +- "[::1]:5353" + dns_resolver_valid: 30 +' > conf/config.yaml + +make init + +if ! grep "resolver 127.0.0.1 \[::1\]:5353 valid=30;" conf/nginx.conf > /dev/null; then +echo "failed: dns_resolver_valid doesn't take effect" +exit 1 +fi + +echo ' +apisix: + stream_proxy: +tcp: + - 9100 + dns_resolver: +- 127.0.0.1 +- "[::1]:5353" + dns_resolver_valid: 30 +' > conf/config.yaml + +make init + +count=$(grep -c "resolver 127.0.0.1 \[::1\]:5353 valid=30;" conf/nginx.conf) +if [ "$count" -ne 2 ]; then +echo "failed: dns_resolver_valid doesn't take effect" +exit 1 +fi + +echo "pass: dns_resolver_valid takes effect" diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua index cf0799f..b331b5f 100644 --- a/apisix/cli/ngx_tpl.lua +++ b/apisix/cli/ngx_tpl.lua @@ -65,7 +65,7 @@ stream { lua_shared_dict lrucache-lock-stream 10m; -resolver {% for _, dns_addr in ipairs(dns_resolver or {}) do %} {*dns_addr*} {% end %} {% if dns_resolver_valid then %}valid={*dns_resolver_valid*}{% end %}; +resolver {% for _, dns_addr in ipairs(dns_resolver or {}) do %} {*dns_addr*} {% end %} {% if dns_resolver_valid then %} valid={*dns_resolver_valid*}{% end %}; resolver_timeout {*resolver_timeout*}; # stream configuration snippet starts @@ -187,7 +187,7 @@ http { lua_socket_log_errors off; -resolver {% for _, dns_addr in ipairs(dns_resolver or {}) do %} {*dns_addr*} {% end %} {% if dns_resolver_valid then %}valid={*dns_resolver_valid*}{% end %}; +resolver {% for _, dns_addr in ipairs(dns_resolver or {}) do %} {*dns_addr*} {% end %} {% if dns_resolver_valid then %} valid={*dns_resolver_valid*}{% end %}; resolver_timeout {*resolver_timeout*}; lua_http10_buffering off;
[apisix] branch master updated: docs: added users to PoweredBy (#3573)
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 3be910d docs: added users to PoweredBy (#3573) 3be910d is described below commit 3be910d69bd006212aa78cb97e7a6eb332c5479d Author: 琚致远 AuthorDate: Tue Feb 23 11:58:59 2021 +0800 docs: added users to PoweredBy (#3573) --- doc/powered-by.md | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/powered-by.md b/doc/powered-by.md index 87c3759..850bb52 100644 --- a/doc/powered-by.md +++ b/doc/powered-by.md @@ -24,33 +24,48 @@ or providing commercial products including APISIX. Users are encouraged to add themselves to this page, [issue](https://github.com/apache/apisix/issues/487) and PR are welcomed. +1. https://hy.10086.cn/"; rel="nofollow">中移杭研 +1. http://www.163.com"; rel="nofollow">Netease 网易 1. https://www.360.cn/"; rel="nofollow">360 奇虎 +1. http://51tiangou.com/"; rel="nofollow">51tiangou 大商天狗 +1. http://aimiaobi.com/"; rel="nofollow">aimiaobi 妙笔 AI 1. https://www.chaolian360.com/"; rel="nofollow">chaolian 超链云商 1. http://www.cunw.com.cn/"; rel="nofollow">cunw 湖南新云网 +1. https://www.daocloud.io/"; rel="nofollow">DaoCloud 1. https://www.dasouche.com/"; rel="nofollow">dasouche 大搜车 1. https://www.dataoke.com/"; rel="nofollow">dataoke 大淘客 +1. http://dian.so/"; rel="nofollow">小电科技 +1. https://www.didachuxing.com/"; rel="nofollow">嘀嗒出行 1. https://www.efactory-project.eu/"; rel="nofollow">eFactory 1. https://www.ehomepay.com.cn/"; rel="nofollow">ehomepay 理房通 +1. https://ezone.work/"; rel="nofollow">eZone 简单一点科技 1. https://fansup.mobi/"; rel="nofollow">fansup 1. http://haieruplus.com/"; rel="nofollow">haieruplus 海尔优家 1. http://www.hellowin.cn/"; rel="nofollow">hellowin 好洛维 1. https://www.hellotalk.com/"; rel="nofollow">HelloTalk, Inc. +1. https://www.htzhiyun.cn/"; rel="nofollow">航天网信 1. http://huawei.com/"; rel="nofollow">Huawei 华为 +1. https://www.huya.com/"; rel="nofollow">虎牙 +1. https://www.ihomefnt.com/"; rel="nofollow">ihomefnt 艾佳生活 1. https://www.jiandanxinli.com/"; rel="nofollow">jiandanxinli 简单心理 -1. https://jr.ly.com/"; rel="nofollow">jr.ly 同程金服 1. https://www.ke.com/"; rel="nofollow">ke.com 贝壳找房 +1. https://jr.ly.com/"; rel="nofollow">jr.ly 同程金服 1. https://www.meizu.com/"; rel="nofollow">Meizu 魅族 +1. https://www.mingyuanyun.com/"; rel="nofollow">明源云客 1. https://www.jpl.nasa.gov"; rel="nofollow">NASA JPL 美国国家航空航天局 喷气推进实验室 -1. http://www.163.com"; rel="nofollow">Netease 网易 +1. https://open.youtu.qq.com/"; rel="nofollow">Youtu 腾讯优图 1. http://sinog2c.com"; rel="nofollow">sinog2c 湖南国科云通 1. https://www.sinovatech.com"; rel="nofollow">sinovatech 炎黄新星 1. http://taikang.com/"; rel="nofollow">Taikanglife 泰康云 1. http://www.tangdou.com/"; rel="nofollow">tangdou 糖豆网 1. https://cloud.tencent.com/"; rel="nofollow">Tencent Cloud 腾讯云 +1. https://www.teamones.cn/"; rel="nofollow">万思 1. http://travelsky.com"; rel="nofollow"> Travelsky 中国航信 1. https://vbill.cn/"; rel="nofollow">vbill 随行付 1. https://www.willclass.com/"; rel="nofollow">willclass 会课 1. https://www.xin.com/"; rel="nofollow">Xin 优信二手车 +1. https://xueqiu.com/"; rel="nofollow">雪球 +1. https://www.zihao.biz/"; rel="nofollow">紫豪网络 1. https://www.zuzuche.com/"; rel="nofollow">zuzuche 租租车 1. https://www.zybang.com/"; rel="nofollow">zybang 作业帮
[GitHub] [apisix] spacewander merged pull request #3573: docs: added users to PoweredBy
spacewander merged pull request #3573: URL: https://github.com/apache/apisix/pull/3573 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 #3573: docs: added users to PoweredBy
spacewander commented on pull request #3573: URL: https://github.com/apache/apisix/pull/3573#issuecomment-783860286 @idbeta Should be solved by https://github.com/apache/apisix/pull/3609. 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 a change in pull request #3615: feat: add consul kv discovery module
spacewander commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580753884 ## File path: doc/discovery/consul_kv.md ## @@ -0,0 +1,147 @@ + +` + +## Summary + +For users who used [nginx-upsync-module](https://github.com/weibocom/nginx-upsync-module) and consul key value for service discovery way, as we Weibo Mobile Team, maybe need it. + +Thanks to @fatman-x guy, who developed this module, called `consul_kv`, and its worker process data flow is below: +![](https://user-images.githubusercontent.com/548385/107141841-6ced3e00-6966-11eb-8aa4-bc790a4ad113.png) + +## Configuration for discovery client + +### Configuration for Consul KV + +Add following configuration in `conf/config.yaml` : + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; + - "http://127.0.0.1:8600"; +prefix: "upstreams" +skip_keys:# if you need to skip special keys + - "upstreams/unused_api/" +timeout: + connect: 1000 # default 2000 ms + read: 1000 # default 2000 ms + wait: 60# default 60 sec +weight: 1 # default 1 +fetch_interval: 5 # default 3 sec, only take effect for keepalive: false way +keepalive: true # default true, use the long pull way to query consul servers +default_server: # you can define default server when missing hit + host: "127.0.0.1" + port: 20999 + metadata: +fail_timeout: 1 # default 1 ms +weight: 1 # default 1 +max_fails: 1 # default 1 +``` + +And you can config it in short by default value: + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; +``` + +The `keepalive` has two optional values: + +- `true`, default and recommend value, use the long pull way to query consul servers +- `false`, not recommend, it would use the short pull way to query consul servers, then you can set the `fetch_interval` for fetch interval + +### Register Http API Services + +Service register Key&Value template: + +``` +Key:{Prefix}/{Service_Name}/{IP}:{Port} +Value: {"weight": , "max_fails": , "fail_timeout": } +``` + +The register consul key use `upstreams` as prefix by default. The http api service name called `webpages` for example, and you can also use `webpages/oneteam/hello` as service name. The api instance of node's ip and port make up new key: `:`. + +Now, register nodes into consul: + +```shell +curl \ +-X PUT \ +-d ' {"weight": 1, "max_fails": 2, "fail_timeout": 1}' \ +http://127.0.0.1:8500/v1/kv/upstreams/webpages/172.19.5.12:8000 + +curl \ +-X PUT \ +-d ' {"weight": 1, "max_fails": 2, "fail_timeout": 1}' \ +http://127.0.0.1:8500/v1/kv/upstreams/webpages/172.19.5.13:8000 +``` + +In some case, same keys exist in different consul servers. +To avoid confusion, use the full consul key url path as service name in practice. + +### Upstream setting + +Here is an example of routing a request with a URL of "/*" to a service which named "http://127.0.0.1:8500/v1/kv/upstreams/webpages/"; and use consul_kv discovery client in the registry : + +```shell +$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d ' +{ +"uri": "/*", +"upstream": { +"service_name": "http://127.0.0.1:8500/v1/kv/upstreams/webpages/";, Review comment: @yongboy What about splitting it into `discovery_center_id` and `service_name`? Like: ``` { "discovery_center_id": "http://127.0.0.1:8500";, "service_name": "/v1/kv/upstreams/webpages/" } ``` 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] hnlq715 commented on a change in pull request #3615: feat: add consul kv discovery module
hnlq715 commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580747982 ## File path: doc/discovery/consul_kv.md ## @@ -0,0 +1,147 @@ + +` + +## Summary + +For users who used [nginx-upsync-module](https://github.com/weibocom/nginx-upsync-module) and consul key value for service discovery way, as we Weibo Mobile Team, maybe need it. + +Thanks to @fatman-x guy, who developed this module, called `consul_kv`, and its worker process data flow is below: +![](https://user-images.githubusercontent.com/548385/107141841-6ced3e00-6966-11eb-8aa4-bc790a4ad113.png) + +## Configuration for discovery client + +### Configuration for Consul KV + +Add following configuration in `conf/config.yaml` : + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; + - "http://127.0.0.1:8600"; +prefix: "upstreams" +skip_keys:# if you need to skip special keys + - "upstreams/unused_api/" +timeout: + connect: 1000 # default 2000 ms + read: 1000 # default 2000 ms + wait: 60# default 60 sec +weight: 1 # default 1 +fetch_interval: 5 # default 3 sec, only take effect for keepalive: false way +keepalive: true # default true, use the long pull way to query consul servers +default_server: # you can define default server when missing hit + host: "127.0.0.1" + port: 20999 + metadata: +fail_timeout: 1 # default 1 ms +weight: 1 # default 1 +max_fails: 1 # default 1 +``` + +And you can config it in short by default value: + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; +``` + +The `keepalive` has two optional values: + +- `true`, default and recommend value, use the long pull way to query consul servers +- `false`, not recommend, it would use the short pull way to query consul servers, then you can set the `fetch_interval` for fetch interval + +### Register Http API Services + +Service register Key&Value template: + +``` +Key:{Prefix}/{Service_Name}/{IP}:{Port} +Value: {"weight": , "max_fails": , "fail_timeout": } +``` + +The register consul key use `upstreams` as prefix by default. The http api service name called `webpages` for example, and you can also use `webpages/oneteam/hello` as service name. The api instance of node's ip and port make up new key: `:`. + +Now, register nodes into consul: + +```shell +curl \ +-X PUT \ +-d ' {"weight": 1, "max_fails": 2, "fail_timeout": 1}' \ +http://127.0.0.1:8500/v1/kv/upstreams/webpages/172.19.5.12:8000 + +curl \ +-X PUT \ +-d ' {"weight": 1, "max_fails": 2, "fail_timeout": 1}' \ +http://127.0.0.1:8500/v1/kv/upstreams/webpages/172.19.5.13:8000 +``` + +In some case, same keys exist in different consul servers. +To avoid confusion, use the full consul key url path as service name in practice. + +### Upstream setting + +Here is an example of routing a request with a URL of "/*" to a service which named "http://127.0.0.1:8500/v1/kv/upstreams/webpages/"; and use consul_kv discovery client in the registry : + +```shell +$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d ' +{ +"uri": "/*", +"upstream": { +"service_name": "http://127.0.0.1:8500/v1/kv/upstreams/webpages/";, Review comment: Maybe we can split service_name into address, prefix and name? To better adopt other discovery_type like etcd or nacos in the 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-ingress-controller] gxthrj merged pull request #250: feat: ingress v1
gxthrj merged pull request #250: URL: https://github.com/apache/apisix-ingress-controller/pull/250 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] Yiyiyimu commented on a change in pull request #3621: ci: auto generate and check for rpm package
Yiyiyimu commented on a change in pull request #3621: URL: https://github.com/apache/apisix/pull/3621#discussion_r580748858 ## File path: .github/workflows/centos7-ci.yml ## @@ -29,6 +29,15 @@ jobs: with: submodules: recursive +- name: Build rpm package + run: | +sudo gem install --no-document fpm +# WOULD CHANGE TO MASTER WHEN PR GETS MERGED +git clone https://github.com/idbeta/build-tools.git +cd build-tools +git checkout new-method-to-package Review comment: Thanks! 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] Yiyiyimu merged pull request #3630: test: clean up temporary files after CLI test
Yiyiyimu merged pull request #3630: URL: https://github.com/apache/apisix/pull/3630 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 (986c6f2 -> 695993b)
This is an automated email from the ASF dual-hosted git repository. shuyangw pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 986c6f2 chore: remove the obsolete TODO (#3628) add 695993b test: clean up temporary files after CLI test (#3630) No new revisions were added by this update. Summary of changes: .travis/apisix_cli_test/test_main.sh | 6 ++ 1 file changed, 6 insertions(+)
[apisix-ingress-controller] branch master updated: fix: CI broken problem (#260)
This is an automated email from the ASF dual-hosted git repository. kvn pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git The following commit(s) were added to refs/heads/master by this push: new 0184098 fix: CI broken problem (#260) 0184098 is described below commit 0184098dbf6f61b77cbf97c30001e744a0f05c7a Author: Alex Zhang AuthorDate: Tue Feb 23 11:30:29 2021 +0800 fix: CI broken problem (#260) --- test/e2e/testdata/apisix-gw-config-default.yaml | 2 +- test/e2e/testdata/apisix-gw-config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/testdata/apisix-gw-config-default.yaml b/test/e2e/testdata/apisix-gw-config-default.yaml index d1ae02b..32e7263 100644 --- a/test/e2e/testdata/apisix-gw-config-default.yaml +++ b/test/e2e/testdata/apisix-gw-config-default.yaml @@ -98,7 +98,7 @@ apisix: # dns_resolver: # If not set, read from `/etc/resolv.conf` # - 1.1.1.1 # - 8.8.8.8 - dns_resolver_valid: 30 # valid time for dns result 30 seconds + # dns_resolver_valid: 30 # valid time for dns result 30 seconds resolver_timeout: 5 # resolver timeout ssl: enable: true diff --git a/test/e2e/testdata/apisix-gw-config.yaml b/test/e2e/testdata/apisix-gw-config.yaml index 4fbcd17..649fe58 100644 --- a/test/e2e/testdata/apisix-gw-config.yaml +++ b/test/e2e/testdata/apisix-gw-config.yaml @@ -63,7 +63,7 @@ apisix: # dns_resolver: # If not set, read from `/etc/resolv.conf` # - 1.1.1.1 # - 8.8.8.8 - dns_resolver_valid: 30 # valid time for dns result 30 seconds + # dns_resolver_valid: 30 # valid time for dns result 30 seconds resolver_timeout: 5 # resolver timeout ssl: enable: true
[GitHub] [apisix-ingress-controller] gxthrj merged pull request #260: fix: CI broken problem
gxthrj merged pull request #260: URL: https://github.com/apache/apisix-ingress-controller/pull/260 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-ingress-controller] tokers edited a comment on issue #248: discuss: ApisixRoute change struct
tokers edited a comment on issue #248: URL: https://github.com/apache/apisix-ingress-controller/issues/248#issuecomment-781125680 The `ApisixRoute` should leverage the advantages of APISIX Routes as soon as possible, for instance, the flexible route match, native plugins support. ```yaml apiVersion: apisix.apache.org/v2alpha1 kind: ApisixRoute metadata: name: httpbin-route spec: http: - priority: 10 match: paths: - "/a" - "/bb*" methods: - GET - POST hosts: - a.com - aa.com remote_addrs: - 192.168.1.0/24 - 10.0.5.12 nginxVars: - "$binary_remote_addr" backend: serviceName: httpbin servicePort: 8080 serviceLevel: endpoint # by default is endpoint, optional value can be "service". plugins: - name: redirect enable: true config: aaa: bbb ccc: ddd ``` The `scripts` are used by plugin orchestration, we don't use it. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander opened a new pull request #3638: fix: corrct the template of dns_resolver_valid
spacewander opened a new pull request #3638: URL: https://github.com/apache/apisix/pull/3638 Signed-off-by: spacewander ### 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? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first** 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-ingress-controller] tokers commented on pull request #260: fix: CI broken problem
tokers commented on pull request #260: URL: https://github.com/apache/apisix-ingress-controller/pull/260#issuecomment-783847945 @gxthrj Please take a look. 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-ingress-controller] tokers opened a new pull request #260: fix: CI broken problem
tokers opened a new pull request #260: URL: https://github.com/apache/apisix-ingress-controller/pull/260 Please answer these questions before submitting a pull request - Why submit this pull request? - [x] Bugfix - [ ] New feature provided - [ ] Improve performance - [ ] Backport patches - Related issues ___ ### Bugfix - Description - How to fix? ___ ### New feature or improvement - Describe the details and related test reports. ___ ### Backport patches - Why need to backport? - Source branch - Related commits and pull requests - Target branch 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-docker] gxthrj commented on a change in pull request #133: CI: add apisix-docker test
gxthrj commented on a change in pull request #133: URL: https://github.com/apache/apisix-docker/pull/133#discussion_r580730080 ## File path: .github/workflows/apisix-alpine-docker-test.yaml ## @@ -0,0 +1,31 @@ +name: APISIX Alpine docker Test + +on: + push: +branches: + - master + pull_request: +branches: + - master + +jobs: + build: +runs-on: ubuntu-latest +steps: + - uses: actions/checkout@v2 + + - name: Build and run +run: | + docker build -t apisix:alpine -f ./alpine/Dockerfile . + docker-compose -f ./alpine/docker-compose.yaml up -d + sleep 30 + docker logs docker_apisix_1 + + - name: Test +run: | + curl http://127.0.0.1:9080/apisix/admin/schema/service -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' + code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/apisix/admin/schema/service -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1') + if [ ! $code -eq 200 ]; then Review comment: OK, will change to route test 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 edited a comment on pull request #3573: docs: added users to PoweredBy
idbeta edited a comment on pull request #3573: URL: https://github.com/apache/apisix/pull/3573#issuecomment-783825677 > @juzhiyuan please merge the master branch > > @idbeta you can take a look the ci too: https://github.com/apache/apisix/pull/3573/checks?check_run_id=1869908569#step:10:703 sorry, I did not find the reason for the failure. It seems that the case is unstable. @syzh and @spacewander Can you check it? ``` t/node/invalid-route.t (Wstat: 0 Tests: 18 Failed: 3) Failed tests: 16-18 Parse errors: No plan found in TAP output ``` 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 commented on pull request #3573: docs: added users to PoweredBy
idbeta commented on pull request #3573: URL: https://github.com/apache/apisix/pull/3573#issuecomment-783825677 > @juzhiyuan please merge the master branch > > @idbeta you can take a look the ci too: https://github.com/apache/apisix/pull/3573/checks?check_run_id=1869908569#step:10:703 > @juzhiyuan please merge the master branch > > @idbeta you can take a look the ci too: https://github.com/apache/apisix/pull/3573/checks?check_run_id=1869908569#step:10:703 sorry, I did not find the reason for the failure. It seems that the case is unstable. @syzh and @spacewander Can you check it? ``` t/node/invalid-route.t (Wstat: 0 Tests: 18 Failed: 3) Failed tests: 16-18 Parse errors: No plan found in TAP output ``` 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 #1490: feat: support yaml to config plugin in plugin config page
LiteSun commented on a change in pull request #1490: URL: https://github.com/apache/apisix-dashboard/pull/1490#discussion_r580727300 ## File path: web/src/components/Plugin/PluginDetail.tsx ## @@ -92,6 +93,11 @@ const PluginDetail: React.FC = ({ const ref = useRef(null); const data = initialData[name] || {}; const pluginType = pluginList.find((item) => item.name === name)?.type; + const [codeMirrorMode, setCodeMirrorMode] = useState('javascript'); + const modeOptions = [ +{ label: 'Json', value: 'javascript' }, Review comment: why use `javascript ` here? 🤔 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-io edited a comment on pull request #250: feat: ingress v1
codecov-io edited a comment on pull request #250: URL: https://github.com/apache/apisix-ingress-controller/pull/250#issuecomment-775020837 # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=h1) Report > Merging [#250](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=desc) (c8a2908) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/09787ed80507be7f2a7b97d3aefddd28cfcad4a6?el=desc) (09787ed) will **increase** coverage by `3.23%`. > The diff coverage is `88.66%`. [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=tree) ```diff @@Coverage Diff @@ ## master #250 +/- ## == + Coverage 48.41% 51.65% +3.23% == Files 35 34 -1 Lines2239 2358 +119 == + Hits 1084 1218 +134 + Misses 1007 982 -25 - Partials 148 158 +10 ``` | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [pkg/ingress/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2luZ3Jlc3MvYXBpc2l4L3JvdXRlLmdv) | `0.00% <ø> (ø)` | | | [pkg/kube/translation/apisix\_upstream.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3Vwc3RyZWFtLmdv) | `88.08% <ø> (ø)` | | | [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdHJhbnNsYXRvci5nbw==) | `53.03% <0.00%> (ø)` | | | [pkg/apisix/cache/memdb.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9jYWNoZS9tZW1kYi5nbw==) | `66.37% <50.00%> (-0.91%)` | :arrow_down: | | [pkg/config/config.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2NvbmZpZy9jb25maWcuZ28=) | `80.00% <50.00%> (-3.34%)` | :arrow_down: | | [pkg/kube/translation/ingress.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vaW5ncmVzcy5nbw==) | `91.93% <91.93%> (ø)` | | | [cmd/ingress/ingress.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-Y21kL2luZ3Jlc3MvaW5ncmVzcy5nbw==) | `73.97% <100.00%> (+2.76%)` | :arrow_up: | | [pkg/apisix/resource.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9yZXNvdXJjZS5nbw==) | `77.77% <100.00%> (+0.22%)` | :arrow_up: | | [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `40.52% <100.00%> (+0.78%)` | :arrow_up: | | [pkg/seven/state/solver.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL3NldmVuL3N0YXRlL3NvbHZlci5nbw==) | `1.98% <0.00%> (-1.99%)` | :arrow_down: | | ... and [4 more](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree-more) | | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=footer). Last update [09787ed...c8a2908](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). 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] yongboy commented on a change in pull request #3615: feat: add consul kv discovery module
yongboy commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580719632 ## File path: apisix/discovery/consul_kv.lua ## @@ -0,0 +1,415 @@ +-- +-- 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 local_conf = require("apisix.core.config_local").local_conf() +local core = require("apisix.core") +local resty_consul = require('resty.consul') +local cjson = require('cjson') +local http = require('resty.http') +local ipairs = ipairs +local error = error +local ngx= ngx +local unpack = unpack +local ngx_re_match = ngx.re.match +local tonumber = tonumber +local pairs = pairs +local ipairs = ipairs +local ngx_timer_at = ngx.timer.at +local ngx_timer_every= ngx.timer.every +local log= core.log +local ngx_decode_base64 = ngx.decode_base64 +local json_delay_encode = core.json.delay_encode +local cjson_null = cjson.null + +local applications = core.table.new(0, 5) +local default_service +local default_weight +local default_prefix_rule +local skip_keys_map = core.table.new(0, 1) + +local events +local events_list +local consul_apps + +local schema = { +type = "object", +properties = { +servers = { +type = "array", +minItems = 1, +items = { +type = "string", +} +}, +fetch_interval = {type = "integer", minimum = 1, default = 3}, +keepalive = { +type = "boolean", +default = true +}, +prefix = {type = "string", default = "upstreams"}, +weight = {type = "integer", minimum = 1, default = 1}, +timeout = { +type = "object", +properties = { +connect = {type = "integer", minimum = 1, default = 2000}, +read = {type = "integer", minimum = 1, default = 2000}, +wait = {type = "integer", minimum = 1, default = 60} +}, +default = { +connect = 2000, +read = 2000, +wait = 60, +} +}, +skip_keys = { +type = "array", +minItems = 1, +items = { +type = "string", +} +}, +default_service = { +type = "object", +properties = { +host = {type = "string"}, +port = {type = "integer"}, +metadata = { +type = "object", +properties = { +fail_timeout = {type = "integer", default = 1}, +weigth = {type = "integer", default = 1}, +max_fails = {type = "integer", default = 1} +}, +default = { +fail_timeout = 1, +weigth = 1, +max_fails = 1 +} +} +} +} +}, + +required = {"servers"} +} + +local _M = { +version = 0.3, +} + + +local function discovery_consul_callback(data, event, source, pid) +applications = data +log.notice("update local variable application, event is: ", event, +"source: ", source, "server pid:", pid, +", application: ", core.json.encode(applications, true)) +end + + +function _M.all_nodes() +return applications +end + + +function _M.nodes(service_name) +if not applications then +log.error("application is nil, failed to fetch nodes for : ", service_name) +return +end + +local resp_list = applications[service_name] + +if not resp_list then +log.error("fetch nodes failed by ", service_name, ", return default service") +return default_service and {default_service} +end + +log.info("process id: ", ngx.worker.id(), ", applications[", service_name, "] = ", +json_delay_encode(resp_list, true)) + +return resp_list +end + + +local function parse_instance(nod
[GitHub] [apisix] yongboy commented on a change in pull request #3615: feat: add consul kv discovery module
yongboy commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580719261 ## File path: apisix/discovery/consul_kv.lua ## @@ -0,0 +1,415 @@ +-- +-- 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 local_conf = require("apisix.core.config_local").local_conf() +local core = require("apisix.core") +local resty_consul = require('resty.consul') +local cjson = require('cjson') +local http = require('resty.http') +local ipairs = ipairs +local error = error +local ngx= ngx +local unpack = unpack +local ngx_re_match = ngx.re.match +local tonumber = tonumber +local pairs = pairs +local ipairs = ipairs +local ngx_timer_at = ngx.timer.at +local ngx_timer_every= ngx.timer.every +local log= core.log +local ngx_decode_base64 = ngx.decode_base64 +local json_delay_encode = core.json.delay_encode +local cjson_null = cjson.null + +local applications = core.table.new(0, 5) +local default_service +local default_weight +local default_prefix_rule +local skip_keys_map = core.table.new(0, 1) + +local events +local events_list +local consul_apps + +local schema = { +type = "object", +properties = { +servers = { +type = "array", +minItems = 1, +items = { +type = "string", +} +}, +fetch_interval = {type = "integer", minimum = 1, default = 3}, +keepalive = { +type = "boolean", +default = true +}, +prefix = {type = "string", default = "upstreams"}, +weight = {type = "integer", minimum = 1, default = 1}, +timeout = { +type = "object", +properties = { +connect = {type = "integer", minimum = 1, default = 2000}, +read = {type = "integer", minimum = 1, default = 2000}, +wait = {type = "integer", minimum = 1, default = 60} +}, +default = { +connect = 2000, +read = 2000, +wait = 60, +} +}, +skip_keys = { +type = "array", +minItems = 1, +items = { +type = "string", +} +}, +default_service = { +type = "object", +properties = { +host = {type = "string"}, +port = {type = "integer"}, +metadata = { +type = "object", +properties = { +fail_timeout = {type = "integer", default = 1}, +weigth = {type = "integer", default = 1}, +max_fails = {type = "integer", default = 1} +}, +default = { +fail_timeout = 1, +weigth = 1, +max_fails = 1 +} +} +} +} +}, + +required = {"servers"} +} + +local _M = { +version = 0.3, +} + + +local function discovery_consul_callback(data, event, source, pid) +applications = data +log.notice("update local variable application, event is: ", event, +"source: ", source, "server pid:", pid, +", application: ", core.json.encode(applications, true)) +end + + +function _M.all_nodes() +return applications +end + + +function _M.nodes(service_name) +if not applications then +log.error("application is nil, failed to fetch nodes for : ", service_name) +return +end + +local resp_list = applications[service_name] + +if not resp_list then +log.error("fetch nodes failed by ", service_name, ", return default service") +return default_service and {default_service} +end + +log.info("process id: ", ngx.worker.id(), ", applications[", service_name, "] = ", +json_delay_encode(resp_list, true)) + +return resp_list +end + + +local function parse_instance(nod
[GitHub] [apisix] yongboy commented on a change in pull request #3615: feat: add consul kv discovery module
yongboy commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580718933 ## File path: doc/discovery/consul_kv.md ## @@ -0,0 +1,148 @@ + +` + +## Summary + +For users who used [nginx-upsync-module](https://github.com/weibocom/nginx-upsync-module) and consul key value for service discovery way, as we Weibo Mobile Team, maybe need it. + +Thanks to @fatman-x guy, who developed this module, called `consul_kv`, and its worker process data flow is below: +![](https://user-images.githubusercontent.com/548385/107141841-6ced3e00-6966-11eb-8aa4-bc790a4ad113.png) + +## Configuration for discovery client + +### Configuration for Consul KV + +Add following configuration in `conf/config.yaml` : + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; + - "http://127.0.0.1:8600"; +prefix: "upstreams" +skip_keys:# if you need to skip special keys + - "upstreams/unused_api/" +timeout: + connect: 1000 # default 2000 ms + read: 1000 # default 2000 ms + wait: 60# default 60 sec +weight: 1 # default 1 +fetch_interval: 5 # default 3 sec, only take effect for keepalive: short way Review comment: Y 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] yongboy commented on a change in pull request #3615: feat: add consul kv discovery module
yongboy commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580718679 ## File path: doc/discovery/consul_kv.md ## @@ -0,0 +1,148 @@ + +` + +## Summary + +For users who used [nginx-upsync-module](https://github.com/weibocom/nginx-upsync-module) and consul key value for service discovery way, as we Weibo Mobile Team, maybe need it. + +Thanks to @fatman-x guy, who developed this module, called `consul_kv`, and its worker process data flow is below: +![](https://user-images.githubusercontent.com/548385/107141841-6ced3e00-6966-11eb-8aa4-bc790a4ad113.png) + +## Configuration for discovery client + +### Configuration for Consul KV + +Add following configuration in `conf/config.yaml` : + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; + - "http://127.0.0.1:8600"; +prefix: "upstreams" +skip_keys:# if you need to skip special keys + - "upstreams/unused_api/" +timeout: + connect: 1000 # default 2000 ms + read: 1000 # default 2000 ms + wait: 60# default 60 sec +weight: 1 # default 1 +fetch_interval: 5 # default 3 sec, only take effect for keepalive: short way +keepalive: true # default true, use the long pull way to query consul servers +default_server: # you can define default server when missing hit + host: "127.0.0.1" + port: 20999 + metadata: +fail_timeout: 1 # default 1 ms +weight: 1 # default 1 +max_fails: 1 # default 1 +``` + +And you can config it in short by default value: + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; +``` + +The `keepalive` has two optional values: + +- `true`, default and recommend value, use the long pull way to query consul servers +- `false`, not recommend, it would use the short pull way to query consul servers, then you can set the `fetch_interval` for fetch interval + +### Register Http API Services + +Service register Key&Value template: + +``` +Key:{Prefix}/{Service_Name}/{IP}:{Port} +Value: {"weight": , "max_fails": , "fail_timeout": } +``` + +The register consul key use `upstreams` as prefix by default. The http api service name called `webpages` for example, and you can also use `webpages/oneteam/hello` as service name. The api instance of node's ip and port make up new key: `:`. + +Now, register nodes into consul: + +```bash +curl \ +-X PUT \ +-d ' {"weight": 1, "max_fails": 2, "fail_timeout": 1}' \ +http://127.0.0.1:8500/v1/kv/upstreams/webpages/172.19.5.12:8000 + +curl \ +-X PUT \ +-d ' {"weight": 1, "max_fails": 2, "fail_timeout": 1}' \ +http://127.0.0.1:8500/v1/kv/upstreams/webpages/172.19.5.13:8000 +``` + +In some case, same keys exist in different consul servers. +To avoid confusion, use the full consul key url path as service name in practice. + +### Upstream setting + +Here is an example of routing a request with a URL of "/*" to a service which named "http://127.0.0.1:8500/v1/kv/upstreams/webpages/"; and use consul_kv discovery client in the registry : + +```shell +$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d ' +{ +"uri": "/*", +"upstream": { +"service_name": "http://127.0.0.1:8500/v1/kv/upstreams/webpages/";, +"type": "roundrobin", +"discovery_type": "consul_kv" +} +}' +``` + +The format response as below: + +```json +{ + "node": { +"value": { + "priority": 0, + "update_time": 1612755230, + "upstream": { +"discovery_type": "consul_kv", +"service_name": "http://127.0.0.1:8500/v1/kv/upstreams/webpages/";, +"hash_on": "vars", +"type": "roundrobin", +"pass_host": "pass" + }, + "id": "1", + "uri": "/*", + "create_time": 1612755230, + "status": 1, + "saas_id": "" +}, +"key": "/apisix/routes/1" + }, + "action": "set" +} +``` + +More usage you can find in `apisix/t/discovery/consul_kv.t` file. Review comment: Y 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] yongboy commented on a change in pull request #3615: feat: add consul kv discovery module
yongboy commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580718099 ## File path: doc/discovery/consul_kv.md ## @@ -0,0 +1,148 @@ + +` + +## Summary + +For users who used [nginx-upsync-module](https://github.com/weibocom/nginx-upsync-module) and consul key value for service discovery way, as we Weibo Mobile Team, maybe need it. + +Thanks to @fatman-x guy, who developed this module, called `consul_kv`, and its worker process data flow is below: +![](https://user-images.githubusercontent.com/548385/107141841-6ced3e00-6966-11eb-8aa4-bc790a4ad113.png) + +## Configuration for discovery client + +### Configuration for Consul KV + +Add following configuration in `conf/config.yaml` : + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; + - "http://127.0.0.1:8600"; +prefix: "upstreams" +skip_keys:# if you need to skip special keys + - "upstreams/unused_api/" +timeout: + connect: 1000 # default 2000 ms + read: 1000 # default 2000 ms + wait: 60# default 60 sec +weight: 1 # default 1 +fetch_interval: 5 # default 3 sec, only take effect for keepalive: short way +keepalive: true # default true, use the long pull way to query consul servers +default_server: # you can define default server when missing hit + host: "127.0.0.1" + port: 20999 + metadata: +fail_timeout: 1 # default 1 ms +weight: 1 # default 1 +max_fails: 1 # default 1 +``` + +And you can config it in short by default value: + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; +``` + +The `keepalive` has two optional values: + +- `true`, default and recommend value, use the long pull way to query consul servers +- `false`, not recommend, it would use the short pull way to query consul servers, then you can set the `fetch_interval` for fetch interval + +### Register Http API Services + +Service register Key&Value template: + +``` +Key:{Prefix}/{Service_Name}/{IP}:{Port} +Value: {"weight": , "max_fails": , "fail_timeout": } +``` + +The register consul key use `upstreams` as prefix by default. The http api service name called `webpages` for example, and you can also use `webpages/oneteam/hello` as service name. The api instance of node's ip and port make up new key: `:`. + +Now, register nodes into consul: + +```bash +curl \ +-X PUT \ +-d ' {"weight": 1, "max_fails": 2, "fail_timeout": 1}' \ +http://127.0.0.1:8500/v1/kv/upstreams/webpages/172.19.5.12:8000 + +curl \ +-X PUT \ +-d ' {"weight": 1, "max_fails": 2, "fail_timeout": 1}' \ +http://127.0.0.1:8500/v1/kv/upstreams/webpages/172.19.5.13:8000 +``` + +In some case, same keys exist in different consul servers. +To avoid confusion, use the full consul key url path as service name in practice. + +### Upstream setting + +Here is an example of routing a request with a URL of "/*" to a service which named "http://127.0.0.1:8500/v1/kv/upstreams/webpages/"; and use consul_kv discovery client in the registry : + +```shell +$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d ' +{ +"uri": "/*", +"upstream": { +"service_name": "http://127.0.0.1:8500/v1/kv/upstreams/webpages/";, +"type": "roundrobin", +"discovery_type": "consul_kv" +} +}' +``` + +The format response as below: + +```json +{ + "node": { +"value": { + "priority": 0, + "update_time": 1612755230, + "upstream": { +"discovery_type": "consul_kv", +"service_name": "http://127.0.0.1:8500/v1/kv/upstreams/webpages/";, +"hash_on": "vars", +"type": "roundrobin", +"pass_host": "pass" + }, + "id": "1", + "uri": "/*", + "create_time": 1612755230, + "status": 1, + "saas_id": "" Review comment: Y 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] yongboy commented on a change in pull request #3615: feat: add consul kv discovery module
yongboy commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580718060 ## File path: doc/discovery/consul_kv.md ## @@ -0,0 +1,148 @@ + +` + +## Summary + +For users who used [nginx-upsync-module](https://github.com/weibocom/nginx-upsync-module) and consul key value for service discovery way, as we Weibo Mobile Team, maybe need it. + +Thanks to @fatman-x guy, who developed this module, called `consul_kv`, and its worker process data flow is below: +![](https://user-images.githubusercontent.com/548385/107141841-6ced3e00-6966-11eb-8aa4-bc790a4ad113.png) + +## Configuration for discovery client + +### Configuration for Consul KV + +Add following configuration in `conf/config.yaml` : + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; + - "http://127.0.0.1:8600"; +prefix: "upstreams" +skip_keys:# if you need to skip special keys + - "upstreams/unused_api/" +timeout: + connect: 1000 # default 2000 ms + read: 1000 # default 2000 ms + wait: 60# default 60 sec +weight: 1 # default 1 +fetch_interval: 5 # default 3 sec, only take effect for keepalive: short way +keepalive: true # default true, use the long pull way to query consul servers +default_server: # you can define default server when missing hit + host: "127.0.0.1" + port: 20999 + metadata: +fail_timeout: 1 # default 1 ms +weight: 1 # default 1 +max_fails: 1 # default 1 +``` + +And you can config it in short by default value: + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; +``` + +The `keepalive` has two optional values: + +- `true`, default and recommend value, use the long pull way to query consul servers +- `false`, not recommend, it would use the short pull way to query consul servers, then you can set the `fetch_interval` for fetch interval + +### Register Http API Services + +Service register Key&Value template: + +``` +Key:{Prefix}/{Service_Name}/{IP}:{Port} +Value: {"weight": , "max_fails": , "fail_timeout": } +``` + +The register consul key use `upstreams` as prefix by default. The http api service name called `webpages` for example, and you can also use `webpages/oneteam/hello` as service name. The api instance of node's ip and port make up new key: `:`. + +Now, register nodes into consul: + +```bash Review comment: Y 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] yongboy commented on a change in pull request #3615: feat: add consul kv discovery module
yongboy commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580717997 ## File path: doc/discovery.md ## @@ -243,3 +244,8 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f Suppose both A-SERVICE and B-SERVICE provide a `/test` API. The above configuration allows access to A-SERVICE's `/test` API through `/a/test` and B-SERVICE's `/test` API through `/b/test`. **Notice**:When configuring `upstream.service_name`, `upstream.nodes` will no longer take effect, but will be replaced by 'nodes' obtained from the registry. + +## Discovery modules + +- eureka +- [consul key&value](discovery/consul_kv.md) Review comment: Y 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 #3637: fix: we should ensure one upstream only have one determinable scheme
spacewander opened a new pull request #3637: URL: https://github.com/apache/apisix/pull/3637 Signed-off-by: spacewander ### 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? * [x] Have you modified the corresponding document? * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first** 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] yongboy commented on a change in pull request #3615: feat: add consul kv discovery module
yongboy commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580717324 ## File path: apisix/discovery/consul_kv.lua ## @@ -0,0 +1,416 @@ +-- +-- 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 local_conf = require("apisix.core.config_local").local_conf() +local core = require("apisix.core") +local resty_consul = require('resty.consul') +local cjson = require('cjson') +local http = require('resty.http') +local ipairs = ipairs +local error = error +local ngx= ngx +local unpack = unpack +local string_gmatch = string.gmatch +local tonumber = tonumber +local pairs = pairs +local ipairs = ipairs +local ngx_timer_at = ngx.timer.at +local log= core.log +local ngx_decode_base64 = ngx.decode_base64 + +local applications = core.table.new(0, 5) +local default_service +local default_weight +local default_prefix_rule +local skip_keys_map = core.table.new(0, 1) + +local events +local events_list +local consul_apps + +local schema = { +type = "object", +properties = { +servers = { +type = "array", +minItems = 1, +items = { +type = "string", +} +}, +delay = {type = "integer", minimum = 1, default = 3}, +connect_type = { +type = "string", +enum = {"long", "short"}, +default = "long" +}, +prefix = {type = "string", default = "upstreams"}, +weight = {type = "integer", minimum = 0, default = 1}, +timeout = { +type = "object", +properties = { +connect = {type = "integer", minimum = 1, default = 2000}, +send = {type = "integer", minimum = 1, default = 2000}, +read = {type = "integer", minimum = 1, default = 2000} +}, +default = { +connect = 2000, +send = 2000, +read = 2000 +} +}, +skip_keys = { +type = "array", +minItems = 1, +items = { +type = "string", +} +}, +default_server = { +type = "object", +properties = { +host = {type = "string"}, +port = {type = "integer"}, +metadata = { +type = "object", +properties = { +fail_timeout = {type = "integer", default = 1}, +weigth = {type = "integer", default = 1}, +max_fails = {type = "integer", default = 1} +} +}, +default = { +connect = 1, +send = 1, +read = 1 +} +} +} +}, + +required = {"servers"} +} + +local _M = { +version = 0.3, +} + + +local function discovery_consul_callback(data, event, source, pid) +applications = data +log.notice("update local variable application, event is: ", event, +"source: ", source, "server pid:", pid, +", application: ", core.json.encode(applications, true)) +end + + +function _M.all_nodes() +return applications +end + + +function _M.nodes(service_name) +if not applications then +log.error("application is nil, failed to fetch nodes for : ", service_name) +return +end + +local resp_list = applications[service_name] + +if not resp_list then +log.error("fetch nodes failed by ", service_name, ", return default service") +return default_service and {default_service} +end + +log.info("process id: ", ngx.worker.id(), ", applications[", service_name, "] = ", +core.json.delay_encode(resp_list, true)) + +return resp_list +end + + +local function parse_instance(node, server_name_prefix) +local cj = cjson +local key = node.Key +local pr = default_prefix_rule + +if key ==
[GitHub] [apisix-dashboard] Jaycean commented on a change in pull request #1465: feat(be): Online debug function adds support for transfer files
Jaycean commented on a change in pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#discussion_r580708673 ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + panic(err) + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + panic(err) Review comment: done. ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + panic(err) + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + panic(err) + } + _, err = io.Copy(part, file) + file.Close() Review comment: done. ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + panic(err) + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + panic(err) + } + _, err = io.Copy(part, file) + file.Close() + } + for k, v := range reqParams { + if err := writer.WriteField(k, v); err != nil { + panic(err) Review comment: done. ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + panic(err) + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + panic(err) + } + _, err = io.Copy(part, file) + file.Close() + } + for k, v := range reqParams { + if err := writer.WriteField(k, v); err != nil { + panic(err) + } + } + if err := writer.Close(); err != nil {
[GitHub] [apisix] spacewander commented on a change in pull request #3615: feat: add consul kv discovery module
spacewander commented on a change in pull request #3615: URL: https://github.com/apache/apisix/pull/3615#discussion_r580703023 ## File path: doc/discovery/consul_kv.md ## @@ -0,0 +1,148 @@ + +` + +## Summary + +For users who used [nginx-upsync-module](https://github.com/weibocom/nginx-upsync-module) and consul key value for service discovery way, as we Weibo Mobile Team, maybe need it. + +Thanks to @fatman-x guy, who developed this module, called `consul_kv`, and its worker process data flow is below: +![](https://user-images.githubusercontent.com/548385/107141841-6ced3e00-6966-11eb-8aa4-bc790a4ad113.png) + +## Configuration for discovery client + +### Configuration for Consul KV + +Add following configuration in `conf/config.yaml` : + +```yaml +discovery: + consul_kv: +servers: + - "http://127.0.0.1:8500"; + - "http://127.0.0.1:8600"; +prefix: "upstreams" +skip_keys:# if you need to skip special keys + - "upstreams/unused_api/" +timeout: + connect: 1000 # default 2000 ms + read: 1000 # default 2000 ms + wait: 60# default 60 sec +weight: 1 # default 1 +fetch_interval: 5 # default 3 sec, only take effect for keepalive: short way Review comment: `keepalive: short way` should be `keepalive is false`? ## File path: apisix/discovery/consul_kv.lua ## @@ -0,0 +1,415 @@ +-- +-- 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 local_conf = require("apisix.core.config_local").local_conf() +local core = require("apisix.core") +local resty_consul = require('resty.consul') +local cjson = require('cjson') +local http = require('resty.http') +local ipairs = ipairs +local error = error +local ngx= ngx +local unpack = unpack +local ngx_re_match = ngx.re.match +local tonumber = tonumber +local pairs = pairs +local ipairs = ipairs +local ngx_timer_at = ngx.timer.at +local ngx_timer_every= ngx.timer.every +local log= core.log +local ngx_decode_base64 = ngx.decode_base64 +local json_delay_encode = core.json.delay_encode +local cjson_null = cjson.null + +local applications = core.table.new(0, 5) +local default_service +local default_weight +local default_prefix_rule +local skip_keys_map = core.table.new(0, 1) + +local events +local events_list +local consul_apps + +local schema = { +type = "object", +properties = { +servers = { +type = "array", +minItems = 1, +items = { +type = "string", +} +}, +fetch_interval = {type = "integer", minimum = 1, default = 3}, +keepalive = { +type = "boolean", +default = true +}, +prefix = {type = "string", default = "upstreams"}, +weight = {type = "integer", minimum = 1, default = 1}, +timeout = { +type = "object", +properties = { +connect = {type = "integer", minimum = 1, default = 2000}, +read = {type = "integer", minimum = 1, default = 2000}, +wait = {type = "integer", minimum = 1, default = 60} +}, +default = { +connect = 2000, +read = 2000, +wait = 60, +} +}, +skip_keys = { +type = "array", +minItems = 1, +items = { +type = "string", +} +}, +default_service = { +type = "object", +properties = { +host = {type = "string"}, +port = {type = "integer"}, +metadata = { +type = "object", +properties = { +fail_timeout = {type = "integer", default = 1}, +weigth = {type = "integer", default = 1}, +max_fails = {type = "integer", default = 1} +
[GitHub] [apisix-ingress-controller] codecov-io edited a comment on pull request #250: feat: ingress v1
codecov-io edited a comment on pull request #250: URL: https://github.com/apache/apisix-ingress-controller/pull/250#issuecomment-775020837 # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=h1) Report > Merging [#250](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=desc) (005b035) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/09787ed80507be7f2a7b97d3aefddd28cfcad4a6?el=desc) (09787ed) will **increase** coverage by `3.23%`. > The diff coverage is `88.66%`. [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=tree) ```diff @@Coverage Diff @@ ## master #250 +/- ## == + Coverage 48.41% 51.65% +3.23% == Files 35 34 -1 Lines2239 2358 +119 == + Hits 1084 1218 +134 + Misses 1007 982 -25 - Partials 148 158 +10 ``` | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [pkg/ingress/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2luZ3Jlc3MvYXBpc2l4L3JvdXRlLmdv) | `0.00% <ø> (ø)` | | | [pkg/kube/translation/apisix\_upstream.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3Vwc3RyZWFtLmdv) | `88.08% <ø> (ø)` | | | [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdHJhbnNsYXRvci5nbw==) | `53.03% <0.00%> (ø)` | | | [pkg/apisix/cache/memdb.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9jYWNoZS9tZW1kYi5nbw==) | `66.37% <50.00%> (-0.91%)` | :arrow_down: | | [pkg/config/config.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2NvbmZpZy9jb25maWcuZ28=) | `80.00% <50.00%> (-3.34%)` | :arrow_down: | | [pkg/kube/translation/ingress.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vaW5ncmVzcy5nbw==) | `91.93% <91.93%> (ø)` | | | [cmd/ingress/ingress.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-Y21kL2luZ3Jlc3MvaW5ncmVzcy5nbw==) | `73.97% <100.00%> (+2.76%)` | :arrow_up: | | [pkg/apisix/resource.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9yZXNvdXJjZS5nbw==) | `77.77% <100.00%> (+0.22%)` | :arrow_up: | | [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `40.52% <100.00%> (+0.78%)` | :arrow_up: | | [pkg/seven/state/solver.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree#diff-cGtnL3NldmVuL3N0YXRlL3NvbHZlci5nbw==) | `1.98% <0.00%> (-1.99%)` | :arrow_down: | | ... and [4 more](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250/diff?src=pr&el=tree-more) | | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=footer). Last update [09787ed...005b035](https://codecov.io/gh/apache/apisix-ingress-controller/pull/250?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). 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] codecov-io edited a comment on pull request #1498: ci: add ci check for gofmt
codecov-io edited a comment on pull request #1498: URL: https://github.com/apache/apisix-dashboard/pull/1498#issuecomment-783790495 # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=h1) Report > Merging [#1498](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=desc) (5c97ae7) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/f574fcd07e2d53f088766cb3a7ab1ede37e527b5?el=desc) (f574fcd) will **increase** coverage by `0.26%`. > The diff coverage is `100.00%`. [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=tree) ```diff @@Coverage Diff @@ ## master#1498 +/- ## == + Coverage 68.43% 68.69% +0.26% == Files 48 48 Lines3038 3038 == + Hits 2079 2087 +8 + Misses720 712 -8 Partials 239 239 ``` | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `64.91% <ø> (ø)` | | | [api/internal/handler/service/service.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmljZS9zZXJ2aWNlLmdv) | `91.48% <ø> (ø)` | | | [api/internal/conf/conf.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvbmYvY29uZi5nbw==) | `72.41% <100.00%> (ø)` | | | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `87.95% <0.00%> (+1.20%)` | :arrow_up: | | [api/internal/core/storage/etcd.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmFnZS9ldGNkLmdv) | `47.27% <0.00%> (+5.45%)` | :arrow_up: | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=footer). Last update [f574fcd...5c97ae7](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). 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] codecov-io edited a comment on pull request #1498: ci: add ci check for gofmt
codecov-io edited a comment on pull request #1498: URL: https://github.com/apache/apisix-dashboard/pull/1498#issuecomment-783790495 # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=h1) Report > Merging [#1498](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=desc) (5c97ae7) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/f574fcd07e2d53f088766cb3a7ab1ede37e527b5?el=desc) (f574fcd) will **decrease** coverage by `8.39%`. > The diff coverage is `100.00%`. [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=tree) ```diff @@Coverage Diff @@ ## master#1498 +/- ## == - Coverage 68.43% 60.03% -8.40% == Files 48 48 Lines3038 3038 == - Hits 2079 1824 -255 - Misses720 973 +253 - Partials 239 241 +2 ``` | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `30.24% <ø> (-34.68%)` | :arrow_down: | | [api/internal/handler/service/service.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmljZS9zZXJ2aWNlLmdv) | `89.36% <ø> (-2.13%)` | :arrow_down: | | [api/internal/conf/conf.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvbmYvY29uZi5nbw==) | `72.41% <100.00%> (ø)` | | | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `18.75% <0.00%> (-81.25%)` | :arrow_down: | | [...l/handler/route\_online\_debug/route\_online\_debug.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcm91dGVfb25saW5lX2RlYnVnL3JvdXRlX29ubGluZV9kZWJ1Zy5nbw==) | `7.14% <0.00%> (-66.67%)` | :arrow_down: | | [api/internal/utils/consts/api\_error.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2NvbnN0cy9hcGlfZXJyb3IuZ28=) | `25.00% <0.00%> (-25.00%)` | :arrow_down: | | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `45.91% <0.00%> (-24.49%)` | :arrow_down: | | [api/internal/utils/json\_patch.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2pzb25fcGF0Y2guZ28=) | `34.48% <0.00%> (-24.14%)` | :arrow_down: | | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `31.93% <0.00%> (-23.53%)` | :arrow_down: | | ... and [11 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree-more) | | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=footer). Last update [f574fcd...5c97ae7](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). 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 #3635: feat: Add method filter on consummer-restriction plugin
spacewander commented on issue #3635: URL: https://github.com/apache/apisix/issues/3635#issuecomment-783790899 PR is welcome! 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] codecov-io commented on pull request #1498: ci: add ci check for gofmt
codecov-io commented on pull request #1498: URL: https://github.com/apache/apisix-dashboard/pull/1498#issuecomment-783790495 # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=h1) Report > Merging [#1498](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=desc) (5c97ae7) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/f574fcd07e2d53f088766cb3a7ab1ede37e527b5?el=desc) (f574fcd) will **decrease** coverage by `16.79%`. > The diff coverage is `n/a`. [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master#1498 +/- ## === - Coverage 68.43% 51.63% -16.80% === Files 48 39-9 Lines3038 2597 -441 === - Hits 2079 1341 -738 - Misses720 1082 +362 + Partials 239 174 -65 ``` | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `27.41% <ø> (-37.50%)` | :arrow_down: | | [api/internal/handler/service/service.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmljZS9zZXJ2aWNlLmdv) | `68.08% <ø> (-23.41%)` | :arrow_down: | | [api/internal/utils/version.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3ZlcnNpb24uZ28=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: | | [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: | | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: | | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `0.00% <0.00%> (-70.41%)` | :arrow_down: | | [api/internal/filter/cors.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9jb3JzLmdv) | `0.00% <0.00%> (-66.67%)` | :arrow_down: | | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `0.00% <0.00%> (-55.47%)` | :arrow_down: | | [api/internal/utils/consts/api\_error.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2NvbnN0cy9hcGlfZXJyb3IuZ28=) | `0.00% <0.00%> (-50.00%)` | :arrow_down: | | ... and [30 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1498/diff?src=pr&el=tree-more) | | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=footer). Last update [f574fcd...5c97ae7](https://codecov.io/gh/apache/apisix-dashboard/pull/1498?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). 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] starsz commented on pull request #1420: feat: added support for -c to set the config file path
starsz commented on pull request #1420: URL: https://github.com/apache/apisix-dashboard/pull/1420#issuecomment-783790069 > > Hi @vinayaksh42, do you meet any problem? > > I think you should merge the master branch. > > Could you help to sync codes with this PR? Sure, my pleasure. 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] tokers commented on a change in pull request #3512: feat: the traffic-split plugin supports upstream_id
tokers commented on a change in pull request #3512: URL: https://github.com/apache/apisix/pull/3512#discussion_r580700490 ## File path: apisix/plugins/traffic-split.lua ## @@ -97,7 +97,7 @@ local upstreams_schema = { items = { type = "object", properties = { -upstream_id = schema_def.id_schema,-- todo: support upstream_id method +upstream_id = schema_def.id_schema, Review comment: I mean, if they configure `upstream_id`, then the `upstream` should not exist and vice versa. 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] nic-chen opened a new pull request #1498: ci: add ci check for gofmt
nic-chen opened a new pull request #1498: URL: https://github.com/apache/apisix-dashboard/pull/1498 Please answer these questions before submitting a pull request - Why submit this pull request? - [ ] Bugfix - [x] New feature provided - [ ] Improve performance - [ ] Backport patches add ci check for gofmt 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] starsz commented on a change in pull request #1465: feat(be): Online debug function adds support for transfer files
starsz commented on a change in pull request #1465: URL: https://github.com/apache/apisix-dashboard/pull/1465#discussion_r580699272 ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + panic(err) + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + panic(err) Review comment: Ditto. ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + panic(err) Review comment: `panic` here is not very good. `return err` would be better. ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + panic(err) + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + panic(err) + } + _, err = io.Copy(part, file) + file.Close() + } + for k, v := range reqParams { + if err := writer.WriteField(k, v); err != nil { + panic(err) Review comment: Ditto. ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType + } + if files != nil { + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + for _, uploadFile := range files { + file, err := os.Open(uploadFile.Filepath) + if err != nil { + panic(err) + } + part, err := writer.CreateFormFile(uploadFile.Name, filepath.Base(uploadFile.Filepath)) + if err != nil { + panic(err) + } + _, err = io.Copy(part, file) + file.Close() Review comment: We can use defer. ## File path: api/test/e2enew/base/http.go ## @@ -92,3 +104,44 @@ func BatchTestServerPort(times int) map[string]int { return res } + +func GetReader(reqParams map[string]string, contentType string, files []UploadFile) (io.Reader, string) { + if strings.Index(contentType, "json") > -1 { + bytesData, _ := json.Marshal(reqParams) + return bytes.NewReader(bytesData), contentType + } + if files != nil { + body := &bytes.B
[GitHub] [apisix-ingress-controller] tokers commented on issue #259: request help: Getting route not found issue
tokers commented on issue #259: URL: https://github.com/apache/apisix-ingress-controller/issues/259#issuecomment-783789352 @Bhanuji95 How did you install apisix-ingress-controller and apisix? 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] tokers commented on a change in pull request #3636: docs: FAQ doc added make deps execution failed
tokers commented on a change in pull request #3636: URL: https://github.com/apache/apisix/pull/3636#discussion_r580699183 ## File path: FAQ.md ## @@ -355,3 +355,19 @@ The high availability of APISIX can be divided into two parts: 1. The data plane of Apache APISIX is stateless and can be elastically scaled at will. Just add a layer of LB in front. 2. The control plane of Apache APISIX relies on the highly available implementation of `etcd cluster` and does not require any relational database dependency. + +## Why does the `make deps` command fail in source installation? + +When executing the `make deps` command, an error such as the one shown below occurs. This is caused by the missing dependency of `openresty-openssl111-devel`, you need to execute `yum install -y openresty-openssl111-devel` to install it first. Review comment: Well, people might not use RedHat series Linux distro. 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 #1485: bug: execute the `api/build-tools/schema-sync.sh` script and report "module'table.new' not found"
juzhiyuan closed issue #1485: URL: https://github.com/apache/apisix-dashboard/issues/1485 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 pull request #1497: fix: modify the rpm link for 2.4
juzhiyuan commented on pull request #1497: URL: https://github.com/apache/apisix-dashboard/pull/1497#issuecomment-783783397 Need update v2.4 too :) 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 #1496: Broken RPM download link
juzhiyuan closed issue #1496: URL: https://github.com/apache/apisix-dashboard/issues/1496 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 master updated: fix: modify the rpm link for 2.4 (#1497)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git The following commit(s) were added to refs/heads/master by this push: new f574fcd fix: modify the rpm link for 2.4 (#1497) f574fcd is described below commit f574fcd07e2d53f088766cb3a7ab1ede37e527b5 Author: liuxiran AuthorDate: Tue Feb 23 08:41:22 2021 +0800 fix: modify the rpm link for 2.4 (#1497) --- docs/deploy-with-rpm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deploy-with-rpm.md b/docs/deploy-with-rpm.md index 1b77720..0582d2e 100644 --- a/docs/deploy-with-rpm.md +++ b/docs/deploy-with-rpm.md @@ -24,7 +24,7 @@ ## Install from RPM ```sh -$ sudo yum install -y https://github.com/apache/apisix-dashboard/releases/download/v2.4/apisix-dashboard-v2.4-1.x86_64.rpm +$ sudo yum install -y https://github.com/apache/apisix-dashboard/releases/download/v2.4/apisix-dashboard-2.4-0.x86_64.rpm ``` ## Run
[GitHub] [apisix-dashboard] juzhiyuan merged pull request #1497: fix: modify the rpm link for 2.4
juzhiyuan merged pull request #1497: URL: https://github.com/apache/apisix-dashboard/pull/1497 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 merged pull request #1467: feat: added front-end e2e coverage report in ci
juzhiyuan merged pull request #1467: URL: https://github.com/apache/apisix-dashboard/pull/1467 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] nic-chen commented on issue #3575: bug: fail to run make deps on MacOS with luarocks 3.5
nic-chen commented on issue #3575: URL: https://github.com/apache/apisix/issues/3575#issuecomment-783782673 > @nic-chen would like to handle this issue? OK 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] nic-chen commented on pull request #1477: feat: support etcd prefix as apisix does
nic-chen commented on pull request #1477: URL: https://github.com/apache/apisix-dashboard/pull/1477#issuecomment-783774501 @liuyang211 The reason for the failure is that there is no sleep after the previous stop, which causes the Manager API to not really restart successfully: https://github.com/apache/apisix-dashboard/pull/1477/checks?check_run_id=1946779863#step:5:530 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] nic-chen commented on a change in pull request #1477: feat: support etcd prefix as apisix does
nic-chen commented on a change in pull request #1477: URL: https://github.com/apache/apisix-dashboard/pull/1477#discussion_r580685851 ## File path: api/test/shell/cli_test.sh ## @@ -343,6 +343,75 @@ check_logfile ./manager-api stop Review comment: need to sleep after stop. 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] bzp2010 commented on a change in pull request #1490: feat: support yaml to config plugin in plugin config page
bzp2010 commented on a change in pull request #1490: URL: https://github.com/apache/apisix-dashboard/pull/1490#discussion_r580664004 ## File path: web/src/components/Plugin/PluginDetail.tsx ## @@ -243,6 +268,7 @@ const PluginDetail: React.FC = ({ Data Editor
[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1420: feat: added support for -c to set the config file path
juzhiyuan commented on pull request #1420: URL: https://github.com/apache/apisix-dashboard/pull/1420#issuecomment-783719697 > Hi @vinayaksh42, do you meet any problem? > I think you should merge the master branch. Could you help to sync codes with this PR? 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 pull request #1467: feat: add front-end e2e coverage report in ci
juzhiyuan commented on pull request #1467: URL: https://github.com/apache/apisix-dashboard/pull/1467#issuecomment-783717696 `yarn.lock` has too many changes, please check if it's necessary. 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