[GitHub] [apisix] spacewander commented on issue #6669: docs: unify chinese doc table head

2022-03-20 Thread GitBox


spacewander commented on issue #6669:
URL: https://github.com/apache/apisix/issues/6669#issuecomment-1073508963


   Related: https://github.com/apache/apisix/issues/6669


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

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

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




[GitHub] [apisix-go-plugin-runner] Horus-K opened a new issue #73: request help: Whether the plugin is performant

2022-03-20 Thread GitBox


Horus-K opened a new issue #73:
URL: https://github.com/apache/apisix-go-plugin-runner/issues/73


   ### Issue description
   I use the official demo to directly return the html file, but its 
performance is not good
   ### Environment
   
   * APISIX Go Plugin Runner's version: 0.2.0
   * APISIX version: apisix:2.11.0
   * Go version:1.。17
   * OS (cmd: `uname -a`): centos7.8
   I have 3 apisix instances  2c2g
   
![image](https://user-images.githubusercontent.com/48319268/159211468-f5baf8fc-2b47-4e95-8124-ea7d668cfccf.png)
   some request rt is very high
   
![image](https://user-images.githubusercontent.com/48319268/159211521-65dd4f8e-88bc-4770-9206-e4d4de3ca3d1.png)
   code
   ```
   /*
* 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.
*/
   
   package plugins
   
   import (
"encoding/base64"
"encoding/json"
pkgHTTP "github.com/apache/apisix-go-plugin-runner/pkg/http"
"github.com/apache/apisix-go-plugin-runner/pkg/log"
"github.com/apache/apisix-go-plugin-runner/pkg/plugin"
"net/http"
   )
   
   func init() {
log.Infof("init开始...")
err := plugin.RegisterPlugin({})
if err != nil {
log.Fatalf("注册插件失败 say: %s", err)
}
   }
   
   // Say is a demo to show how to return data directly instead of proxying
   // it to the upstream.
   type Say struct {
   }
   
   type SayConf struct {
Body   string `json:"body"`
   }
   
   func (p *Say) Name() string {
return "say"
   }
   
   func (p *Say) ParseConf(in []byte) (interface{}, error) {
log.Infof("解析配置开始...")
conf := SayConf{}
err := json.Unmarshal(in, )
return conf, err
   }
   
   func (p *Say) Filter(conf interface{}, w http.ResponseWriter, r 
pkgHTTP.Request) {
//获取配置文件对应值
body := conf.(SayConf).Body
   
   
if len(body) == 0 {
log.Errorf("Body为空")
return
}
resBody, err := base64.StdEncoding.DecodeString(body)
if err != nil {
log.Errorf("Base64解码不正确")
return
}
w.Header().Set("Content-Type", "text/html")
_, err = w.Write([]byte(resBody))
if err != nil {
log.Errorf("failed to write: %s", err)
}
   }
   


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

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

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




[GitHub] [apisix] spacewander commented on pull request #6670: feat: Add the function of hiding header for key-auth plugin

2022-03-20 Thread GitBox


spacewander commented on pull request #6670:
URL: https://github.com/apache/apisix/pull/6670#issuecomment-1073508039


   Let's merge master to make CI pass.


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

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

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




[GitHub] [apisix] zhixiongdu027 commented on a change in pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


zhixiongdu027 commented on a change in pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#discussion_r830640039



##
File path: apisix/discovery/tars/init.lua
##
@@ -0,0 +1,283 @@
+--
+-- 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 ngx = ngx
+local format = string.format
+local ipairs = ipairs
+local error = error
+local tonumber = tonumber
+local local_conf = require("apisix.core.config_local").local_conf()
+local core = require("apisix.core")
+local mysql = require("resty.mysql")
+local process = require("ngx.process")
+
+local full_query_sql = [[ select servant, group_concat(endpoint order by 
endpoint) as endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where setting_state = 'active' and present_state = 'active'
+group by servant ]]
+
+local incremental_query_sql = [[
+select servant, (setting_state = 'active' and present_state = 'active') 
activated,
+group_concat(endpoint order by endpoint) endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where (application, server_name) in
+(
+select application, server_name from t_server_conf
+where registry_timestamp > now() - interval %d second
+union
+select application, server_name from t_adapter_conf
+where registry_timestamp > now() - interval %d second
+)
+group by servant, activated order by activated desc ]]
+
+local _M = {
+version = 0.1,
+}
+
+local endpoint_dict
+local default_weight
+
+local last_fetch_full_time = 0
+local last_fetch_error
+
+local endpoint_lrucache = core.lrucache.new({
+ttl = 300,
+count = 1024
+})
+
+local activated_buffer = core.table.new(10, 0)
+local nodes_buffer = core.table.new(0, 5)
+
+local endpoints_pattern = core.table.concat(
+{ 
[[tcp(\s*-[te]\s*(\S+)){0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+))]],
+  [[{0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+)){0,2}\s*(,|$)]] }
+)
+
+
+local function update_endpoint(servant, nodes)
+local endpoint_content = core.json.encode(nodes, true)
+local endpoint_version = ngx.crc32_long(endpoint_content)
+core.log.debug("set servant ", servant, endpoint_content)
+local _, err
+_, err = endpoint_dict:safe_set(servant .. "#version", endpoint_version)
+if err then
+core.log.error("set endpoint version into discovery DICT failed, ", 
err)
+return
+end
+_, err = endpoint_dict:safe_set(servant, endpoint_content)
+if err then
+core.log.error("set endpoint into discovery DICT failed, ", err)
+endpoint_dict:delete(servant .. "#version")
+end
+end
+
+
+local function delete_endpoint(servant)
+core.log.info("delete servant ", servant)
+endpoint_dict:delete(servant .. "#version")
+endpoint_dict:delete(servant)
+end
+
+
+local function create_endpoint_lrucache(servant)
+local endpoint_content = endpoint_dict:get_stale(servant)
+if not endpoint_content then
+core.log.error("get empty endpoint content from discovery DICT, 
servant: ", servant)
+return nil
+end
+
+local endpoint = core.json.decode(endpoint_content)
+if not endpoint then
+core.log.error("decode endpoint content failed, content: ", 
endpoint_content)
+return nil
+end
+
+return endpoint
+end
+
+
+local function get_endpoint(servant)
+local endpoint_version = endpoint_dict:get_stale(servant .. "#version")
+if not endpoint_version then
+return nil
+end
+
+return endpoint_lrucache(servant, endpoint_version, 
create_endpoint_lrucache, servant)
+end
+
+
+local function extract_endpoint(query_result)
+for _, p in ipairs(query_result) do
+repeat
+local servant = p.servant
+
+if servant == ngx.null then
+break
+end
+
+if p.activated == 1 then
+activated_buffer[servant] = ngx.null
+elseif p.activated == 0 then
+if activated_buffer[servant] == nil then
+delete_endpoint(servant)
+end
+break
+end
+
+core.table.clear(nodes_buffer)
+local iterator = 

[GitHub] [apisix] zhixiongdu027 commented on pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


zhixiongdu027 commented on pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#issuecomment-1073473662


   > hi @zhixiongdu027 , file conflict, you need to merge master branch to your 
PR.
   
   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.

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

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




[GitHub] [apisix] tzssangglass commented on issue #6666: bug: openid-connect plugin causes nginx to crash on ARM64

2022-03-20 Thread GitBox


tzssangglass commented on issue #:
URL: https://github.com/apache/apisix/issues/#issuecomment-1073456326


   > Update: Looks like the issue is specific to Alpine Linux for ARM 64. I've 
switched to Centos based docker image (apache/apisix:2.12.1-centos) and the 
error is gone.
   
   Yes, support on M1 is not perfect at the moment. It would be nice if you 
could provide core dump file about this `alert `.


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

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

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




[GitHub] [apisix-dashboard] evirts edited a comment on issue #2354: APISIX Dashboard V3 Discuss

2022-03-20 Thread GitBox


evirts edited a comment on issue #2354:
URL: 
https://github.com/apache/apisix-dashboard/issues/2354#issuecomment-1073456021


   hi,i hope Dashboard can do a version control function to prevent accidental 
deletion and rollback in time


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

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

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




[GitHub] [apisix-dashboard] evirts commented on issue #2354: APISIX Dashboard V3 Discuss

2022-03-20 Thread GitBox


evirts commented on issue #2354:
URL: 
https://github.com/apache/apisix-dashboard/issues/2354#issuecomment-1073456021


   Dashboard can do a version control function to prevent accidental deletion 
and rollback in time


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

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

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




[GitHub] [apisix] kwanhur commented on issue #6604: request help: add semicolon check in `make lint`

2022-03-20 Thread GitBox


kwanhur commented on issue #6604:
URL: https://github.com/apache/apisix/issues/6604#issuecomment-1073449516


   I'm not sure, but hope some ideas could inspire by 
[lualint](https://github.com/philips/lualint/blob/master/lualint).


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

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

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




[GitHub] [apisix] spacewander merged pull request #6586: feat: add support for password grant in keycloak plugin

2022-03-20 Thread GitBox


spacewander merged pull request #6586:
URL: https://github.com/apache/apisix/pull/6586


   


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

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

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




[apisix] branch master updated (a47dab7 -> 66e944c)

2022-03-20 Thread spacewander
This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from a47dab7  feat: improve kubernetes discovery (#6663)
 add 66e944c  feat: add support for password grant in keycloak plugin 
(#6586)

No new revisions were added by this update.

Summary of changes:
 apisix/plugins/authz-keycloak.lua| 94 ++--
 docs/en/latest/plugins/authz-keycloak.md | 22 
 t/plugin/authz-keycloak.t| 75 +
 3 files changed, 187 insertions(+), 4 deletions(-)


[GitHub] [apisix] liangliang4ward opened a new pull request #6671: docs: fix zipkin.md garbled code

2022-03-20 Thread GitBox


liangliang4ward opened a new pull request #6671:
URL: https://github.com/apache/apisix/pull/6671


   ### Description
   
   
   
   
   Fixes # (issue)
   
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX 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.

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

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




[GitHub] [apisix] leslie-tsang commented on a change in pull request #6512: feat: support google reCAPTCHA

2022-03-20 Thread GitBox


leslie-tsang commented on a change in pull request #6512:
URL: https://github.com/apache/apisix/pull/6512#discussion_r830718799



##
File path: docs/zh/latest/plugins/recaptcha.md
##
@@ -0,0 +1,112 @@
+---
+title: recaptcha
+---
+
+
+
+## 描述
+
+通过向 Google reCAPTCHA 服务校验客户端传递的验证码来限制对上游服务的访问。插件支持自定义无效校验码的响应体。
+
+> 注意,此插件只支持 Google reCAPTCHA v2 版本。
+
+## 属性
+
+| Name  | Type  | Requirement | Default| Valid 
   | Description
 |
+| - | - | --- | -- | 
 
|-|
+| secret_key | string| 必须||  | Google reCAPTCHA v2 的 
secret key|
+| parameter_source | string | 可选 | header | | 验证码参数的来源枚举值。当前仅支持 `header`, 
`query` |
+| parameter_name | string | 可选 | captcha | | 验证码参数的名称  
  |
+| response | object | 可选| content_type  = `application/json; 
charset=utf-8`status_code = `400`body = `{"message":"invalid 
captcha"}` |  | 无效验证码的 HTTP 响应体 |

Review comment:
   > Has APISIX had any guidance on this ?
   
   Not yet.
   
   > Or any suggestions from you ?
   
   I'm worried that this might cause exceptions in other markdown renderers, 
shall we remove 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.

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

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




[GitHub] [apisix] bin-ya commented on a change in pull request #6627: docs: modify the make install in how to build Apache APISIX doc

2022-03-20 Thread GitBox


bin-ya commented on a change in pull request #6627:
URL: https://github.com/apache/apisix/pull/6627#discussion_r830718683



##
File path: docs/en/latest/how-to-build.md
##
@@ -125,7 +125,7 @@ Follow the steps below to install Apache APISIX via the 
source release package.
   cd apisix-${APISIX_VERSION}
   # Create dependencies
   make deps
-  # Install apisix command
+  # Install apisix command (only for luarocks)
   make install

Review comment:
   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.

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

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




[GitHub] [apisix] tzssangglass commented on a change in pull request #6627: docs: modify the make install in how to build Apache APISIX doc

2022-03-20 Thread GitBox


tzssangglass commented on a change in pull request #6627:
URL: https://github.com/apache/apisix/pull/6627#discussion_r830718533



##
File path: docs/en/latest/how-to-build.md
##
@@ -125,7 +125,7 @@ Follow the steps below to install Apache APISIX via the 
source release package.
   cd apisix-${APISIX_VERSION}
   # Create dependencies
   make deps
-  # Install apisix command
+  # Install apisix command (only for luarocks)
   make install

Review comment:
   @bin-ya I think `Install apisix command (only for luarocks)` should be 
changed to `Install apisix command (developer do not need to follow this step)`




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

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

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




[GitHub] [apisix] tzssangglass commented on pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


tzssangglass commented on pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#issuecomment-1073424457


   hi @zhixiongdu027 , file conflict, you need to merge master branch to your 
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.

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

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




[GitHub] [apisix] bin-ya opened a new pull request #6670: feat: Add the function of hiding header for key-auth plugin

2022-03-20 Thread GitBox


bin-ya opened a new pull request #6670:
URL: https://github.com/apache/apisix/pull/6670


   ### Description
   
   
   
   
   Add the function of hiding header for key-auth plugin
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX 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.

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

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




[GitHub] [apisix-helm-chart] PGDream commented on a change in pull request #254: Ingress classname

2022-03-20 Thread GitBox


PGDream commented on a change in pull request #254:
URL: https://github.com/apache/apisix-helm-chart/pull/254#discussion_r830716265



##
File path: charts/apisix-dashboard/templates/ingress.yaml
##
@@ -24,6 +24,9 @@ apiVersion: extensions/v1beta1
 {{- end }}
 kind: Ingress
 metadata:
+  {{- if .Values.ingress.classNmae }}
+  ingressClassName: {{- .Values.ingress.classNmae -}}

Review comment:
   hi,readme.md already update;




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

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

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




[GitHub] [apisix] tzssangglass commented on a change in pull request #6512: feat: support google reCAPTCHA

2022-03-20 Thread GitBox


tzssangglass commented on a change in pull request #6512:
URL: https://github.com/apache/apisix/pull/6512#discussion_r830716082



##
File path: apisix/plugins/recaptcha.lua
##
@@ -0,0 +1,102 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local http = require("resty.http")
+
+local schema = {
+type = "object",
+properties = {
+secret_key = { type = "string" },
+parameter_source = { type = "string", default = "header", enum = { 
"header", "query" } },
+parameter_name = { type = "string", default = "captcha" },
+ssl_verify = { type = "boolean", default = true },
+response = {
+type = "object",
+properties = {
+content_type = { type = "string", default = "application/json; 
charset=utf-8" },
+status_code = { type = "number", default = 400 },
+body = { type = "string", default = '{"message": "invalid 
captcha"}' }
+}
+},
+},
+required = { "secret_key" },
+}
+
+local recaptcha_url = "https://www.recaptcha.net;
+
+local _M = {
+version = 0.1,
+priority = 700,
+name = "recaptcha",
+schema = schema,
+}
+
+function _M.check_schema(conf, schema_type)
+return core.schema.check(schema, conf)
+end
+
+local function retrieve_captcha(ctx, conf)
+local captcha
+if conf.parameter_source == "header" then
+captcha = core.request.header(ctx, conf.parameter_name)
+elseif conf.parameter_source == "query" then
+local uri_args = core.request.get_uri_args(ctx) or {}
+captcha = uri_args[conf.parameter_name]
+end
+return captcha
+end
+
+function _M.access(conf, ctx)
+local path = ctx.var.uri
+local method = core.request.get_method()
+
+core.log.debug("path: ", path, ", method: ", method, ", conf: ", 
core.json.encode(conf))
+
+local invalid_captcha = true
+local captcha = retrieve_captcha(ctx, conf)
+if captcha ~= nil and captcha ~= "" then
+local httpc = http.new()
+local secret = conf.secret_key
+local remote_ip = core.request.get_remote_client_ip(ctx)
+local res, err = httpc:request_uri(recaptcha_url .. 
"/recaptcha/api/siteverify", {
+method = "POST",
+body = "secret=" .. secret .. "=" .. captcha .. 
"=" .. remote_ip,
+headers = {
+["Content-Type"] = "application/x-www-form-urlencoded",
+},
+ssl_verify = conf.ssl_verify
+})
+if err then
+core.log.error("request failed: ", err)
+return 503
+end
+core.log.debug("recaptcha veirfy result: ", res.body)
+local recaptcha_result = core.json.decode(res.body)
+if recaptcha_result.success == true then
+invalid_captcha = false
+end

Review comment:
   `local invalid_captcha = true` is where you declare invalid_captcha, I 
mean `invalid_captcha == false` only one place.
   
   




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

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

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




[GitHub] [apisix-website] juzhiyuan merged pull request #963: fix: use default ssrTemplate

2022-03-20 Thread GitBox


juzhiyuan merged pull request #963:
URL: https://github.com/apache/apisix-website/pull/963


   


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

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

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




[apisix-website] branch master updated: fix: use default ssrTemplate (#963)

2022-03-20 Thread juzhiyuan
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-website.git


The following commit(s) were added to refs/heads/master by this push:
 new a023cc8  fix: use default ssrTemplate (#963)
a023cc8 is described below

commit a023cc86934ff3cd8ad0415f9f8600aa70c9d1d4
Author: 琚致远 
AuthorDate: Mon Mar 21 10:03:26 2022 +0800

fix: use default ssrTemplate (#963)
---
 website/config/ssrTemplate.js | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/website/config/ssrTemplate.js b/website/config/ssrTemplate.js
index 54320b5..db7b851 100644
--- a/website/config/ssrTemplate.js
+++ b/website/config/ssrTemplate.js
@@ -1,5 +1,3 @@
-const CDN_URL = 
'https://raw.githubusercontent.com/apache/apisix-website/asf-site'
-
 module.exports = {
   ssrTemplate: `
   >
@@ -20,10 +18,10 @@ 
j=d.createElement(s),dl=l!='dataLayer'?'='+l:'';j.async=true;j.src=
 <%~ metaAttribute %>
   <% }); %>
   <% it.stylesheets.forEach((stylesheet) => { %>
-
+
   <% }); %>
   <% it.scripts.forEach((script) => { %>
-
+
   <% }); %>
 
 >


[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #963: fix: use default ssrTemplate

2022-03-20 Thread GitBox


netlify[bot] edited a comment on pull request #963:
URL: https://github.com/apache/apisix-website/pull/963#issuecomment-1073413088


   ✅ Deploy Preview for *apache-apisix* ready!
   
   
    Explore the source changes: 94c8bad360662379e3aff5487d34683e81dec4e4
   
    Inspect the deploy log: 
[https://app.netlify.com/sites/apache-apisix/deploys/6237daf6fe337f000941a989](https://app.netlify.com/sites/apache-apisix/deploys/6237daf6fe337f000941a989)
   
    Browse the preview: 
[https://deploy-preview-963--apache-apisix.netlify.app](https://deploy-preview-963--apache-apisix.netlify.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.

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

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




[GitHub] [apisix] kwanhur commented on pull request #6568: docs(lint): import Chinese copywriting autocorrect linter

2022-03-20 Thread GitBox


kwanhur commented on pull request #6568:
URL: https://github.com/apache/apisix/pull/6568#issuecomment-1073414567


   > Hi @kwanhur, I try to resolve those conflicts, but I don't know which 
change I should keep. Please resolve them 
   
   Had resolved conflicts. Some ci jobs need to re-run manually, trigger them 
plz.


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

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

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




[GitHub] [apisix] vm-001 commented on a change in pull request #6512: feat: support google reCAPTCHA

2022-03-20 Thread GitBox


vm-001 commented on a change in pull request #6512:
URL: https://github.com/apache/apisix/pull/6512#discussion_r830712828



##
File path: docs/zh/latest/plugins/recaptcha.md
##
@@ -0,0 +1,112 @@
+---
+title: recaptcha
+---
+
+
+
+## 描述
+
+通过向 Google reCAPTCHA 服务校验客户端传递的验证码来限制对上游服务的访问。插件支持自定义无效校验码的响应体。
+
+> 注意,此插件只支持 Google reCAPTCHA v2 版本。
+
+## 属性
+
+| Name  | Type  | Requirement | Default| Valid 
   | Description
 |
+| - | - | --- | -- | 
 
|-|
+| secret_key | string| 必须||  | Google reCAPTCHA v2 的 
secret key|
+| parameter_source | string | 可选 | header | | 验证码参数的来源枚举值。当前仅支持 `header`, 
`query` |
+| parameter_name | string | 可选 | captcha | | 验证码参数的名称  
  |
+| response | object | 可选| content_type  = `application/json; 
charset=utf-8`status_code = `400`body = `{"message":"invalid 
captcha"}` |  | 无效验证码的 HTTP 响应体 |

Review comment:
   The response is an object type and it has three properties. And I just 
want to make sure it looks good. Has APISIX had any guidance on this? Or any 
suggestions from you? 




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

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

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




[GitHub] [apisix] liangliang4ward opened a new issue #6669: docs: unify chinese doc table head

2022-03-20 Thread GitBox


liangliang4ward opened a new issue #6669:
URL: https://github.com/apache/apisix/issues/6669


   ### Current State
   
   at chinese doc parmaters table head, `Requirement` some docs  translate to 
"必选项", some docs translate to "可选项” and some translate to "是否必须". we should 
unify.
   
   
https://github.com/apache/apisix/blob/a47dab7eecd90998499eae10b477ce7fd8175c28/docs/zh/latest/plugins/file-logger.md?plain=1#L30
   
   
https://github.com/apache/apisix/blob/a47dab7eecd90998499eae10b477ce7fd8175c28/docs/zh/latest/plugins/google-cloud-logging.md?plain=1#L35
   
   
https://github.com/apache/apisix/blob/a47dab7eecd90998499eae10b477ce7fd8175c28/docs/zh/latest/plugins/traffic-split.md?plain=1#L32
   
   ### Desired State
   
   unify translate.


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

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

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




[GitHub] [apisix-website] juzhiyuan closed issue #944: feat: add user page

2022-03-20 Thread GitBox


juzhiyuan closed issue #944:
URL: https://github.com/apache/apisix-website/issues/944


   


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

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

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




[GitHub] [apisix-website] juzhiyuan merged pull request #959: chore: Make some icons clearer and add some media queries

2022-03-20 Thread GitBox


juzhiyuan merged pull request #959:
URL: https://github.com/apache/apisix-website/pull/959


   


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

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

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




[apisix-website] branch master updated (c16cbc2 -> 8a6e5cc)

2022-03-20 Thread juzhiyuan
This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git.


from c16cbc2  feat: use github cdn (#962)
 add 8a6e5cc  chore: Make some icons clearer and add some media queries 
(#959)

No new revisions were added by this update.

Summary of changes:
 website/src/pages/showcase/index.js  |  68 +--
 website/src/pages/showcase/styles.scss   |   9 
 website/static/data/showcases.json   |  10 ++--
 website/static/img/showcase/10086.svg|   1 +
 website/static/img/showcase/360.png  | Bin 2936 -> 0 bytes
 website/static/img/showcase/360.svg  |   1 +
 website/static/img/showcase/aispeech.png | Bin 2621 -> 17804 bytes
 website/static/img/showcase/dian.png | Bin 3791 -> 2809 bytes
 website/static/img/showcase/didachuxing.jpeg | Bin 0 -> 37358 bytes
 website/static/img/showcase/didachuxing.jpg  | Bin 1419 -> 0 bytes
 website/static/img/showcase/dusto.jpeg   | Bin 5724 -> 7413 bytes
 website/static/img/showcase/eFactory.jpeg| Bin 0 -> 5369 bytes
 website/static/img/showcase/eFactory.webp| Bin 4714 -> 0 bytes
 website/static/img/showcase/meizu.jpg| Bin 741 -> 0 bytes
 website/static/img/showcase/meizu.svg|   1 +
 website/static/img/showcase/muyuan.png   | Bin 7439 -> 31484 bytes
 website/static/img/showcase/zybang.png   | Bin 2604 -> 4196 bytes
 17 files changed, 51 insertions(+), 39 deletions(-)
 create mode 100644 website/static/img/showcase/10086.svg
 delete mode 100644 website/static/img/showcase/360.png
 create mode 100644 website/static/img/showcase/360.svg
 create mode 100644 website/static/img/showcase/didachuxing.jpeg
 delete mode 100644 website/static/img/showcase/didachuxing.jpg
 create mode 100644 website/static/img/showcase/eFactory.jpeg
 delete mode 100644 website/static/img/showcase/eFactory.webp
 delete mode 100644 website/static/img/showcase/meizu.jpg
 create mode 100644 website/static/img/showcase/meizu.svg


[GitHub] [apisix-website] netlify[bot] commented on pull request #963: fix: use default ssrTemplate

2022-03-20 Thread GitBox


netlify[bot] commented on pull request #963:
URL: https://github.com/apache/apisix-website/pull/963#issuecomment-1073413088


    Deploy Preview for *apache-apisix* processing.
   
   
    Explore the source changes: 94c8bad360662379e3aff5487d34683e81dec4e4
   
    Inspect the deploy log: 
[https://app.netlify.com/sites/apache-apisix/deploys/6237daf6fe337f000941a989](https://app.netlify.com/sites/apache-apisix/deploys/6237daf6fe337f000941a989)
   


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

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

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




[GitHub] [apisix-website] juzhiyuan opened a new pull request #963: fix: use default ssrTemplate

2022-03-20 Thread GitBox


juzhiyuan opened a new pull request #963:
URL: https://github.com/apache/apisix-website/pull/963


   **Changes:**
   
   1. Use Default SSR Template, link JS/CSS from the current server. see 
https://docusaurus.io/docs/api/docusaurus-config#ssrtemplate


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

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

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




[apisix-website] 01/01: fix: use default ssrTemplate

2022-03-20 Thread juzhiyuan
This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch fix-ssr-template
in repository https://gitbox.apache.org/repos/asf/apisix-website.git

commit 94c8bad360662379e3aff5487d34683e81dec4e4
Author: juzhiyuan 
AuthorDate: Mon Mar 21 09:54:07 2022 +0800

fix: use default ssrTemplate
---
 website/config/ssrTemplate.js | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/website/config/ssrTemplate.js b/website/config/ssrTemplate.js
index 54320b5..db7b851 100644
--- a/website/config/ssrTemplate.js
+++ b/website/config/ssrTemplate.js
@@ -1,5 +1,3 @@
-const CDN_URL = 
'https://raw.githubusercontent.com/apache/apisix-website/asf-site'
-
 module.exports = {
   ssrTemplate: `
   >
@@ -20,10 +18,10 @@ 
j=d.createElement(s),dl=l!='dataLayer'?'='+l:'';j.async=true;j.src=
 <%~ metaAttribute %>
   <% }); %>
   <% it.stylesheets.forEach((stylesheet) => { %>
-
+
   <% }); %>
   <% it.scripts.forEach((script) => { %>
-
+
   <% }); %>
 
 >


[apisix-website] branch fix-ssr-template created (now 94c8bad)

2022-03-20 Thread juzhiyuan
This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a change to branch fix-ssr-template
in repository https://gitbox.apache.org/repos/asf/apisix-website.git.


  at 94c8bad  fix: use default ssrTemplate

This branch includes the following new commits:

 new 94c8bad  fix: use default ssrTemplate

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[GitHub] [apisix] liangliang4ward opened a new pull request #6668: docs: translate some zh/*.md table properties to chinese

2022-03-20 Thread GitBox


liangliang4ward opened a new pull request #6668:
URL: https://github.com/apache/apisix/pull/6668


   ### Description
   translate some zh/*.md table properties to chinese
   
   
   
   Fixes # (issue)
   
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX 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.

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

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




[GitHub] [apisix] juzhiyuan commented on a change in pull request #6568: docs(lint): import Chinese copywriting autocorrect linter

2022-03-20 Thread GitBox


juzhiyuan commented on a change in pull request #6568:
URL: https://github.com/apache/apisix/pull/6568#discussion_r830710508



##
File path: docs/zh/latest/plugins/traffic-split.md
##
@@ -40,7 +40,7 @@ traffic-split 插件使用户可以逐步引导各个上游之间的流量百分
 | upstream.hash_on   | enum   | 可选   | vars | | `hash_on` 支持的类型有 
`vars`(Nginx 内置变量),`header`(自定义 
header),`cookie`,`consumer`,`vars_combinations`,默认值为 `vars`。更多详细信息请参考 
[upstream](../admin-api.md#upstream) 用法。|
 | upstream.key   | string | 可选   |  ||  该选项只有类型是 
`chash` 才有效。根据 `key` 来查找对应的 node `id`,相同的 `key` 在同一个对象中,永远返回相同 id。更多详细信息请参考 
[upstream](../admin-api.md#upstream) 用法。 |
 | upstream.nodes | object | 可选   ||| 哈希表,内部元素的 
key 是上游机器地址 列表,格式为地址 + Port,其中地址部 分可以是 IP 也可以是域名,⽐如 192.168.1.100:80、foo.com:80 
等。 value 则是节点的权重,特别的,当权重 值为 0 有特殊含义,通常代表该上游节点 失效,永远不希望被选中。 |
-| upstream.timeout   | object | 可选   |  15 || 
设置连接、发送消息、接收消息的超时时间(时间单位:秒,都默认为 15 秒)。 |
+| upstream.timeout   | object | 可选   |  15 || 
设置连接、发送消息、接收消息的超时时间 (时间单位:秒,都默认为 15 秒)。 |
 | upstream.pass_host | enum   | 可选   | "pass"   | ["pass", "node", 
"rewrite"]  | `pass`: 将客户端的 host 透传给上游; `node`: 使用 `upstream`  node 中配置的 host; 
`rewrite`: 使用配置项 `upstream_host` 的值 |

Review comment:
   Hi @yzeng25, could you please have a review and resolve some conversions?




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

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

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




[GitHub] [apisix] zhengwe opened a new pull request #6667: docs: Remove plugins jwt-auth.md outline

2022-03-20 Thread GitBox


zhengwe opened a new pull request #6667:
URL: https://github.com/apache/apisix/pull/6667


   ### Description
   
   
   
   
   Fixes # (issue)
   
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX 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.

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

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




[GitHub] [apisix] tzssangglass commented on a change in pull request #6614: feat: support reading configuration form xds(mvp)

2022-03-20 Thread GitBox


tzssangglass commented on a change in pull request #6614:
URL: https://github.com/apache/apisix/pull/6614#discussion_r830710278



##
File path: apisix/core/config_xds.lua
##
@@ -0,0 +1,120 @@
+--
+-- 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.
+--
+
+--- Get configuration form ngx.shared.DICT.
+--
+-- @module core.config_xds
+
+local base  = require("resty.core.base")
+local config_local  = require("apisix.core.config_local")
+local table = table
+local error = error
+local is_http   = ngx.config.subsystem == "http"
+local io= io
+local io_open   = io.open
+local io_close  = io.close
+local package   = package
+local new_tab   = base.new_tab
+local ffi   = require ("ffi")
+local C = ffi.C
+local router_config = ngx.shared["router-config"]

Review comment:
   updated

##
File path: apisix/cli/ngx_tpl.lua
##
@@ -235,6 +235,10 @@ http {
 lua_shared_dict ext-plugin {* http.lua_shared_dict["ext-plugin"] *}; # 
cache for ext-plugin
 {% end %}
 
+{% if config_center == "xds" then %}
+lua_shared_dict router-config  10m;

Review comment:
   updated

##
File path: apisix/core/config_xds.lua
##
@@ -0,0 +1,120 @@
+--
+-- 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.
+--
+
+--- Get configuration form ngx.shared.DICT.
+--
+-- @module core.config_xds
+
+local base  = require("resty.core.base")
+local config_local  = require("apisix.core.config_local")
+local table = table
+local error = error
+local is_http   = ngx.config.subsystem == "http"
+local io= io
+local io_open   = io.open
+local io_close  = io.close
+local package   = package
+local new_tab   = base.new_tab
+local ffi   = require ("ffi")
+local C = ffi.C
+local router_config = ngx.shared["router-config"]
+local ngx_re_match  = ngx.re.match
+local ngx_re_gmatch = ngx.re.gmatch
+
+local xds_lib_name = "libxds.so"
+
+
+local process
+if is_http then
+process = require("ngx.process")
+end
+
+
+ffi.cdef[[
+extern void initial(void* router_zone_ptr);
+]]
+
+
+local _M = {
+version = 0.1,
+local_conf = config_local.local_conf,
+}
+
+
+-- todo: refactor this function in chash.lua and radixtree.lua
+local function load_shared_lib(lib_name)
+local cpath = package.cpath
+local tried_paths = new_tab(32, 0)
+local i = 1
+
+local iter, err = ngx_re_gmatch(cpath, "[^;]+", "jo")
+if not iter then
+error("failed to gmatch: " .. err)
+end
+
+while true do
+local it = iter()
+local fpath
+fpath, err = ngx_re_match(it[0], "(.*/)",  "jo")
+if err then
+error("failed to match: " .. err)
+end
+local spath = fpath[0] .. lib_name
+
+local f = io_open(spath)
+if f ~= nil then
+io_close(f)
+return ffi.load(spath)
+end
+tried_paths[i] = spath
+i = i + 1
+
+if not it then
+break
+end
+end
+
+return nil, tried_paths
+end
+
+
+local function load_libxds(lib_name)
+local xdsagent, tried_paths = load_shared_lib(lib_name)
+
+if not xdsagent then
+tried_paths[#tried_paths + 1] = 'tried above paths but can not load ' 
.. lib_name
+error("can not 

[GitHub] [apisix] leslie-tsang commented on a change in pull request #6646: feat: release 2.13.0

2022-03-20 Thread GitBox


leslie-tsang commented on a change in pull request #6646:
URL: https://github.com/apache/apisix/pull/6646#discussion_r830710170



##
File path: docs/zh/latest/discovery/kubernetes.md
##
@@ -93,28 +98,89 @@ discovery:
   #token_file: # enter file path here
 ```
 
-# Kubernetes 服务发现插件的使用
+## Kubernetes 服务发现模块的查询接口
+
+Kubernetes 服务发现模块遵循 [_APISIX Discovery 
规范_](https://github.com/apache/apisix/blob/master/docs/zh/latest/discovery.md) 
提供查询接口
+
+**函数:**
+ nodes(service_name)
+
+**说明:**
+  service_name 必须满足格式: [namespace]/[name]:[portName]
+
+  + namespace: Endpoints 所在的命名空间
+
+  + name: Endpoints 的资源名
+
+  + portName: Endpoints 定义包含的 portName, 如果 Endpoints 没有定义 portName, 请使用 
targetPort,Port 代替
+
+**返回值:**
+  以如下 Endpoints 为例:
 
-Kubernetes 服务发现插件提供与其他服务发现插件相同的查询接口 -> nodes(service_name) \
-service_name 的 pattern 如下:
-> _[namespace]/[name]:[portName]_
+  ```yaml
+  apiVersion: v1
+  kind: Endpoints
+  metadata:
+name: plat-dev
+namespace: default
+  subsets:
+- addresses:
+- ip: "10.5.10.109"
+- ip: "10.5.10.110"
+  ports:
+- port: 3306
+  ```
 
-如果 kubernetes Endpoint 没有定义 portName, Kubernetes 服务发现插件会依次使用 targetPort, port 
代替
+  nodes("default/plat-dev:3306") 调用会得到如下的返回值:
 
-# Q
+  ```

Review comment:
   Maybe `json` 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.

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

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




[GitHub] [apisix-go-plugin-runner] shuaijinchao commented on a change in pull request #72: feat(ci): add e2e test framework

2022-03-20 Thread GitBox


shuaijinchao commented on a change in pull request #72:
URL: 
https://github.com/apache/apisix-go-plugin-runner/pull/72#discussion_r830709820



##
File path: tests/e2e/plugins/plugins_limit_req_test.go
##
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+package plugins_test
+
+import (
+   "github.com/apache/apisix-go-plugin-runner/tests/e2e/tools"
+   "github.com/gavv/httpexpect/v2"
+   "github.com/onsi/ginkgo"
+   "github.com/onsi/ginkgo/extensions/table"
+   "net/http"
+)
+
+var _ = ginkgo.Describe("limit req Plugin, then", func() {
+   table.DescribeTable("limit req",
+   func(tc tools.HttpTestCase) {
+   tools.RunTestCase(tc)
+   },
+   table.Entry("let go plugin limit req", tools.HttpTestCase{
+   Object: tools.GetA6Expect(),
+   Method: http.MethodPut,
+   Path:   "/apisix/admin/routes/1",
+   Body: `{
+   "uri":"/test/go/runner/limitreq",
+   "plugins":{
+   "ext-plugin-pre-req":{
+   "conf":[
+   {
+   
"name":"limit_req",
+   
"value":"{\"rate\":5, \"burst\":1}"
+   }
+   ]
+   }
+   },
+   "upstream":{
+   "nodes":{
+   "web:":1
+   },
+   "type":"roundrobin"
+   }
+   }`,
+   Headers:   map[string]string{"X-API-KEY": 
tools.GetAdminToken()},
+   ExpectStatusRange: httpexpect.Status2xx,
+   }),
+   table.Entry("test go runner limit req", tools.HttpTestCase{
+   Object:   tools.GetA6Expect(),
+   Method:   http.MethodGet,
+   Path: "/test/go/runner/limitreq",
+   ExpectCode: 503,

Review comment:
   ```suggestion
ExpectCode: 503,
ExpectCode: http.StatusServiceUnavailable,
   ```

##
File path: tests/e2e/plugins/plugins_limit_req_test.go
##
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+package plugins_test
+
+import (
+   "github.com/apache/apisix-go-plugin-runner/tests/e2e/tools"
+   "github.com/gavv/httpexpect/v2"
+   "github.com/onsi/ginkgo"
+   "github.com/onsi/ginkgo/extensions/table"
+   "net/http"
+)
+
+var _ = ginkgo.Describe("limit req Plugin, then", func() {
+   table.DescribeTable("limit req",
+   func(tc tools.HttpTestCase) {
+   tools.RunTestCase(tc)
+   },
+   table.Entry("let go plugin limit req", tools.HttpTestCase{
+   Object: tools.GetA6Expect(),
+   Method: http.MethodPut,
+   Path:   

[GitHub] [apisix] leslie-tsang commented on a change in pull request #6512: feat: support google reCAPTCHA

2022-03-20 Thread GitBox


leslie-tsang commented on a change in pull request #6512:
URL: https://github.com/apache/apisix/pull/6512#discussion_r830708007



##
File path: apisix/plugins/recaptcha.lua
##
@@ -0,0 +1,101 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local http = require("resty.http")
+local ngx = ngx
+
+local schema = {
+type = "object",
+properties = {
+secret_key = { type = "string" },
+parameter_source = { type = "string", default = "header", enum = { 
"header", "query" } },
+parameter_name = { type = "string", default = "captcha" },
+ssl_verify = { type = "boolean", default = true },
+response = {
+type = "object",
+properties = {
+content_type = { type = "string", default = "application/json; 
charset=utf-8" },
+status_code = { type = "number", default = 400 },
+body = { type = "string", default = '{"message": "invalid 
captcha"}' }
+}
+},
+},
+required = { "secret_key" },
+}
+
+local recaptcha_url = "https://www.recaptcha.net;
+
+local _M = {
+version = 0.1,
+priority = 700,
+name = "recaptcha",
+schema = schema,
+}
+
+function _M.check_schema(conf)
+return core.schema.check(schema, conf)
+end
+
+local function retrieve_captcha(ctx, conf)

Review comment:
   ```suggestion
   
   local function retrieve_captcha(ctx, conf)
   ```
   Please follow the 
[CODE_STYLE.md](https://github.com/apache/apisix/blob/master/CODE_STYLE.md#blank-line).
   
   > The functions needs to be separated by two blank lines:

##
File path: apisix/plugins/recaptcha.lua
##
@@ -0,0 +1,101 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local http = require("resty.http")
+local ngx = ngx
+
+local schema = {
+type = "object",
+properties = {
+secret_key = { type = "string" },
+parameter_source = { type = "string", default = "header", enum = { 
"header", "query" } },
+parameter_name = { type = "string", default = "captcha" },
+ssl_verify = { type = "boolean", default = true },
+response = {
+type = "object",
+properties = {
+content_type = { type = "string", default = "application/json; 
charset=utf-8" },
+status_code = { type = "number", default = 400 },
+body = { type = "string", default = '{"message": "invalid 
captcha"}' }
+}
+},
+},
+required = { "secret_key" },
+}
+
+local recaptcha_url = "https://www.recaptcha.net;
+
+local _M = {
+version = 0.1,
+priority = 700,
+name = "recaptcha",
+schema = schema,
+}
+
+function _M.check_schema(conf)
+return core.schema.check(schema, conf)
+end
+
+local function retrieve_captcha(ctx, conf)
+if conf.parameter_source == "header" then
+return core.request.header(ctx, conf.parameter_name)
+end
+
+if conf.parameter_source == "query" then
+local uri_args = core.request.get_uri_args(ctx) or {}
+return uri_args[conf.parameter_name]
+end
+end
+
+function _M.access(conf, ctx)

Review comment:
   ```suggestion
   
   function _M.access(conf, ctx)
   ```
   Please follow the 
[CODE_STYLE.md](https://github.com/apache/apisix/blob/master/CODE_STYLE.md#blank-line).
   
   > The functions needs to be separated by 

[GitHub] [apisix] zhixiongdu027 commented on pull request #6663: feat: improve kubernetes discovery

2022-03-20 Thread GitBox


zhixiongdu027 commented on pull request #6663:
URL: https://github.com/apache/apisix/pull/6663#issuecomment-1073407486


   
![image](https://user-images.githubusercontent.com/4032302/159195405-56f495ac-ebed-4bbf-884e-0d2351ec5c08.png)
   
   It looks like we just need to insert a line here?
   
   @spacewander 


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

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

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




[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #959: chore: Make some icons clearer and add some media queries

2022-03-20 Thread GitBox


netlify[bot] edited a comment on pull request #959:
URL: https://github.com/apache/apisix-website/pull/959#issuecomment-1066108166


   ✅ Deploy Preview for *apache-apisix* ready!
   
   
    Explore the source changes: bb21145074a048d5cd8cf22503e4aa048adba2b0
   
    Inspect the deploy log: 
[https://app.netlify.com/sites/apache-apisix/deploys/6237d3ffa66a540008f57346](https://app.netlify.com/sites/apache-apisix/deploys/6237d3ffa66a540008f57346)
   
    Browse the preview: 
[https://deploy-preview-959--apache-apisix.netlify.app](https://deploy-preview-959--apache-apisix.netlify.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.

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

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




[GitHub] [apisix-dashboard] Baoyuantop commented on issue #2388: Request help: how to set a uniform access prefix for dashboard

2022-03-20 Thread GitBox


Baoyuantop commented on issue #2388:
URL: 
https://github.com/apache/apisix-dashboard/issues/2388#issuecomment-1073405149


   Hi @kingmouse-yx, you can refer to https://umijs.org/docs/deployment.
   


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

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

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




[GitHub] [apisix] yzeng25 commented on a change in pull request #6568: docs(lint): import Chinese copywriting autocorrect linter

2022-03-20 Thread GitBox


yzeng25 commented on a change in pull request #6568:
URL: https://github.com/apache/apisix/pull/6568#discussion_r830707772



##
File path: docs/zh/latest/plugins/gzip.md
##
@@ -25,7 +25,7 @@ title: gzip
 
 `gzip` 插件能动态设置 `Nginx` 的压缩行为。
 
-**该插件要求 `APISIX` 运行在 
[APISIX-OpenResty](../how-to-build.md#步骤6:为-apache-apisix-构建-openresty) 上。**
+**该插件要求 `APISIX` 运行在 [APISIX-OpenResty](../how-to-build.md#步骤 
6:为-apache-apisix-构建-openresty) 上。**

Review comment:
   Sure. Please modify other steps (i.e. step 1 ~ step 5) as well.




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

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

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




[GitHub] [apisix] vm-001 commented on a change in pull request #6512: feat: support google reCAPTCHA

2022-03-20 Thread GitBox


vm-001 commented on a change in pull request #6512:
URL: https://github.com/apache/apisix/pull/6512#discussion_r830707616



##
File path: apisix/plugins/recaptcha.lua
##
@@ -0,0 +1,102 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local http = require("resty.http")
+
+local schema = {
+type = "object",
+properties = {
+secret_key = { type = "string" },
+parameter_source = { type = "string", default = "header", enum = { 
"header", "query" } },
+parameter_name = { type = "string", default = "captcha" },
+ssl_verify = { type = "boolean", default = true },
+response = {
+type = "object",
+properties = {
+content_type = { type = "string", default = "application/json; 
charset=utf-8" },
+status_code = { type = "number", default = 400 },
+body = { type = "string", default = '{"message": "invalid 
captcha"}' }
+}
+},
+},
+required = { "secret_key" },
+}
+
+local recaptcha_url = "https://www.recaptcha.net;
+
+local _M = {
+version = 0.1,
+priority = 700,
+name = "recaptcha",
+schema = schema,
+}
+
+function _M.check_schema(conf, schema_type)
+return core.schema.check(schema, conf)
+end
+
+local function retrieve_captcha(ctx, conf)
+local captcha
+if conf.parameter_source == "header" then
+captcha = core.request.header(ctx, conf.parameter_name)
+elseif conf.parameter_source == "query" then
+local uri_args = core.request.get_uri_args(ctx) or {}
+captcha = uri_args[conf.parameter_name]
+end
+return captcha
+end
+
+function _M.access(conf, ctx)
+local path = ctx.var.uri
+local method = core.request.get_method()
+
+core.log.debug("path: ", path, ", method: ", method, ", conf: ", 
core.json.encode(conf))
+
+local invalid_captcha = true
+local captcha = retrieve_captcha(ctx, conf)
+if captcha ~= nil and captcha ~= "" then
+local httpc = http.new()
+local secret = conf.secret_key
+local remote_ip = core.request.get_remote_client_ip(ctx)
+local res, err = httpc:request_uri(recaptcha_url .. 
"/recaptcha/api/siteverify", {
+method = "POST",
+body = "secret=" .. secret .. "=" .. captcha .. 
"=" .. remote_ip,
+headers = {
+["Content-Type"] = "application/x-www-form-urlencoded",
+},
+ssl_verify = conf.ssl_verify
+})
+if err then

Review comment:
   ```
   if not res then
   core.log.error("request failed: ", err)
   return 503
   end
   ```
   
   I see. 




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

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

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




[GitHub] [apisix] vm-001 commented on a change in pull request #6512: feat: support google reCAPTCHA

2022-03-20 Thread GitBox


vm-001 commented on a change in pull request #6512:
URL: https://github.com/apache/apisix/pull/6512#discussion_r830707336



##
File path: apisix/plugins/recaptcha.lua
##
@@ -0,0 +1,102 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local http = require("resty.http")
+
+local schema = {
+type = "object",
+properties = {
+secret_key = { type = "string" },
+parameter_source = { type = "string", default = "header", enum = { 
"header", "query" } },
+parameter_name = { type = "string", default = "captcha" },
+ssl_verify = { type = "boolean", default = true },
+response = {
+type = "object",
+properties = {
+content_type = { type = "string", default = "application/json; 
charset=utf-8" },
+status_code = { type = "number", default = 400 },
+body = { type = "string", default = '{"message": "invalid 
captcha"}' }
+}
+},
+},
+required = { "secret_key" },
+}
+
+local recaptcha_url = "https://www.recaptcha.net;
+
+local _M = {
+version = 0.1,
+priority = 700,
+name = "recaptcha",
+schema = schema,
+}
+
+function _M.check_schema(conf, schema_type)
+return core.schema.check(schema, conf)
+end
+
+local function retrieve_captcha(ctx, conf)
+local captcha
+if conf.parameter_source == "header" then
+captcha = core.request.header(ctx, conf.parameter_name)
+elseif conf.parameter_source == "query" then
+local uri_args = core.request.get_uri_args(ctx) or {}
+captcha = uri_args[conf.parameter_name]
+end
+return captcha
+end
+
+function _M.access(conf, ctx)
+local path = ctx.var.uri
+local method = core.request.get_method()
+
+core.log.debug("path: ", path, ", method: ", method, ", conf: ", 
core.json.encode(conf))
+
+local invalid_captcha = true
+local captcha = retrieve_captcha(ctx, conf)
+if captcha ~= nil and captcha ~= "" then
+local httpc = http.new()
+local secret = conf.secret_key
+local remote_ip = core.request.get_remote_client_ip(ctx)
+local res, err = httpc:request_uri(recaptcha_url .. 
"/recaptcha/api/siteverify", {
+method = "POST",
+body = "secret=" .. secret .. "=" .. captcha .. 
"=" .. remote_ip,
+headers = {
+["Content-Type"] = "application/x-www-form-urlencoded",
+},
+ssl_verify = conf.ssl_verify
+})
+if err then
+core.log.error("request failed: ", err)
+return 503
+end
+core.log.debug("recaptcha veirfy result: ", res.body)
+local recaptcha_result = core.json.decode(res.body)
+if recaptcha_result.success == true then
+invalid_captcha = false
+end

Review comment:
   ```lua
   function _M.access(conf, ctx)
   local invalid_captcha = true
   local captcha = retrieve_captcha(ctx, conf)
   if captcha == nil or captcha == "" then
   -- duplicated !
   core.response.set_header("Content-Type", conf.response.content_type)
   return conf.response.status_code, 
core.utils.resolve_var(conf.response.body, ctx.var)
   end
   
   local httpc = http.new()
   local secret = conf.secret_key
   local remote_ip = core.request.get_remote_client_ip(ctx)
   local res, err = httpc:request_uri(recaptcha_url .. 
"/recaptcha/api/siteverify", {
   method = "POST",
   body = ngx.encode_args({ secret = secret, response = captcha, 
remoteip = remote_ip }),
   headers = {
   ["Content-Type"] = "application/x-www-form-urlencoded",
   },
   ssl_verify = conf.ssl_verify
   })
   if not res then
   core.log.error("request failed: ", err)
   return 503
   end
   core.log.debug("recaptcha verify result: ", res.body)
   local recaptcha_result, err = core.json.decode(res.body)
   if err then
   core.log.error("faield to decode the recaptcha response json: ", err)
   end
   if recaptcha_result.success ~= true then
   -- duplicated !

[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #959: chore: Make some icons clearer and add some media queries

2022-03-20 Thread GitBox


netlify[bot] edited a comment on pull request #959:
URL: https://github.com/apache/apisix-website/pull/959#issuecomment-1066108166


    Deploy Preview for *apache-apisix* processing.
   
   
    Explore the source changes: bb21145074a048d5cd8cf22503e4aa048adba2b0
   
    Inspect the deploy log: 
[https://app.netlify.com/sites/apache-apisix/deploys/6237d3ffa66a540008f57346](https://app.netlify.com/sites/apache-apisix/deploys/6237d3ffa66a540008f57346)
   


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

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

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




[GitHub] [apisix] juzhiyuan commented on pull request #6568: docs(lint): import Chinese copywriting autocorrect linter

2022-03-20 Thread GitBox


juzhiyuan commented on pull request #6568:
URL: https://github.com/apache/apisix/pull/6568#issuecomment-1073402228


   Hi @kwanhur, I try to resolve those conflicts, but I don't know which change 
I should keep. Please resolve them 


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

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

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




[GitHub] [apisix-website] yzeng25 merged pull request #962: feat: use GitHub CDN

2022-03-20 Thread GitBox


yzeng25 merged pull request #962:
URL: https://github.com/apache/apisix-website/pull/962


   


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

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

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




[apisix-website] branch master updated: feat: use github cdn (#962)

2022-03-20 Thread yilinzeng
This is an automated email from the ASF dual-hosted git repository.

yilinzeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
 new c16cbc2  feat: use github cdn (#962)
c16cbc2 is described below

commit c16cbc24cac2c9e07b241d21b269258bd47cf27c
Author: 琚致远 
AuthorDate: Mon Mar 21 09:24:13 2022 +0800

feat: use github cdn (#962)
---
 scripts/sync-docs.js  |  2 +-
 website/config/ssrTemplate.js |  2 +-
 website/src/css/customTheme.css   | 10 +-
 website/src/pages/sections/endcta.jsx |  2 +-
 website/src/pages/showcase/index.js   |  2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/scripts/sync-docs.js b/scripts/sync-docs.js
index 81f3bb2..0078346 100644
--- a/scripts/sync-docs.js
+++ b/scripts/sync-docs.js
@@ -200,7 +200,7 @@ const replaceMDElements = (project, path, branch = 
"master") => {
 from: 
/(\.\.\/)+assets\/images\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g,
 to: (match) => {
   const imgPath = match.replace(/\(|\)|\.\.\/*/g, "");
-  const newUrl = 
`https://cdn.jsdelivr.net/gh/apache/${project}@${branch}/docs/${imgPath}`;
+  const newUrl = 
`https://raw.githubusercontent.com/apache/${project}/${branch}/docs/${imgPath}`;
   //console.log(`${project}: ${match}  ${newUrl}`);
   return newUrl;
 },
diff --git a/website/config/ssrTemplate.js b/website/config/ssrTemplate.js
index d089a15..54320b5 100644
--- a/website/config/ssrTemplate.js
+++ b/website/config/ssrTemplate.js
@@ -1,4 +1,4 @@
-const CDN_URL = 'https://cdn.jsdelivr.net/gh/apache/apisix-website@asf-site'
+const CDN_URL = 
'https://raw.githubusercontent.com/apache/apisix-website/asf-site'
 
 module.exports = {
   ssrTemplate: `
diff --git a/website/src/css/customTheme.css b/website/src/css/customTheme.css
index 4d60f22..c27cb02 100644
--- a/website/src/css/customTheme.css
+++ b/website/src/css/customTheme.css
@@ -54,27 +54,27 @@ html[data-theme="dark"] {
 
 @font-face {
   font-family: 'MaisonNeue-Medium';
-  src: local('MaisonNeue-Medium'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Medium.otf)
 format('opentype');
+  src: local('MaisonNeue-Medium'), 
url(https://raw.githubusercontent.com/apache/apisix-website/master/website/src/fonts/MaisonNeue-Medium.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-Bold';
-  src: local('MaisonNeue-Bold'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Bold.otf)
 format('opentype');
+  src: local('MaisonNeue-Bold'), 
url(https://raw.githubusercontent.com/apache/apisix-website/master/website/src/fonts/MaisonNeue-Bold.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-Light';
-  src: local('MaisonNeue-Light'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Light.otf)
 format('opentype');
+  src: local('MaisonNeue-Light'), 
url(https://raw.githubusercontent.com/apache/apisix-website/master/website/src/fonts/MaisonNeue-Light.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-Demi';
-  src: local('MaisonNeue-Demi'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Demi.otf)
 format('opentype');
+  src: local('MaisonNeue-Demi'), 
url(https://raw.githubusercontent.com/apache/apisix-website/master/website/src/fonts/MaisonNeue-Demi.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-ExtraBold';
-  src: local('MaisonNeue-ExtraBold'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-ExtraBold.otf)
 format('opentype');
+  src: local('MaisonNeue-ExtraBold'), 
url(https://raw.githubusercontent.com/apache/apisix-website/master/website/src/fonts/MaisonNeue-ExtraBold.otf)
 format('opentype');
   font-display: swap;
 }
 
diff --git a/website/src/pages/sections/endcta.jsx 
b/website/src/pages/sections/endcta.jsx
index e1cb863..34a8174 100644
--- a/website/src/pages/sections/endcta.jsx
+++ b/website/src/pages/sections/endcta.jsx
@@ -10,7 +10,7 @@ const EndCTA = () => {
 <>
   
 
-  Try APISIX today https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/assets/images/rocket.gif;
 alt="Rocket"/>
+  Try APISIX today https://raw.githubusercontent.com/apache/apisix-website/master/website/src/assets/images/rocket.gif;
 alt="Rocket"/>
 
 
   
diff --git a/website/src/pages/showcase/index.js 
b/website/src/pages/showcase/index.js
index f8fae12..8cdc636 100644
--- a/website/src/pages/showcase/index.js
+++ b/website/src/pages/showcase/index.js
@@ -43,7 +43,7 @@ const Content = (props) => {
   const showcases = siteConfig.customFields.showcases.map((user) 

[GitHub] [apisix-go-plugin-runner] codecov-commenter edited a comment on pull request #72: feat(ci): add e2e test framework

2022-03-20 Thread GitBox


codecov-commenter edited a comment on pull request #72:
URL: 
https://github.com/apache/apisix-go-plugin-runner/pull/72#issuecomment-1070826647


   # 
[Codecov](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#72](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (201f806) into 
[master](https://codecov.io/gh/apache/apisix-go-plugin-runner/commit/8fdac12de1d573a5505ce1068eb5ec2943200441?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (8fdac12) will **decrease** coverage by `1.35%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@Coverage Diff @@
   ##   master  #72  +/-   ##
   ==
   - Coverage   80.84%   79.49%   -1.36% 
   ==
 Files  11   11  
 Lines 710  746  +36 
   ==
   + Hits  574  593  +19 
   - Misses100  114  +14 
   - Partials   36   39   +3 
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 | Coverage Δ | |
   |---|---|---|
   | 
[internal/server/server.go](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-aW50ZXJuYWwvc2VydmVyL3NlcnZlci5nbw==)
 | `56.91% <0.00%> (-10.57%)` | :arrow_down: |
   | 
[internal/http/request.go](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-aW50ZXJuYWwvaHR0cC9yZXF1ZXN0Lmdv)
 | `93.49% <0.00%> (-0.79%)` | :arrow_down: |
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=continue_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=footer_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation).
 Last update 
[8fdac12...201f806](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=lastupdated_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation).
 Read the [comment 
docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation).
   


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

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

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




[GitHub] [apisix] juzhiyuan commented on a change in pull request #6646: feat: release 2.13.0

2022-03-20 Thread GitBox


juzhiyuan commented on a change in pull request #6646:
URL: https://github.com/apache/apisix/pull/6646#discussion_r830706087



##
File path: docs/zh/latest/discovery/kubernetes.md
##
@@ -93,28 +98,89 @@ discovery:
   #token_file: # enter file path here
 ```
 
-# Kubernetes 服务发现插件的使用
+## Kubernetes 服务发现模块的查询接口
+
+Kubernetes 服务发现模块遵循 [_APISIX Discovery 
规范_](https://github.com/apache/apisix/blob/master/docs/zh/latest/discovery.md) 
提供查询接口
+
+**函数:**
+ nodes(service_name)
+
+**说明:**
+  service_name 必须满足格式: [namespace]/[name]:[portName]
+
+  + namespace: Endpoints 所在的命名空间
+
+  + name: Endpoints 的资源名
+
+  + portName: Endpoints 定义包含的 portName, 如果 Endpoints 没有定义 portName, 请使用 
targetPort,Port 代替
+
+**返回值:**
+  以如下 Endpoints 为例:
 
-Kubernetes 服务发现插件提供与其他服务发现插件相同的查询接口 -> nodes(service_name) \
-service_name 的 pattern 如下:
-> _[namespace]/[name]:[portName]_
+  ```yaml
+  apiVersion: v1
+  kind: Endpoints
+  metadata:
+name: plat-dev
+namespace: default
+  subsets:
+- addresses:
+- ip: "10.5.10.109"
+- ip: "10.5.10.110"
+  ports:
+- port: 3306
+  ```
 
-如果 kubernetes Endpoint 没有定义 portName, Kubernetes 服务发现插件会依次使用 targetPort, port 
代替
+  nodes("default/plat-dev:3306") 调用会得到如下的返回值:
 
-# Q
+  ```

Review comment:
   Hi, do we need to add `lua` 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.

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

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




[GitHub] [apisix] kekoke commented on issue #6648: help request: Use Nginx as proxy service, return 404 not found

2022-03-20 Thread GitBox


kekoke commented on issue #6648:
URL: https://github.com/apache/apisix/issues/6648#issuecomment-1073399623


   > You will need to check the meaning of the curl `--resolve` command 
yourself. Anyway, it is not relevant to this question.
   
   Yes, I see. Thanks again. -^-^


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

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

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




[GitHub] [apisix] nic-6443 closed issue #6658: help request: I want to add plublic IP of resolved domain to match rule of route,how i can do?

2022-03-20 Thread GitBox


nic-6443 closed issue #6658:
URL: https://github.com/apache/apisix/issues/6658


   


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

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

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




[GitHub] [apisix] liangliang4ward commented on issue #6656: feat: clickhouse-logger-plugin may not support default log format

2022-03-20 Thread GitBox


liangliang4ward commented on issue #6656:
URL: https://github.com/apache/apisix/issues/6656#issuecomment-1073395240


   maby we should use anthoer method to get property from full_log.
   


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

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

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




[GitHub] [apisix-helm-chart] tokers commented on a change in pull request #254: Ingress classname

2022-03-20 Thread GitBox


tokers commented on a change in pull request #254:
URL: https://github.com/apache/apisix-helm-chart/pull/254#discussion_r830702118



##
File path: charts/apisix-dashboard/templates/ingress.yaml
##
@@ -24,6 +24,9 @@ apiVersion: extensions/v1beta1
 {{- end }}
 kind: Ingress
 metadata:
+  {{- if .Values.ingress.classNmae }}
+  ingressClassName: {{- .Values.ingress.classNmae -}}

Review comment:
   Yes, but I think readme should also be 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.

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

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




[GitHub] [apisix] spacewander commented on pull request #6663: feat: improve kubernetes discovery

2022-03-20 Thread GitBox


spacewander commented on pull request #6663:
URL: https://github.com/apache/apisix/pull/6663#issuecomment-1073389656


   @zhixiongdu027 
   Would you like to update 
https://github.com/apache/apisix/blob/master/docs/en/latest/discovery.md#supported-discovery-registries?
 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.

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

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




[apisix] branch release/2.13 updated (724ea22 -> 3300db0)

2022-03-20 Thread spacewander
This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a change to branch release/2.13
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 724ea22  feat: release 2.13.0
 add 3300db0  feat: improve kubernetes discovery (#6663)

No new revisions were added by this update.

Summary of changes:
 apisix/cli/ngx_tpl.lua   |   4 +
 apisix/cli/ops.lua   |   6 +
 apisix/discovery/kubernetes/informer_factory.lua |   4 +-
 apisix/discovery/kubernetes/init.lua |  15 +-
 conf/config-default.yaml |   1 +
 docs/en/latest/config.json   |   3 +-
 docs/en/latest/discovery/kubernetes.md   | 188 +++
 docs/zh/latest/discovery/kubernetes.md   | 106 ++---
 t/APISIX.pm  |   1 +
 9 files changed, 296 insertions(+), 32 deletions(-)
 create mode 100644 docs/en/latest/discovery/kubernetes.md


[GitHub] [apisix] spacewander closed issue #6661: docs: there is no doc about k8s discovery

2022-03-20 Thread GitBox


spacewander closed issue #6661:
URL: https://github.com/apache/apisix/issues/6661


   


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

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

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




[GitHub] [apisix] spacewander merged pull request #6663: feat: improve kubernetes discovery

2022-03-20 Thread GitBox


spacewander merged pull request #6663:
URL: https://github.com/apache/apisix/pull/6663


   


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

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

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




[apisix] branch master updated: feat: improve kubernetes discovery (#6663)

2022-03-20 Thread spacewander
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 a47dab7  feat: improve kubernetes discovery (#6663)
a47dab7 is described below

commit a47dab7eecd90998499eae10b477ce7fd8175c28
Author: zhixiongdu 
AuthorDate: Mon Mar 21 08:46:26 2022 +0800

feat: improve kubernetes discovery (#6663)
---
 apisix/cli/ngx_tpl.lua   |   4 +
 apisix/cli/ops.lua   |   6 +
 apisix/discovery/kubernetes/informer_factory.lua |   4 +-
 apisix/discovery/kubernetes/init.lua |  15 +-
 conf/config-default.yaml |   1 +
 docs/en/latest/config.json   |   3 +-
 docs/en/latest/discovery/kubernetes.md   | 188 +++
 docs/zh/latest/discovery/kubernetes.md   | 106 ++---
 t/APISIX.pm  |   1 +
 9 files changed, 296 insertions(+), 32 deletions(-)

diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua
index 4f1c8c2..b1ec2bb 100644
--- a/apisix/cli/ngx_tpl.lua
+++ b/apisix/cli/ngx_tpl.lua
@@ -190,6 +190,10 @@ http {
 lua_shared_dict balancer-ewma-last-touched-at {* 
http.lua_shared_dict["balancer-ewma-last-touched-at"] *};
 lua_shared_dict etcd-cluster-health-check {* 
http.lua_shared_dict["etcd-cluster-health-check"] *}; # etcd health check
 
+{% if enabled_discoveries["kubernetes"] then %}
+lua_shared_dict kubernetes {* http.lua_shared_dict["kubernetes"] *};
+{% end %}
+
 {% if enabled_plugins["limit-conn"] then %}
 lua_shared_dict plugin-limit-conn {* 
http.lua_shared_dict["plugin-limit-conn"] *};
 {% end %}
diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index 7208e5c..2844126 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -251,6 +251,11 @@ Please modify "admin_key" in conf/config.yaml .
 use_apisix_openresty = false
 end
 
+local enabled_discoveries = {}
+for name in pairs(yaml_conf.discovery or {}) do
+enabled_discoveries[name] = true
+end
+
 local enabled_plugins = {}
 for i, name in ipairs(yaml_conf.plugins or {}) do
 enabled_plugins[name] = true
@@ -528,6 +533,7 @@ Please modify "admin_key" in conf/config.yaml .
 with_module_status = with_module_status,
 use_apisix_openresty = use_apisix_openresty,
 error_log = {level = "warn"},
+enabled_discoveries = enabled_discoveries,
 enabled_plugins = enabled_plugins,
 enabled_stream_plugins = enabled_stream_plugins,
 dubbo_upstream_multiplex_count = dubbo_upstream_multiplex_count,
diff --git a/apisix/discovery/kubernetes/informer_factory.lua 
b/apisix/discovery/kubernetes/informer_factory.lua
index 8b50fc3..a03f27a 100644
--- a/apisix/discovery/kubernetes/informer_factory.lua
+++ b/apisix/discovery/kubernetes/informer_factory.lua
@@ -23,8 +23,6 @@ local type = type
 local core = require("apisix.core")
 local http = require("resty.http")
 
-local empty_table = {}
-
 local function list_query(informer)
 local arguments = {
 limit = informer.limit,
@@ -81,7 +79,7 @@ local function list(httpc, apiserver, informer)
 informer.version = data.metadata.resourceVersion
 
 if informer.on_added then
-for _, item in ipairs(data.items or empty_table) do
+for _, item in ipairs(data.items or {}) do
 informer:on_added(item, "list")
 end
 end
diff --git a/apisix/discovery/kubernetes/init.lua 
b/apisix/discovery/kubernetes/init.lua
index ba83588..a0491be 100644
--- a/apisix/discovery/kubernetes/init.lua
+++ b/apisix/discovery/kubernetes/init.lua
@@ -31,6 +31,7 @@ local local_conf = 
require("apisix.core.config_local").local_conf()
 local informer_factory = 
require("apisix.discovery.kubernetes.informer_factory")
 
 local endpoint_dict
+
 local default_weight
 
 local endpoint_lrucache = core.lrucache.new({
@@ -39,7 +40,6 @@ local endpoint_lrucache = core.lrucache.new({
 })
 
 local endpoint_buffer = {}
-local empty_table = {}
 
 local function sort_nodes_cmp(left, right)
 if left.host ~= right.host then
@@ -60,10 +60,10 @@ local function on_endpoint_modified(informer, endpoint)
 core.table.clear(endpoint_buffer)
 
 local subsets = endpoint.subsets
-for _, subset in ipairs(subsets or empty_table) do
+for _, subset in ipairs(subsets or {}) do
 if subset.addresses then
 local addresses = subset.addresses
-for _, port in ipairs(subset.ports or empty_table) do
+for _, port in ipairs(subset.ports or {}) do
 local port_name
 if port.name then
 port_name = port.name
@@ -166,7 +166,7 @@ local function setup_namespace_selector(conf, informer)
 local match = conf.namespace_selector.match
   

[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #959: chore: Make some icons clearer and add some media queries

2022-03-20 Thread GitBox


netlify[bot] edited a comment on pull request #959:
URL: https://github.com/apache/apisix-website/pull/959#issuecomment-1066108166


   ✅ Deploy Preview for *apache-apisix* ready!
   
   
    Explore the source changes: 93a7190aa988b9b1ed2f0d03999a854e8feb519f
   
    Inspect the deploy log: 
[https://app.netlify.com/sites/apache-apisix/deploys/6237c8ba1cbbf9189e88](https://app.netlify.com/sites/apache-apisix/deploys/6237c8ba1cbbf9189e88)
   
    Browse the preview: 
[https://deploy-preview-959--apache-apisix.netlify.app](https://deploy-preview-959--apache-apisix.netlify.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.

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

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




[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #959: chore: Make some icons clearer and add some media queries

2022-03-20 Thread GitBox


netlify[bot] edited a comment on pull request #959:
URL: https://github.com/apache/apisix-website/pull/959#issuecomment-1066108166


    Deploy Preview for *apache-apisix* processing.
   
   
    Explore the source changes: 93a7190aa988b9b1ed2f0d03999a854e8feb519f
   
    Inspect the deploy log: 
[https://app.netlify.com/sites/apache-apisix/deploys/6237c8ba1cbbf9189e88](https://app.netlify.com/sites/apache-apisix/deploys/6237c8ba1cbbf9189e88)
   


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

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

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




[GitHub] [apisix] dkrantsberg commented on issue #6666: bug: openid-connect plugin causes nginx to crash on ARM64

2022-03-20 Thread GitBox


dkrantsberg commented on issue #:
URL: https://github.com/apache/apisix/issues/#issuecomment-1073369308


   Update: Looks like the issue is specific to Alpine Linux for ARM 64. I've 
switched to Centos based docker image (apache/apisix:2.12.1-centos) and the 
error is gone. 
   


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

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

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




[GitHub] [apisix] dkrantsberg opened a new issue #6666: bug: openid-connect plugin causes nginx to crash on ARM64

2022-03-20 Thread GitBox


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


   ### Current Behavior
   
   I've enabled `openid-connect` plugin on a route but it when making a request 
to this route causes nginx process to crash (see debug level logs below). I'm 
running it on Mac M1 (arm64) so this issue could be specific to arm64.
   
   It looks like it executes successfully up to this point:
   
https://github.com/zmartzone/lua-resty-openidc/blob/master/lib/resty/openidc.lua#L567
   
   Then 
[client.lua](https://github.com/apache/apisix/blob/master/apisix/core/dns/client.lua)
 and 
[resolver.lua](https://github.com/apache/apisix/blob/master/apisix/core/resolver.lua)
 somehow get involved and it results in `nginx` crashing:
   
   ```
   worker process 48 exited on signal 11
   ```
   
   This could be specific to arm64. I haven't tried it with x64. 
   
   
   ### Expected Behavior
   
   Expected normal oidc flow
   
   ### Error Logs
   
   2022/03/20 16:18:19 [info] 48#48: *1893 [lua] radixtree.lua:346: 
pre_insert_route(): path: /get operator: =, client: 172.26.0.1, server: _, 
request: "GET /get HTTP/1.1", host: "localhost:9080"
   2022/03/20 16:18:19 [info] 48#48: *1893 [lua] init.lua:398: 
http_access_phase(): matched route: 
{"orig_modifiedIndex":779,"createdIndex":178,"clean_handlers":"table: 
0x1cadece16508","value":{"create_time":1647628837,"id":"5","plugins":{"openid-connect":{"bearer_only":true,"discovery":"https:\/\/auth.my-auth-server.org\/_api\/auth\/mytenant\/.well-known\/openid-configuration","timeout":3,"access_token_in_authorization_header":true,"ssl_verify":false,"set_userinfo_header":true,"set_access_token_header":true,"realm":"apisix","client_id":"mytenant-ui","scope":"openid","client_secret":"9180987f-bc65-6482-9300-812d3719faa6","logout_path":"\/logout","set_id_token_header":true,"introspection_endpoint_auth_method":"client_secret_basic"}},"update_time":1647654404,"uri":"\/get","status":1,"priority":0,"upstream":{"hash_on":"vars","type":"roundrobin","parent":{"orig_modifiedIndex":779,"createdIndex":178,"clean_handlers":{},"value":"table:
 0x1cadecfab320","key":"\/apisix\/routes\/5","update_co
 
unt":0,"modifiedIndex":779,"has_domain":true},"scheme":"http","pass_host":"pass","nodes":[{"weight":1,"host":"httpbin.org","port":80}]}},"key":"\/apisix\/routes\/5","update_count":0,"modifiedIndex":779,"has_domain":true},
 client: 172.26.0.1, server: _, request: "GET /get HTTP/1.1", host: 
"localhost:9080"
   2022/03/20 16:18:19 [debug] 48#48: *1893 [lua] openidc.lua:565: 
openidc_discover(): openidc_discover: URL is: 
https://auth.my-auth-server.org/_api/auth/mytenant/.well-known/openid-configuration
   2022/03/20 16:18:19 [debug] 48#48: *1893 [lua] openidc.lua:571: 
openidc_discover(): discovery data not in cache, making call to discovery 
endpoint
   2022/03/20 16:18:19 [debug] 48#48: *1893 [lua] openidc.lua:408: 
openidc_configure_proxy(): openidc_configure_proxy : don't use http proxy
   2022/03/20 16:18:19 [info] 48#48: *1893 [lua] client.lua:126: dns_parse(): 
dns resolve auth.my-auth-server.org, result: 
{"name":"auth.my-auth-server.org","class":1,"address":"38.134.56.123","ttl":4502,"section":1,"type":1},
 client: 172.26.0.1, server: _, request: "GET /get HTTP/1.1", host: 
"localhost:9080"
   2022/03/20 16:18:19 [info] 48#48: *1893 [lua] resolver.lua:39: 
parse_domain(): parse addr: 
{"name":"auth.my-auth-server.org","class":1,"type":1,"section":1,"address":"38.134.56.123","ttl":4502},
 client: 172.26.0.1, server: _, request: "GET /get HTTP/1.1", host: 
"localhost:9080"
   2022/03/20 16:18:19 [info] 48#48: *1893 [lua] resolver.lua:40: 
parse_domain(): resolver: ["127.0.0.11"], client: 172.26.0.1, server: _, 
request: "GET /get HTTP/1.1", host: "localhost:9080"
   2022/03/20 16:18:19 [info] 48#48: *1893 [lua] resolver.lua:41: 
parse_domain(): host: auth.my-auth-server.org, client: 172.26.0.1, server: _, 
request: "GET /get HTTP/1.1", host: "localhost:9080"
   2022/03/20 16:18:19 [info] 48#48: *1893 [lua] resolver.lua:43: 
parse_domain(): dns resolver domain: auth.my-auth-server.org to 38.134.56.123, 
client: 172.26.0.1, server: _, request: "GET /get HTTP/1.1", host: 
"localhost:9080"
   2022/03/20 16:18:19 [info] 52#52: *1916 [lua] timers.lua:39: run 
timer[plugin#server-info], context: ngx.timer
   2022/03/20 16:18:19 [notice] 1#1: signal 17 (SIGCHLD) received from 48
   2022/03/20 16:18:19 [alert] 1#1: worker process 48 exited on signal 11
   2022/03/20 16:18:19 [notice] 1#1: start worker process 59
   2022/03/20 16:18:19 [notice] 1#1: signal 29 (SIGIO) received
   2022/03/20 16:18:19 [notice] 59#59: sched_setaffinity(): using cpu #3
   
   ### Steps to Reproduce
   
   1. Run `docker-compose` with this file: 
https://github.com/apache/apisix-docker/blob/master/example/docker-compose-arm64.yml
   1. Enable `openid-connect` plugin:
   ```
   curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
 

[GitHub] [apisix] zhixiongdu027 commented on a change in pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


zhixiongdu027 commented on a change in pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#discussion_r830640039



##
File path: apisix/discovery/tars/init.lua
##
@@ -0,0 +1,283 @@
+--
+-- 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 ngx = ngx
+local format = string.format
+local ipairs = ipairs
+local error = error
+local tonumber = tonumber
+local local_conf = require("apisix.core.config_local").local_conf()
+local core = require("apisix.core")
+local mysql = require("resty.mysql")
+local process = require("ngx.process")
+
+local full_query_sql = [[ select servant, group_concat(endpoint order by 
endpoint) as endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where setting_state = 'active' and present_state = 'active'
+group by servant ]]
+
+local incremental_query_sql = [[
+select servant, (setting_state = 'active' and present_state = 'active') 
activated,
+group_concat(endpoint order by endpoint) endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where (application, server_name) in
+(
+select application, server_name from t_server_conf
+where registry_timestamp > now() - interval %d second
+union
+select application, server_name from t_adapter_conf
+where registry_timestamp > now() - interval %d second
+)
+group by servant, activated order by activated desc ]]
+
+local _M = {
+version = 0.1,
+}
+
+local endpoint_dict
+local default_weight
+
+local last_fetch_full_time = 0
+local last_fetch_error
+
+local endpoint_lrucache = core.lrucache.new({
+ttl = 300,
+count = 1024
+})
+
+local activated_buffer = core.table.new(10, 0)
+local nodes_buffer = core.table.new(0, 5)
+
+local endpoints_pattern = core.table.concat(
+{ 
[[tcp(\s*-[te]\s*(\S+)){0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+))]],
+  [[{0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+)){0,2}\s*(,|$)]] }
+)
+
+
+local function update_endpoint(servant, nodes)
+local endpoint_content = core.json.encode(nodes, true)
+local endpoint_version = ngx.crc32_long(endpoint_content)
+core.log.debug("set servant ", servant, endpoint_content)
+local _, err
+_, err = endpoint_dict:safe_set(servant .. "#version", endpoint_version)
+if err then
+core.log.error("set endpoint version into discovery DICT failed, ", 
err)
+return
+end
+_, err = endpoint_dict:safe_set(servant, endpoint_content)
+if err then
+core.log.error("set endpoint into discovery DICT failed, ", err)
+endpoint_dict:delete(servant .. "#version")
+end
+end
+
+
+local function delete_endpoint(servant)
+core.log.info("delete servant ", servant)
+endpoint_dict:delete(servant .. "#version")
+endpoint_dict:delete(servant)
+end
+
+
+local function create_endpoint_lrucache(servant)
+local endpoint_content = endpoint_dict:get_stale(servant)
+if not endpoint_content then
+core.log.error("get empty endpoint content from discovery DICT, 
servant: ", servant)
+return nil
+end
+
+local endpoint = core.json.decode(endpoint_content)
+if not endpoint then
+core.log.error("decode endpoint content failed, content: ", 
endpoint_content)
+return nil
+end
+
+return endpoint
+end
+
+
+local function get_endpoint(servant)
+local endpoint_version = endpoint_dict:get_stale(servant .. "#version")
+if not endpoint_version then
+return nil
+end
+
+return endpoint_lrucache(servant, endpoint_version, 
create_endpoint_lrucache, servant)
+end
+
+
+local function extract_endpoint(query_result)
+for _, p in ipairs(query_result) do
+repeat
+local servant = p.servant
+
+if servant == ngx.null then
+break
+end
+
+if p.activated == 1 then
+activated_buffer[servant] = ngx.null
+elseif p.activated == 0 then
+if activated_buffer[servant] == nil then
+delete_endpoint(servant)
+end
+break
+end
+
+core.table.clear(nodes_buffer)
+local iterator = 

[GitHub] [apisix] azilentech commented on a change in pull request #6586: feat: add support for password grant in keycloak plugin

2022-03-20 Thread GitBox


azilentech commented on a change in pull request #6586:
URL: https://github.com/apache/apisix/pull/6586#discussion_r830639264



##
File path: apisix/plugins/authz-keycloak.lua
##
@@ -695,8 +700,89 @@ local function fetch_jwt_token(ctx)
 return token
 end
 
+-- To get new access token by calling get token api
+local function generate_token_using_password_grant(conf,ctx)
+log.debug("generate_token_using_password_grant Function Called")
+
+local body, err = core.request.get_body()
+if err or not body then
+log.error("Failed to get request body: ", err)
+return 503
+end
+local parameters = ngx.decode_args(body)
+
+local username = parameters["username"]
+local password = parameters["password"]
+
+if not username then
+local err = "username is missing."
+log.error(err)
+return 422, err
+end
+if not password then
+local err = "password is missing."
+log.error(err)
+return 422, err
+end
+
+local client_id = authz_keycloak_get_client_id(conf)
+
+local token_endpoint = authz_keycloak_get_token_endpoint(conf)
+
+if not token_endpoint then
+local err = "Unable to determine token endpoint."
+log.error(err)
+return 503, err
+end
+local httpc = authz_keycloak_get_http_client(conf)
+
+local params = {
+method = "POST",
+body = ngx.encode_args({
+grant_type = "password",
+client_id = client_id,
+client_secret = conf.client_secret,
+username = username,
+password = password
+}),
+headers = {
+["Content-Type"] = "application/x-www-form-urlencoded"
+}
+}
+
+params = authz_keycloak_configure_params(params, conf)
+
+local res, err = httpc:request_uri(token_endpoint, params)
+
+if not res then
+err = "Accessing token endpoint URL (" .. token_endpoint
+  .. ") failed: " .. err
+log.error(err)
+return 401, {message = err}
+end
+
+log.debug("Response data: " .. res.body)
+local json, err = authz_keycloak_parse_json_response(res)
+
+if not json then
+err = "Could not decode JSON from response"
+  .. (err and (": " .. err) or '.')
+log.error(err)
+return 401, {message = err}
+end
+
+return res.status, res.body
+end
 
 function _M.access(conf, ctx)
+local headers = core.request.headers(ctx)
+local need_grant_token = conf.password_grant_token_generation_incoming_uri 
and
+ngx.var.request_uri == 
conf.password_grant_token_generation_incoming_uri and

Review comment:
   Done. Made the change.




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

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

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




[GitHub] [apisix-go-plugin-runner] codecov-commenter edited a comment on pull request #72: feat(ci): add e2e test framework

2022-03-20 Thread GitBox


codecov-commenter edited a comment on pull request #72:
URL: 
https://github.com/apache/apisix-go-plugin-runner/pull/72#issuecomment-1070826647


   # 
[Codecov](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#72](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (795f98d) into 
[master](https://codecov.io/gh/apache/apisix-go-plugin-runner/commit/8fdac12de1d573a5505ce1068eb5ec2943200441?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (8fdac12) will **decrease** coverage by `2.42%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@Coverage Diff @@
   ##   master  #72  +/-   ##
   ==
   - Coverage   80.84%   78.41%   -2.43% 
   ==
 Files  11   11  
 Lines 710  746  +36 
   ==
   + Hits  574  585  +11 
   - Misses100  122  +22 
   - Partials   36   39   +3 
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 | Coverage Δ | |
   |---|---|---|
   | 
[internal/server/server.go](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-aW50ZXJuYWwvc2VydmVyL3NlcnZlci5nbw==)
 | `50.40% <0.00%> (-17.08%)` | :arrow_down: |
   | 
[internal/http/request.go](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-aW50ZXJuYWwvaHR0cC9yZXF1ZXN0Lmdv)
 | `93.49% <0.00%> (-0.79%)` | :arrow_down: |
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=continue_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=footer_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation).
 Last update 
[8fdac12...795f98d](https://codecov.io/gh/apache/apisix-go-plugin-runner/pull/72?src=pr=lastupdated_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation).
 Read the [comment 
docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation).
   


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

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

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




[GitHub] [apisix-dashboard] codecov-commenter edited a comment on pull request #2347: feat: Merge path hostname input box

2022-03-20 Thread GitBox


codecov-commenter edited a comment on pull request #2347:
URL: 
https://github.com/apache/apisix-dashboard/pull/2347#issuecomment-1066122144


   # 
[Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2347?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#2347](https://codecov.io/gh/apache/apisix-dashboard/pull/2347?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (506206e) into 
[master](https://codecov.io/gh/apache/apisix-dashboard/commit/eb51353fd6130a4810af4128f57f401ba128d396?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (eb51353) will **increase** coverage by `6.55%`.
   > The diff coverage is `100.00%`.
   
   ```diff
   @@Coverage Diff @@
   ##   master#2347  +/-   ##
   ==
   + Coverage   62.04%   68.60%   +6.55% 
   ==
 Files  57  131  +74 
 Lines3905 3437 -468 
 Branches0  830 +830 
   ==
   - Hits 2423 2358  -65 
   + Misses   1197 1079 -118 
   + Partials  2850 -285 
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `68.60% <100.00%> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click 
here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment)
 to find out more.
   
   | [Impacted 
Files](https://codecov.io/gh/apache/apisix-dashboard/pull/2347?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 | Coverage Δ | |
   |---|---|---|
   | 
[web/src/components/Upstream/UpstreamForm.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2347/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL1Vwc3RyZWFtRm9ybS50c3g=)
 | `90.12% <ø> (ø)` | |
   | 
[...ents/Upstream/components/active-check/HttpPath.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2347/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0h0dHBQYXRoLnRzeA==)
 | `100.00% <ø> (ø)` | |
   | 
[web/src/pages/Upstream/Create.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2347/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9VcHN0cmVhbS9DcmVhdGUudHN4)
 | `94.54% <100.00%> (ø)` | |
   | 
[api/internal/filter/authentication.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2347/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2ZpbHRlci9hdXRoZW50aWNhdGlvbi5nbw==)
 | | |
   | 
[api/internal/filter/recover.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2347/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZWNvdmVyLmdv)
 | | |
   | 
[api/internal/filter/cors.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2347/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2ZpbHRlci9jb3JzLmdv)
 | | |
   | 
[api/internal/core/storage/storage\_mock.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2347/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmFnZS9zdG9yYWdlX21vY2suZ28=)
 | | |
   | 
[api/internal/conf/conf.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2347/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2NvbmYvY29uZi5nbw==)
 | | |
   | 
[api/internal/route.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2347/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL3JvdXRlLmdv)
 | | |
   | 
[api/internal/core/migrate/dataset.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2347/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2NvcmUvbWlncmF0ZS9kYXRhc2V0Lmdv)
 

[GitHub] [apisix] zhixiongdu027 commented on a change in pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


zhixiongdu027 commented on a change in pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#discussion_r830632628



##
File path: apisix/discovery/tars/init.lua
##
@@ -0,0 +1,340 @@
+--
+-- 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 ngx = ngx
+local format = string.format
+local ipairs = ipairs
+local error = error
+local tonumber = tonumber
+local local_conf = require("apisix.core.config_local").local_conf()
+local core = require("apisix.core")
+local mysql = require("resty.mysql")
+local process = require("ngx.process")
+
+local endpoint_dict = ngx.shared.tars
+if not endpoint_dict then
+error("failed to get nginx shared dict: tars, please check your APISIX 
version")
+end
+
+local full_query_sql = [[ select servant, group_concat(endpoint order by 
endpoint) as endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where setting_state = 'active' and present_state = 'active'
+group by servant ]]
+
+local incremental_query_sql = [[
+select servant, (setting_state = 'active' and present_state = 'active') 
activated,
+group_concat(endpoint order by endpoint) endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where (application, server_name) in
+(
+select application, server_name from t_server_conf
+where registry_timestamp > now() - interval %d second
+union
+select application, server_name from t_adapter_conf
+where registry_timestamp > now() - interval %d second
+)
+group by servant, activated order by activated desc ]]
+
+local _M = {
+version = 0.1,
+}
+
+local default_weight
+
+local last_fetch_full_time = 0
+local last_db_error
+
+local endpoint_lrucache = core.lrucache.new({
+ttl = 300,
+count = 1024
+})
+
+local activated_buffer = core.table.new(10, 0)
+local nodes_buffer = core.table.new(0, 5)
+
+
+--[[
+endpoints format as follows:
+  tcp -h 172.16.1.1 -p 11 -t 6000 -e 0,tcp -e 0 -p 12 -h 172.16.1.1,tcp -p 13 
-h 172.16.1.1
+we extract host and port value via endpoints_pattern
+--]]
+local endpoints_pattern = core.table.concat(
+{ 
[[tcp(\s*-[te]\s*(\S+)){0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+))]],
+  [[{0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+)){0,2}\s*(,|$)]] }
+)
+
+
+local function update_endpoint(servant, nodes)
+local endpoint_content = core.json.encode(nodes, true)
+local endpoint_version = ngx.crc32_long(endpoint_content)
+core.log.debug("set servant ", servant, endpoint_content)
+local _, err
+_, err = endpoint_dict:safe_set(servant .. "#version", endpoint_version)
+if err then
+core.log.error("set endpoint version into nginx shared dict failed, ", 
err)
+return
+end
+_, err = endpoint_dict:safe_set(servant, endpoint_content)
+if err then
+core.log.error("set endpoint into nginx shared dict failed, ", err)
+endpoint_dict:delete(servant .. "#version")
+end
+end
+
+
+local function delete_endpoint(servant)
+core.log.info("delete servant ", servant)
+endpoint_dict:delete(servant .. "#version")
+endpoint_dict:delete(servant)
+end
+
+
+local function add_endpoint_to_lrucache(servant)
+local endpoint_content, err = endpoint_dict:get_stale(servant)
+if not endpoint_content then
+core.log.error("get empty endpoint content, servant: ", servant, ", 
err: ", err)
+return nil
+end
+
+local endpoint, err = core.json.decode(endpoint_content)
+if not endpoint then
+core.log.error("decode json failed, content: ", endpoint_content, ", 
err: ", err)
+return nil
+end
+
+return endpoint
+end
+
+
+local function get_endpoint(servant)
+local endpoint_version, err = endpoint_dict:get_stale(servant .. 
"#version")
+if not endpoint_version  then
+if err then
+core.log.error("get empty endpoint version, servant: ", servant, 
", err: ", err)
+end
+return nil
+end
+return endpoint_lrucache(servant, endpoint_version, 
add_endpoint_to_lrucache, servant)
+end
+
+
+local function extract_endpoint(query_result)
+for _, p in ipairs(query_result) do
+repeat
+local servant = 

[GitHub] [apisix] zhixiongdu027 commented on a change in pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


zhixiongdu027 commented on a change in pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#discussion_r830632334



##
File path: apisix/discovery/tars/init.lua
##
@@ -0,0 +1,332 @@
+--
+-- 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 ngx = ngx
+local format = string.format
+local ipairs = ipairs
+local error = error
+local tonumber = tonumber
+local local_conf = require("apisix.core.config_local").local_conf()
+local core = require("apisix.core")
+local mysql = require("resty.mysql")
+local process = require("ngx.process")
+
+local full_query_sql = [[ select servant, group_concat(endpoint order by 
endpoint) as endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where setting_state = 'active' and present_state = 'active'
+group by servant ]]
+
+local incremental_query_sql = [[
+select servant, (setting_state = 'active' and present_state = 'active') 
activated,
+group_concat(endpoint order by endpoint) endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where (application, server_name) in
+(
+select application, server_name from t_server_conf
+where registry_timestamp > now() - interval %d second
+union
+select application, server_name from t_adapter_conf
+where registry_timestamp > now() - interval %d second
+)
+group by servant, activated order by activated desc ]]
+
+local _M = {
+version = 0.1,
+}
+
+local endpoint_dict
+local default_weight
+
+local last_fetch_full_time = 0
+local last_db_error
+
+local endpoint_lrucache = core.lrucache.new({
+ttl = 300,
+count = 1024
+})
+
+local activated_buffer = core.table.new(10, 0)
+local nodes_buffer = core.table.new(0, 5)
+
+
+--[[
+endpoints format as follows:
+  tcp -h 172.16.1.1 -p 11 -t 6000 -e 0,tcp -e 0 -p 12 -h 172.16.1.1,tcp -p 13 
-h 172.16.1.1
+we need extract host and port value via regex
+--]]
+local endpoints_pattern = core.table.concat(
+{ 
[[tcp(\s*-[te]\s*(\S+)){0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+))]],
+  [[{0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+)){0,2}\s*(,|$)]] }
+)
+
+
+local function update_endpoint(servant, nodes)
+local endpoint_content = core.json.encode(nodes, true)
+local endpoint_version = ngx.crc32_long(endpoint_content)
+core.log.debug("set servant ", servant, endpoint_content)
+local _, err
+_, err = endpoint_dict:safe_set(servant .. "#version", endpoint_version)
+if err then
+core.log.error("set endpoint version into nginx shared dict failed, ", 
err)
+return
+end
+_, err = endpoint_dict:safe_set(servant, endpoint_content)
+if err then
+core.log.error("set endpoint into nginx shared dict failed, ", err)
+endpoint_dict:delete(servant .. "#version")
+end
+end
+
+
+local function delete_endpoint(servant)
+core.log.info("delete servant ", servant)
+endpoint_dict:delete(servant .. "#version")
+endpoint_dict:delete(servant)
+end
+
+
+local function add_endpoint_to_lrucache(servant)
+local endpoint_content, err = endpoint_dict:get_stale(servant)
+if not endpoint_content then
+core.log.error("get empty endpoint content, servant: ", servant, ", 
err: ", err)
+return nil
+end
+
+local endpoint, err = core.json.decode(endpoint_content)
+if not endpoint then
+core.log.error("decode json failed, content: ", endpoint_content, ", 
err: ", err)
+return nil
+end
+
+return endpoint
+end
+
+
+local function get_endpoint(servant)
+local endpoint_version, err = endpoint_dict:get_stale(servant .. 
"#version")

Review comment:
   Sorry, I add comment in function fetch_full and forget  function 
get_endpoint()
   
   I will update




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

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

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




[GitHub] [apisix] zhixiongdu027 commented on a change in pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


zhixiongdu027 commented on a change in pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#discussion_r830632152



##
File path: conf/config-default.yaml
##
@@ -266,6 +266,7 @@ nginx_config: # config for render the 
template to generate n
   introspection: 10m
   access-tokens: 1m
   ext-plugin: 1m
+  tars: 1m

Review comment:
   Sorry,  I  think this place doesn't actively call db:close() should be 
acceptable, 
   [this 
link](https://forum.openresty.us/d/2151-f9a6aa2bb662b5ab77ee279e6dbd3ed6/4)  
provides agentzh's view
   @spacewander 




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

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

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




[GitHub] [apisix] zhixiongdu027 commented on a change in pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


zhixiongdu027 commented on a change in pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#discussion_r830632152



##
File path: conf/config-default.yaml
##
@@ -266,6 +266,7 @@ nginx_config: # config for render the 
template to generate n
   introspection: 10m
   access-tokens: 1m
   ext-plugin: 1m
+  tars: 1m

Review comment:
   Sorry,  I  think this place doesn't actively call db:close() should be 
acceptable, 
   [this 
link](https://forum.openresty.us/d/2151-f9a6aa2bb662b5ab77ee279e6dbd3ed6/4)  
provides agentzh's view 




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

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

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




[GitHub] [apisix] leslie-tsang commented on a change in pull request #6382: feat: add auth plugin for casdoor

2022-03-20 Thread GitBox


leslie-tsang commented on a change in pull request #6382:
URL: https://github.com/apache/apisix/pull/6382#discussion_r830616596



##
File path: apisix/plugins/authz-casdoor.lua
##
@@ -0,0 +1,164 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local http = require("resty.http")
+local session = require("resty.session")
+local ngx = ngx
+local rand = math.random
+local tostring = tostring
+
+
+local plugin_name = "authz-casdoor"
+local schema = {
+type = "object",
+properties = {
+-- Note: endpoint_addr and callback_url should not end with '/'
+endpoint_addr = {type = "string", pattern = "^[^%?]+[^/]$"},
+client_id = {type = "string"},
+client_secret = {type = "string"},
+callback_url = {type = "string", pattern = "^[^%?]+[^/]$"}
+},
+required = {
+"callback_url", "endpoint_addr", "client_id", "client_secret"
+}
+}
+
+local _M = {
+version = 0.1,
+priority = 2559,
+name = plugin_name,
+schema = schema
+}
+
+local function fetch_access_token(ctx, conf, state_in_session)
+local args = core.request.get_uri_args(ctx)
+if not args or not args.code or not args.state then
+return nil, nil, "failed when accessing token. Invalid code or state"
+end
+if args.state ~= tostring(state_in_session) then
+return nil, nil, "invalid state"
+end
+local client = http.new()
+local url = conf.endpoint_addr .. "/api/login/oauth/access_token"
+
+local res, err = client:request_uri(url, {
+method = "POST",
+body =  ngx.encode_args({
+code = args.code,
+grant_type = "authorization_code",
+client_id = conf.client_id,
+client_secret = conf.client_secret
+}),
+headers = {
+["Content-Type"] = "application/x-www-form-urlencoded"
+}
+})
+
+if not res then
+return nil, err
+end
+local data, err = core.json.decode(res.body)
+
+if err or not data then
+err = "failed to parse casdoor response data: " .. err .. ", body: " 
.. res.body
+return nil, nil, err
+end
+
+if not data.access_token then
+return nil, nil,
+   "failed when accessing token: no access_token contained"
+end
+if not data.expires_in or data.expires_in == 0 then
+return nil, nil, "failed when accessing token: invalid access_token"
+end
+
+return data.access_token, data.expires_in, nil
+end
+

Review comment:
   ```suggestion
   
   
   ```

##
File path: t/plugin/authz-casdoor.t
##
@@ -0,0 +1,453 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+use t::APISIX 'no_plan';
+
+repeat_each(1);
+no_long_string();
+no_root_location();
+add_block_preprocessor(sub {
+my ($block) = @_;
+
+if ((!defined $block->error_log) && (!defined $block->no_error_log)) {
+$block->set_value("no_error_log", "[error]");
+}
+
+if (!defined $block->request) {
+$block->set_value("request", "GET /t");
+}
+
+my $http_config = $block->http_config // <<_EOC_;
+server {
+listen 10420;
+location /api/login/oauth/access_token {
+content_by_lua_block {
+local json_encode = require("toolkit.json").encode
+ngx.req.read_body()
+local arg = ngx.req.get_post_args()["code"]
+
+local core = 

[apisix] branch master updated (5279c98 -> 1ca275b)

2022-03-20 Thread spacewander
This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 5279c98  docs: unify zh/*.md grammar (#6642)
 add 1ca275b  docs: change tcp/udp-logger.md docs (#6650)

No new revisions were added by this update.

Summary of changes:
 docs/zh/latest/plugins/tcp-logger.md | 2 +-
 docs/zh/latest/plugins/udp-logger.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


[apisix] branch master updated (6bb9fea -> 5279c98)

2022-03-20 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 6bb9fea  test: make plugin/log-rotate2.t stable (#6654)
 add 5279c98  docs: unify zh/*.md grammar (#6642)

No new revisions were added by this update.

Summary of changes:
 docs/zh/latest/admin-api.md|  2 +-
 docs/zh/latest/plugins/api-breaker.md  |  2 +-
 docs/zh/latest/plugins/clickhouse-logger.md|  2 +-
 docs/zh/latest/plugins/error-log-logger.md |  2 +-
 docs/zh/latest/plugins/fault-injection.md  |  2 +-
 docs/zh/latest/plugins/file-logger.md  |  2 +-
 docs/zh/latest/plugins/google-cloud-logging.md |  2 +-
 docs/zh/latest/plugins/http-logger.md  |  6 +++---
 docs/zh/latest/plugins/limit-conn.md   |  8 
 docs/zh/latest/plugins/limit-count.md  |  2 +-
 docs/zh/latest/plugins/openid-connect.md   |  2 +-
 docs/zh/latest/plugins/proxy-cache.md  | 10 +-
 docs/zh/latest/plugins/proxy-mirror.md |  8 
 docs/zh/latest/plugins/redirect.md | 10 +-
 docs/zh/latest/plugins/response-rewrite.md |  2 +-
 docs/zh/latest/plugins/serverless.md   |  2 +-
 docs/zh/latest/plugins/skywalking-logger.md|  2 +-
 docs/zh/latest/plugins/sls-logger.md   |  2 +-
 docs/zh/latest/plugins/splunk-hec-logging.md   |  2 +-
 docs/zh/latest/plugins/syslog.md   |  2 +-
 docs/zh/latest/plugins/tcp-logger.md   |  2 +-
 docs/zh/latest/plugins/udp-logger.md   |  2 +-
 docs/zh/latest/plugins/uri-blocker.md  |  2 +-
 23 files changed, 39 insertions(+), 39 deletions(-)


[GitHub] [apisix-dashboard] kingmouse-yx opened a new issue #2388: Request help: how to set a uniform access prefix for dashboard

2022-03-20 Thread GitBox


kingmouse-yx opened a new issue #2388:
URL: https://github.com/apache/apisix-dashboard/issues/2388


   I want to add a uniform prefix to the dashboard project, which can make it 
more convenient for me to do proxy in the production environment. 
   his is what I am doing now:
   I modified base value and publicpath value in the config.ts. 
   And in the app.tsx,  I modified the prefix value in the RequestConfig. 
   When I restart the project, I find that it is indeed effective, 
   but `http://127.0.0.1:9000/dev-server/info?t=1647779517228` and 
`http://127.0.0.1:3001/umiui/info?t=1647779517228`
   didn't use my configuration prefix.
   If I need to configure a unified access prefix in the dashboard project, 
what do I need to do?


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

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

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




[GitHub] [apisix] spacewander merged pull request #6650: docs: change tcp/udp-logger.md docs

2022-03-20 Thread GitBox


spacewander merged pull request #6650:
URL: https://github.com/apache/apisix/pull/6650


   


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

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

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




[GitHub] [apisix] membphis merged pull request #6642: docs: unify zh/*.md grammar

2022-03-20 Thread GitBox


membphis merged pull request #6642:
URL: https://github.com/apache/apisix/pull/6642


   


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

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

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




[GitHub] [apisix] leslie-tsang commented on a change in pull request #6663: feat: improve kubernetes discovery

2022-03-20 Thread GitBox


leslie-tsang commented on a change in pull request #6663:
URL: https://github.com/apache/apisix/pull/6663#discussion_r830615557



##
File path: docs/zh/latest/discovery/kubernetes.md
##
@@ -115,6 +119,6 @@ service_name 的 pattern 如下:
 
 ---
 
-> Q: APISIX 是多进程模型, 是否意味着每个 APISIX 工作进程都会监听 Kubernetes v1.endpoints \
+> Q: APISIX 继承了Nginx 的多进程模型, 是否意味着每个 APISIX 工作进程都会监听 Kubernetes v1.endpoints \
 > A: Kubernetes 服务发现插件只使用特权进程监听 Kubernetes v1.endpoints, 然后将结果存储\
-> 在 ngx.shared.dict 中, 业务进程是通过查询 ngx.shared.dict 来获取结果的
+> 在 ngx.shared.kubernetes 中, 工作进程是通过查询 ngx.shared.kubernetes 来获取结果的

Review comment:
   ```suggestion
   > 在 ngx.shared.kubernetes 中, 工作进程是通过查询 ngx.shared.kubernetes 来获取结果
   ```

##
File path: docs/zh/latest/discovery/kubernetes.md
##
@@ -115,6 +119,6 @@ service_name 的 pattern 如下:
 
 ---
 
-> Q: APISIX 是多进程模型, 是否意味着每个 APISIX 工作进程都会监听 Kubernetes v1.endpoints \
+> Q: APISIX 继承了Nginx 的多进程模型, 是否意味着每个 APISIX 工作进程都会监听 Kubernetes v1.endpoints \

Review comment:
   ```suggestion
   > Q: APISIX 继承了 Nginx 的多进程模型, 是否意味着每个 APISIX 工作进程都会监听 Kubernetes 
v1.endpoints \
   ```




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

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

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




[GitHub] [apisix] spacewander closed pull request #6664: ci: solve "Package does not match intended download" err

2022-03-20 Thread GitBox


spacewander closed pull request #6664:
URL: https://github.com/apache/apisix/pull/6664


   


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

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

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




[GitHub] [apisix] spacewander commented on pull request #6664: ci: solve "Package does not match intended download" err

2022-03-20 Thread GitBox


spacewander commented on pull request #6664:
URL: https://github.com/apache/apisix/pull/6664#issuecomment-1073249633


   Yes


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

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

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




[GitHub] [apisix] spacewander opened a new pull request #6665: fix(public api): ensure the content-type is correct

2022-03-20 Thread GitBox


spacewander opened a new pull request #6665:
URL: https://github.com/apache/apisix/pull/6665


   Signed-off-by: spacewander 
   
   ### Description
   
   
   
   
   Fixes # (issue)
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX 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.

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

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




[GitHub] [apisix] leslie-tsang commented on pull request #6664: ci: solve "Package does not match intended download" err

2022-03-20 Thread GitBox


leslie-tsang commented on pull request #6664:
URL: https://github.com/apache/apisix/pull/6664#issuecomment-1073249122


   There seems to be some thing wrong with official OpenResty yum repo 
metadata. Which can't be fixed by 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.

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

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




[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #962: feat: use GitHub CDN

2022-03-20 Thread GitBox


netlify[bot] edited a comment on pull request #962:
URL: https://github.com/apache/apisix-website/pull/962#issuecomment-1073244848


   ✅ Deploy Preview for *apache-apisix* ready!
   
   
    Explore the source changes: 706ddf5790c462ace4eb43dd9279bbdf071ba78c
   
    Inspect the deploy log: 
[https://app.netlify.com/sites/apache-apisix/deploys/6237239000c3840008a92230](https://app.netlify.com/sites/apache-apisix/deploys/6237239000c3840008a92230)
   
    Browse the preview: 
[https://deploy-preview-962--apache-apisix.netlify.app](https://deploy-preview-962--apache-apisix.netlify.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.

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

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




[GitHub] [apisix] spacewander commented on a change in pull request #6382: feat: add auth plugin for casdoor

2022-03-20 Thread GitBox


spacewander commented on a change in pull request #6382:
URL: https://github.com/apache/apisix/pull/6382#discussion_r830610148



##
File path: docs/en/latest/plugins/authz-casdoor.md
##
@@ -0,0 +1,94 @@
+---
+title: authz-casdoor
+---
+
+
+
+## Summary

Review comment:
   @ComradeProgrammer 
   Need to handle this, see 
https://github.com/apache/apisix/pull/6382#discussion_r828661882




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

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

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




[GitHub] [apisix-website] netlify[bot] commented on pull request #962: feat: use GitHub CDN

2022-03-20 Thread GitBox


netlify[bot] commented on pull request #962:
URL: https://github.com/apache/apisix-website/pull/962#issuecomment-1073244848


    Deploy Preview for *apache-apisix* processing.
   
   
    Explore the source changes: 706ddf5790c462ace4eb43dd9279bbdf071ba78c
   
    Inspect the deploy log: 
[https://app.netlify.com/sites/apache-apisix/deploys/6237239000c3840008a92230](https://app.netlify.com/sites/apache-apisix/deploys/6237239000c3840008a92230)
   


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

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

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




[GitHub] [apisix-website] juzhiyuan opened a new pull request #962: feat: use GitHub CDN

2022-03-20 Thread GitBox


juzhiyuan opened a new pull request #962:
URL: https://github.com/apache/apisix-website/pull/962


   **Changes:**
   
   Use GitHub CDN instead of jsDelivr
   


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

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

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




[apisix-website] 01/01: feat: use github cdn

2022-03-20 Thread juzhiyuan
This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch feat-use-github-cdn
in repository https://gitbox.apache.org/repos/asf/apisix-website.git

commit 706ddf5790c462ace4eb43dd9279bbdf071ba78c
Author: juzhiyuan 
AuthorDate: Sun Mar 20 20:51:34 2022 +0800

feat: use github cdn
---
 scripts/sync-docs.js  |  2 +-
 website/config/ssrTemplate.js |  2 +-
 website/src/css/customTheme.css   | 10 +-
 website/src/pages/sections/endcta.jsx |  2 +-
 website/src/pages/showcase/index.js   |  2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/scripts/sync-docs.js b/scripts/sync-docs.js
index 81f3bb2..0078346 100644
--- a/scripts/sync-docs.js
+++ b/scripts/sync-docs.js
@@ -200,7 +200,7 @@ const replaceMDElements = (project, path, branch = 
"master") => {
 from: 
/(\.\.\/)+assets\/images\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g,
 to: (match) => {
   const imgPath = match.replace(/\(|\)|\.\.\/*/g, "");
-  const newUrl = 
`https://cdn.jsdelivr.net/gh/apache/${project}@${branch}/docs/${imgPath}`;
+  const newUrl = 
`https://raw.githubusercontent.com/apache/${project}/${branch}/docs/${imgPath}`;
   //console.log(`${project}: ${match}  ${newUrl}`);
   return newUrl;
 },
diff --git a/website/config/ssrTemplate.js b/website/config/ssrTemplate.js
index d089a15..54320b5 100644
--- a/website/config/ssrTemplate.js
+++ b/website/config/ssrTemplate.js
@@ -1,4 +1,4 @@
-const CDN_URL = 'https://cdn.jsdelivr.net/gh/apache/apisix-website@asf-site'
+const CDN_URL = 
'https://raw.githubusercontent.com/apache/apisix-website/asf-site'
 
 module.exports = {
   ssrTemplate: `
diff --git a/website/src/css/customTheme.css b/website/src/css/customTheme.css
index 4d60f22..c27cb02 100644
--- a/website/src/css/customTheme.css
+++ b/website/src/css/customTheme.css
@@ -54,27 +54,27 @@ html[data-theme="dark"] {
 
 @font-face {
   font-family: 'MaisonNeue-Medium';
-  src: local('MaisonNeue-Medium'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Medium.otf)
 format('opentype');
+  src: local('MaisonNeue-Medium'), 
url(https://raw.githubusercontent.com/apache/apisix-website/master/website/src/fonts/MaisonNeue-Medium.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-Bold';
-  src: local('MaisonNeue-Bold'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Bold.otf)
 format('opentype');
+  src: local('MaisonNeue-Bold'), 
url(https://raw.githubusercontent.com/apache/apisix-website/master/website/src/fonts/MaisonNeue-Bold.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-Light';
-  src: local('MaisonNeue-Light'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Light.otf)
 format('opentype');
+  src: local('MaisonNeue-Light'), 
url(https://raw.githubusercontent.com/apache/apisix-website/master/website/src/fonts/MaisonNeue-Light.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-Demi';
-  src: local('MaisonNeue-Demi'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Demi.otf)
 format('opentype');
+  src: local('MaisonNeue-Demi'), 
url(https://raw.githubusercontent.com/apache/apisix-website/master/website/src/fonts/MaisonNeue-Demi.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-ExtraBold';
-  src: local('MaisonNeue-ExtraBold'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-ExtraBold.otf)
 format('opentype');
+  src: local('MaisonNeue-ExtraBold'), 
url(https://raw.githubusercontent.com/apache/apisix-website/master/website/src/fonts/MaisonNeue-ExtraBold.otf)
 format('opentype');
   font-display: swap;
 }
 
diff --git a/website/src/pages/sections/endcta.jsx 
b/website/src/pages/sections/endcta.jsx
index e1cb863..34a8174 100644
--- a/website/src/pages/sections/endcta.jsx
+++ b/website/src/pages/sections/endcta.jsx
@@ -10,7 +10,7 @@ const EndCTA = () => {
 <>
   
 
-  Try APISIX today https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/assets/images/rocket.gif;
 alt="Rocket"/>
+  Try APISIX today https://raw.githubusercontent.com/apache/apisix-website/master/website/src/assets/images/rocket.gif;
 alt="Rocket"/>
 
 
   
diff --git a/website/src/pages/showcase/index.js 
b/website/src/pages/showcase/index.js
index f8fae12..8cdc636 100644
--- a/website/src/pages/showcase/index.js
+++ b/website/src/pages/showcase/index.js
@@ -43,7 +43,7 @@ const Content = (props) => {
   const showcases = siteConfig.customFields.showcases.map((user) => (
 
   https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/static/img/'
 + user.image}
+  

[apisix-website] branch feat-use-github-cdn created (now 706ddf5)

2022-03-20 Thread juzhiyuan
This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a change to branch feat-use-github-cdn
in repository https://gitbox.apache.org/repos/asf/apisix-website.git.


  at 706ddf5  feat: use github cdn

This branch includes the following new commits:

 new 706ddf5  feat: use github cdn

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[GitHub] [apisix] spacewander commented on a change in pull request #6382: feat: add auth plugin for casdoor

2022-03-20 Thread GitBox


spacewander commented on a change in pull request #6382:
URL: https://github.com/apache/apisix/pull/6382#discussion_r830609694



##
File path: apisix/plugins/authz-casdoor.lua
##
@@ -0,0 +1,164 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local http = require("resty.http")
+local session = require("resty.session")
+local ngx = ngx
+local rand = math.random
+local tostring = tostring
+
+
+local plugin_name = "authz-casdoor"
+local schema = {
+type = "object",
+properties = {
+-- Note: endpoint_addr and callback_url should not end with '/'
+endpoint_addr = {type = "string", pattern = "^[^%?]+[^/]$"},
+client_id = {type = "string"},
+client_secret = {type = "string"},
+callback_url = {type = "string", pattern = "^[^%?]+[^/]$"}
+},
+required = {
+"callback_url", "endpoint_addr", "client_id", "client_secret"
+}
+}
+
+local _M = {
+version = 0.1,
+priority = 2559,
+name = plugin_name,
+schema = schema
+}
+
+local function fetch_access_token(ctx, conf, state_in_session)
+local args = core.request.get_uri_args(ctx)
+if not args or not args.code or not args.state then
+return nil, nil, "failed when accessing token. Invalid code or state"
+end
+if args.state ~= tostring(state_in_session) then
+return nil, nil, "invalid state"
+end
+local client = http.new()
+local url = conf.endpoint_addr .. "/api/login/oauth/access_token"
+
+local res, err = client:request_uri(url, {
+method = "POST",
+body =  ngx.encode_args({
+code = args.code,
+grant_type = "authorization_code",
+client_id = conf.client_id,
+client_secret = conf.client_secret
+}),
+headers = {
+["Content-Type"] = "application/x-www-form-urlencoded"
+}
+})
+
+if not res then
+return nil, err
+end
+local data, err = core.json.decode(res.body)
+
+if err or not data then
+err = "failed to parse casdoor response data: " .. err .. ", body: " 
.. res.body
+return nil, nil, err
+end
+
+if not data.access_token then
+return nil, nil,
+   "failed when accessing token: no access_token contained"
+end
+if not data.expires_in or data.expires_in == 0 then

Review comment:
   Need a comment about why expires_in is checked?

##
File path: apisix/plugins/authz-casdoor.lua
##
@@ -0,0 +1,164 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local http = require("resty.http")
+local session = require("resty.session")
+local ngx = ngx
+local rand = math.random
+local tostring = tostring
+
+
+local plugin_name = "authz-casdoor"
+local schema = {
+type = "object",
+properties = {
+-- Note: endpoint_addr and callback_url should not end with '/'
+endpoint_addr = {type = "string", pattern = "^[^%?]+[^/]$"},
+client_id = {type = "string"},
+client_secret = {type = "string"},
+callback_url = {type = "string", pattern = "^[^%?]+[^/]$"}
+},
+required = {
+"callback_url", "endpoint_addr", "client_id", "client_secret"
+}
+}
+
+local _M = {
+version = 0.1,
+priority = 2559,
+name = plugin_name,
+schema = schema
+}
+
+local function fetch_access_token(ctx, conf, 

[GitHub] [apisix] spacewander commented on a change in pull request #6614: feat: support reading configuration form xds(mvp)

2022-03-20 Thread GitBox


spacewander commented on a change in pull request #6614:
URL: https://github.com/apache/apisix/pull/6614#discussion_r830611241



##
File path: apisix/core/config_xds.lua
##
@@ -0,0 +1,120 @@
+--
+-- 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.
+--
+
+--- Get configuration form ngx.shared.DICT.
+--
+-- @module core.config_xds
+
+local base  = require("resty.core.base")
+local config_local  = require("apisix.core.config_local")
+local table = table
+local error = error
+local is_http   = ngx.config.subsystem == "http"
+local io= io
+local io_open   = io.open
+local io_close  = io.close
+local package   = package
+local new_tab   = base.new_tab
+local ffi   = require ("ffi")
+local C = ffi.C
+local router_config = ngx.shared["router-config"]

Review comment:
   It is not configuration for router, but for route.




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

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

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




[GitHub] [apisix] spacewander commented on a change in pull request #6614: feat: support reading configuration form xds(mvp)

2022-03-20 Thread GitBox


spacewander commented on a change in pull request #6614:
URL: https://github.com/apache/apisix/pull/6614#discussion_r830611241



##
File path: apisix/core/config_xds.lua
##
@@ -0,0 +1,120 @@
+--
+-- 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.
+--
+
+--- Get configuration form ngx.shared.DICT.
+--
+-- @module core.config_xds
+
+local base  = require("resty.core.base")
+local config_local  = require("apisix.core.config_local")
+local table = table
+local error = error
+local is_http   = ngx.config.subsystem == "http"
+local io= io
+local io_open   = io.open
+local io_close  = io.close
+local package   = package
+local new_tab   = base.new_tab
+local ffi   = require ("ffi")
+local C = ffi.C
+local router_config = ngx.shared["router-config"]

Review comment:
   It is not configure for router, but for route.

##
File path: apisix/cli/ngx_tpl.lua
##
@@ -235,6 +235,10 @@ http {
 lua_shared_dict ext-plugin {* http.lua_shared_dict["ext-plugin"] *}; # 
cache for ext-plugin
 {% end %}
 
+{% if config_center == "xds" then %}
+lua_shared_dict router-config  10m;

Review comment:
   ```suggestion
   lua_shared_dict xds-route-config  10m;
   ```
   would that be better?

##
File path: apisix/core/config_xds.lua
##
@@ -0,0 +1,120 @@
+--
+-- 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.
+--
+
+--- Get configuration form ngx.shared.DICT.
+--
+-- @module core.config_xds
+
+local base  = require("resty.core.base")
+local config_local  = require("apisix.core.config_local")
+local table = table
+local error = error
+local is_http   = ngx.config.subsystem == "http"
+local io= io
+local io_open   = io.open
+local io_close  = io.close
+local package   = package
+local new_tab   = base.new_tab
+local ffi   = require ("ffi")
+local C = ffi.C
+local router_config = ngx.shared["router-config"]
+local ngx_re_match  = ngx.re.match
+local ngx_re_gmatch = ngx.re.gmatch
+
+local xds_lib_name = "libxds.so"
+
+
+local process
+if is_http then
+process = require("ngx.process")
+end
+
+
+ffi.cdef[[
+extern void initial(void* router_zone_ptr);
+]]
+
+
+local _M = {
+version = 0.1,
+local_conf = config_local.local_conf,
+}
+
+
+-- todo: refactor this function in chash.lua and radixtree.lua
+local function load_shared_lib(lib_name)
+local cpath = package.cpath
+local tried_paths = new_tab(32, 0)
+local i = 1
+
+local iter, err = ngx_re_gmatch(cpath, "[^;]+", "jo")
+if not iter then
+error("failed to gmatch: " .. err)
+end
+
+while true do
+local it = iter()
+local fpath
+fpath, err = ngx_re_match(it[0], "(.*/)",  "jo")
+if err then
+error("failed to match: " .. err)
+end
+local spath = fpath[0] .. lib_name
+
+local f = io_open(spath)
+if f ~= nil then
+io_close(f)
+return ffi.load(spath)
+end
+tried_paths[i] = spath
+i = i + 1
+
+if not it then
+break
+end
+end
+
+return nil, tried_paths
+end
+
+
+local function load_libxds(lib_name)
+local xdsagent, tried_paths = load_shared_lib(lib_name)
+
+if not 

[GitHub] [apisix] bisakhmondal commented on a change in pull request #6653: refactor: merge grpc_server_example

2022-03-20 Thread GitBox


bisakhmondal commented on a change in pull request #6653:
URL: https://github.com/apache/apisix/pull/6653#discussion_r830609560



##
File path: t/grpc_server_example/main.go
##
@@ -0,0 +1,254 @@
+/*
+ * 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.
+ */
+
+//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. 
--go-grpc_opt=paths=source_relative proto/helloworld.proto
+//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. 
--go-grpc_opt=paths=source_relative proto/import.proto
+//go:generate protoc  --include_imports --descriptor_set_out=proto.pb 
--go_out=. --go_opt=paths=source_relative --go-grpc_out=. 
--go-grpc_opt=paths=source_relative proto/src.proto
+
+// Package main implements a server for Greeter service.
+package main
+
+import (
+   "context"
+   "crypto/tls"
+   "crypto/x509"
+   "flag"
+   "fmt"
+   "io"
+   "io/ioutil"
+   "log"
+   "net"
+   "os"
+   "os/signal"
+   "syscall"
+   "time"
+
+   "google.golang.org/grpc"
+   "google.golang.org/grpc/codes"
+   "google.golang.org/grpc/credentials"
+   "google.golang.org/grpc/reflection"
+   "google.golang.org/grpc/status"
+
+   pb "github.com/api7/grpc_server_example/proto"
+)
+
+var (
+   grpcAddr  = ":50051"
+   grpcsAddr = ":50052"
+   grpcsMtlsAddr string
+
+   crtFilePath = "../t/cert/apisix.crt"
+   keyFilePath = "../t/cert/apisix.key"
+   caFilePath  string
+)
+
+func init() {
+   flag.StringVar(, "grpc-address", grpcAddr, "address for grpc")
+   flag.StringVar(, "grpcs-address", grpcsAddr, "address for 
grpcs")
+   flag.StringVar(, "grpcs-mtls-address", grpcsMtlsAddr, 
"address for grpcs in mTLS")
+   flag.StringVar(, "crt", crtFilePath, "path to certificate")
+   flag.StringVar(, "key", keyFilePath, "path to key")
+   flag.StringVar(, "ca", caFilePath, "path to ca")
+}
+
+// server is used to implement helloworld.GreeterServer.
+type server struct {
+   // Embed the unimplemented server
+   pb.UnimplementedGreeterServer
+   pb.UnimplementedTestImportServer
+}
+
+// SayHello implements helloworld.GreeterServer
+func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) 
(*pb.HelloReply, error) {
+   log.Printf("Received: %v", in.Name)
+   log.Printf("Enum Gender: %v", in.GetGender())
+   msg := "Hello " + in.Name
+
+   person := in.GetPerson()
+   if person != nil {
+   if person.GetName() != "" {
+   msg += fmt.Sprintf(", name: %v", person.GetName())
+   }
+   if person.GetAge() != 0 {
+   msg += fmt.Sprintf(", age: %v", person.GetAge())
+   }
+   }
+
+   return {
+   Message: msg,
+   Items:   in.GetItems(),
+   Gender:  in.GetGender(),
+   }, nil
+}
+
+func (s *server) SayHelloAfterDelay(ctx context.Context, in *pb.HelloRequest) 
(*pb.HelloReply, error) {
+
+   select {
+   case <-time.After(1 * time.Second):
+   fmt.Println("overslept")
+   case <-ctx.Done():
+   errStr := ctx.Err().Error()
+   if ctx.Err() == context.DeadlineExceeded {
+   return nil, status.Error(codes.DeadlineExceeded, errStr)
+   }
+   }
+
+   time.Sleep(1 * time.Second)
+
+   log.Printf("Received: %v", in.Name)
+
+   return {Message: "Hello delay " + in.Name}, nil
+}
+
+func (s *server) Plus(ctx context.Context, in *pb.PlusRequest) (*pb.PlusReply, 
error) {
+   log.Printf("Received: %v %v", in.A, in.B)
+   return {Result: in.A + in.B}, nil
+}
+
+// SayHelloServerStream streams HelloReply back to the client.
+func (s *server) SayHelloServerStream(req *pb.HelloRequest, stream 
pb.Greeter_SayHelloServerStreamServer) error {
+   log.Printf("Received server side stream req: %v\n", req)
+
+   // Say Hello 5 times.
+   for i := 0; i < 5; i++ {
+   if err := stream.Send({
+   Message: fmt.Sprintf("Hello %s", req.Name),
+   }); err != nil {
+   return 

[GitHub] [apisix] spacewander commented on a change in pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


spacewander commented on a change in pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#discussion_r830609058



##
File path: conf/config-default.yaml
##
@@ -266,6 +266,7 @@ nginx_config: # config for render the 
template to generate n
   introspection: 10m
   access-tokens: 1m
   ext-plugin: 1m
+  tars: 1m

Review comment:
   According to the example, we need to close if we don't keepalive?
   https://github.com/openresty/lua-resty-mysql#synopsis
   ```
-- put it into the connection pool of size 100,
   -- with 10 seconds max idle timeout
   local ok, err = db:set_keepalive(1, 100)
   if not ok then
   ngx.say("failed to set keepalive: ", err)
   return
   end
   
   -- or just close the connection right away:
   -- local ok, err = db:close()
   -- if not ok then
   -- ngx.say("failed to close: ", err)
   -- return
   -- end
   ```




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

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

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




[GitHub] [apisix] spacewander commented on a change in pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


spacewander commented on a change in pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#discussion_r830607932



##
File path: apisix/discovery/tars/init.lua
##
@@ -0,0 +1,340 @@
+--
+-- 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 ngx = ngx
+local format = string.format
+local ipairs = ipairs
+local error = error
+local tonumber = tonumber
+local local_conf = require("apisix.core.config_local").local_conf()
+local core = require("apisix.core")
+local mysql = require("resty.mysql")
+local process = require("ngx.process")
+
+local endpoint_dict = ngx.shared.tars
+if not endpoint_dict then
+error("failed to get nginx shared dict: tars, please check your APISIX 
version")
+end
+
+local full_query_sql = [[ select servant, group_concat(endpoint order by 
endpoint) as endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where setting_state = 'active' and present_state = 'active'
+group by servant ]]
+
+local incremental_query_sql = [[
+select servant, (setting_state = 'active' and present_state = 'active') 
activated,
+group_concat(endpoint order by endpoint) endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where (application, server_name) in
+(
+select application, server_name from t_server_conf
+where registry_timestamp > now() - interval %d second
+union
+select application, server_name from t_adapter_conf
+where registry_timestamp > now() - interval %d second
+)
+group by servant, activated order by activated desc ]]
+
+local _M = {
+version = 0.1,
+}
+
+local default_weight
+
+local last_fetch_full_time = 0
+local last_db_error
+
+local endpoint_lrucache = core.lrucache.new({
+ttl = 300,
+count = 1024
+})
+
+local activated_buffer = core.table.new(10, 0)
+local nodes_buffer = core.table.new(0, 5)
+
+
+--[[
+endpoints format as follows:
+  tcp -h 172.16.1.1 -p 11 -t 6000 -e 0,tcp -e 0 -p 12 -h 172.16.1.1,tcp -p 13 
-h 172.16.1.1
+we extract host and port value via endpoints_pattern
+--]]
+local endpoints_pattern = core.table.concat(
+{ 
[[tcp(\s*-[te]\s*(\S+)){0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+))]],
+  [[{0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+)){0,2}\s*(,|$)]] }
+)
+
+
+local function update_endpoint(servant, nodes)
+local endpoint_content = core.json.encode(nodes, true)
+local endpoint_version = ngx.crc32_long(endpoint_content)
+core.log.debug("set servant ", servant, endpoint_content)
+local _, err
+_, err = endpoint_dict:safe_set(servant .. "#version", endpoint_version)
+if err then
+core.log.error("set endpoint version into nginx shared dict failed, ", 
err)
+return
+end
+_, err = endpoint_dict:safe_set(servant, endpoint_content)
+if err then
+core.log.error("set endpoint into nginx shared dict failed, ", err)
+endpoint_dict:delete(servant .. "#version")
+end
+end
+
+
+local function delete_endpoint(servant)
+core.log.info("delete servant ", servant)
+endpoint_dict:delete(servant .. "#version")
+endpoint_dict:delete(servant)
+end
+
+
+local function add_endpoint_to_lrucache(servant)
+local endpoint_content, err = endpoint_dict:get_stale(servant)
+if not endpoint_content then
+core.log.error("get empty endpoint content, servant: ", servant, ", 
err: ", err)
+return nil
+end
+
+local endpoint, err = core.json.decode(endpoint_content)
+if not endpoint then
+core.log.error("decode json failed, content: ", endpoint_content, ", 
err: ", err)
+return nil
+end
+
+return endpoint
+end
+
+
+local function get_endpoint(servant)
+local endpoint_version, err = endpoint_dict:get_stale(servant .. 
"#version")
+if not endpoint_version  then
+if err then
+core.log.error("get empty endpoint version, servant: ", servant, 
", err: ", err)
+end
+return nil
+end
+return endpoint_lrucache(servant, endpoint_version, 
add_endpoint_to_lrucache, servant)
+end
+
+
+local function extract_endpoint(query_result)
+for _, p in ipairs(query_result) do
+repeat
+local servant = 

[GitHub] [apisix] spacewander commented on pull request #6663: feat: improve kubernetes discovery

2022-03-20 Thread GitBox


spacewander commented on pull request #6663:
URL: https://github.com/apache/apisix/pull/6663#issuecomment-1073240352


   Record the CI failure with this issue: 
https://github.com/openresty/openresty-packaging/issues/79


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

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

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




[GitHub] [apisix-website] juzhiyuan commented on a change in pull request #959: chore: Make some icons clearer and add some media queries

2022-03-20 Thread GitBox


juzhiyuan commented on a change in pull request #959:
URL: https://github.com/apache/apisix-website/pull/959#discussion_r830607387



##
File path: website/static/data/showcases.json
##
@@ -401,4 +401,4 @@
 "infoLink": "https://www.xinpianchang.com;,
 "pinned": true
   }
-]
+]

Review comment:
   ```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.

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

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




[GitHub] [apisix] spacewander commented on a change in pull request #6599: feat: add tars discovery

2022-03-20 Thread GitBox


spacewander commented on a change in pull request #6599:
URL: https://github.com/apache/apisix/pull/6599#discussion_r830606894



##
File path: apisix/discovery/tars/init.lua
##
@@ -0,0 +1,283 @@
+--
+-- 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 ngx = ngx
+local format = string.format
+local ipairs = ipairs
+local error = error
+local tonumber = tonumber
+local local_conf = require("apisix.core.config_local").local_conf()
+local core = require("apisix.core")
+local mysql = require("resty.mysql")
+local process = require("ngx.process")
+
+local full_query_sql = [[ select servant, group_concat(endpoint order by 
endpoint) as endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where setting_state = 'active' and present_state = 'active'
+group by servant ]]
+
+local incremental_query_sql = [[
+select servant, (setting_state = 'active' and present_state = 'active') 
activated,
+group_concat(endpoint order by endpoint) endpoints
+from t_server_conf left join t_adapter_conf tac using (application, 
server_name, node_name)
+where (application, server_name) in
+(
+select application, server_name from t_server_conf
+where registry_timestamp > now() - interval %d second
+union
+select application, server_name from t_adapter_conf
+where registry_timestamp > now() - interval %d second
+)
+group by servant, activated order by activated desc ]]
+
+local _M = {
+version = 0.1,
+}
+
+local endpoint_dict
+local default_weight
+
+local last_fetch_full_time = 0
+local last_fetch_error
+
+local endpoint_lrucache = core.lrucache.new({
+ttl = 300,
+count = 1024
+})
+
+local activated_buffer = core.table.new(10, 0)
+local nodes_buffer = core.table.new(0, 5)
+
+local endpoints_pattern = core.table.concat(
+{ 
[[tcp(\s*-[te]\s*(\S+)){0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+))]],
+  [[{0,2}\s*-([hpHP])\s*(\S+)(\s*-[teTE]\s*(\S+)){0,2}\s*(,|$)]] }
+)
+
+
+local function update_endpoint(servant, nodes)
+local endpoint_content = core.json.encode(nodes, true)
+local endpoint_version = ngx.crc32_long(endpoint_content)
+core.log.debug("set servant ", servant, endpoint_content)
+local _, err
+_, err = endpoint_dict:safe_set(servant .. "#version", endpoint_version)
+if err then
+core.log.error("set endpoint version into discovery DICT failed, ", 
err)
+return
+end
+_, err = endpoint_dict:safe_set(servant, endpoint_content)
+if err then
+core.log.error("set endpoint into discovery DICT failed, ", err)
+endpoint_dict:delete(servant .. "#version")
+end
+end
+
+
+local function delete_endpoint(servant)
+core.log.info("delete servant ", servant)
+endpoint_dict:delete(servant .. "#version")
+endpoint_dict:delete(servant)
+end
+
+
+local function create_endpoint_lrucache(servant)
+local endpoint_content = endpoint_dict:get_stale(servant)
+if not endpoint_content then
+core.log.error("get empty endpoint content from discovery DICT, 
servant: ", servant)
+return nil
+end
+
+local endpoint = core.json.decode(endpoint_content)
+if not endpoint then
+core.log.error("decode endpoint content failed, content: ", 
endpoint_content)
+return nil
+end
+
+return endpoint
+end
+
+
+local function get_endpoint(servant)
+local endpoint_version = endpoint_dict:get_stale(servant .. "#version")
+if not endpoint_version then
+return nil
+end
+
+return endpoint_lrucache(servant, endpoint_version, 
create_endpoint_lrucache, servant)
+end
+
+
+local function extract_endpoint(query_result)
+for _, p in ipairs(query_result) do
+repeat
+local servant = p.servant
+
+if servant == ngx.null then
+break
+end
+
+if p.activated == 1 then
+activated_buffer[servant] = ngx.null
+elseif p.activated == 0 then
+if activated_buffer[servant] == nil then
+delete_endpoint(servant)
+end
+break
+end
+
+core.table.clear(nodes_buffer)
+local iterator = 

[GitHub] [apisix-helm-chart] PGDream commented on a change in pull request #254: Ingress classname

2022-03-20 Thread GitBox


PGDream commented on a change in pull request #254:
URL: https://github.com/apache/apisix-helm-chart/pull/254#discussion_r830606759



##
File path: charts/apisix-dashboard/templates/ingress.yaml
##
@@ -24,6 +24,9 @@ apiVersion: extensions/v1beta1
 {{- end }}
 kind: Ingress
 metadata:
+  {{- if .Values.ingress.classNmae }}
+  ingressClassName: {{- .Values.ingress.classNmae -}}

Review comment:
   thx, already edited; 




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

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

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




[GitHub] [apisix] spacewander opened a new pull request #6664: ci: solve "Package does not match intended download" err

2022-03-20 Thread GitBox


spacewander opened a new pull request #6664:
URL: https://github.com/apache/apisix/pull/6664


   Signed-off-by: spacewander 
   
   ### Description
   
   
   
   
   Fixes # (issue)
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX 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.

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

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




  1   2   >