You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/08/09 09:07:17 UTC

[GitHub] [apisix] jackkkkklee opened a new pull request, #7634: add openfunction plugin

jackkkkklee opened a new pull request, #7634:
URL: https://github.com/apache/apisix/pull/7634

   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   support openfunction serverless platform 
   implement proposal #7404
   
   ### 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)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r943271724


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,70 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+prepare_kind_k8s() {
+    curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
+    chmod +x ./kind
+    curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
+    sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
+    kind create cluster --name myk8s-01
+}
+
+install_openfuncntion() {
+    curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
+    helm repo add openfunction https://openfunction.github.io/charts/
+    helm repo update
+    kubectl create namespace openfunction
+    helm install openfunction --set global.Keda.enabled=false --set global.Dapr.enabled=false openfunction/openfunction -n openfunction
+    kubectl wait pods --all  --for=condition=Ready --timeout=300s -n openfunction
+    kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
+    kubectl delete deployment -n keda --all
+    kubectl delete deployment -n dapr-system --all
+    kubectl delete pod -n keda --all
+    kubectl delete pod -n dapr-system --all
+}
+
+set_container_registry_secret() {
+    REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=apisixtestaccount123 REGISTRY_PASSWORD=apisixtestaccount

Review Comment:
   My plan is  to just run the function locally in docker with the image I created by openfunction platform previously,which doesn't need to install many services. I'll update it after test.



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

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

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r945472463


##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,131 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 Apache CNCF OpenFunction 插件的基本信息及使用方法。

Review Comment:
   OpenFunction is CNCF project not Apache? This expression sounds a bit strange.



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

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

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


[GitHub] [apisix] tzssangglass commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1219492015

   > @tzssangglass Could you please re-run the fail test?
   
   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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r954483454


##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## 启用插件
+
+通过以下命令创建一个路由,并在配置文件中添加 `openfunction` 插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+### 测试请求
+
+使用 `curl` 命令测试:
+
+```shell
+curl -i http://127.0.0.1:9080/hello -X POST -d'test'
+```
+
+正常返回结果:
+
+```
+hello, test!
+```
+
+### 配置路径转发
+
+`OpenFunction` 插件还支持 URL 路径转发,同时将请求代理到上游的 OpenFunction API 端点。基本请求路径的扩展被附加到插件配置中指定的 `function_uri` 。
+
+:::info IMPORTANT
+
+路由上配置的 `uri` 必须以 `*` 结尾,此功能才能正常工作。 APISIX 路由是严格匹配的,`*` 表示此 URI 的任何子路径都将匹配到同一路由。
+:::
+
+下面的示例配置了此功能:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello/*",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+现在,对路径 `hello/123` 的任何请求都将调用 OpenFunction 插件设置的对应的函数,并转发添加的路径:
+
+```shell
+curl  http://127.0.0.1:9080/hello/123
+```
+
+```shell
+Hello, 123!
+```
+
+## 禁用插件
+
+当你需要禁用 `openfunction` 插件时,可以通过以下命令删除相应的 JSON 配置,APISIX 将会自动重新加载相关配置,无需重启服务:

Review Comment:
   I think it does not need to change. Just keep it in the same style as other plugin docs。



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

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

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r941956621


##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,104 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+
+local schema = {
+    type = "object",
+    properties = {
+        function_uri = {type = "string"},
+        ssl_verify = {
+            type = "boolean",
+            default = true,
+        },
+        service_token = {type = "string"},
+        timeout = {
+            type = "integer",
+            minimum = 1,
+            maximum = 60000,
+            default = 60000,
+            description = "timeout in milliseconds",
+        },
+        keepalive = {type = "boolean", default = true},
+        keepalive_timeout = {type = "integer", minimum = 1000, default = 60000},
+        keepalive_pool = {type = "integer", minimum = 1, default = 5}
+    },
+    required = {"function_uri"}
+}
+
+
+local _M = {
+    version = 0.1,
+    priority = -1902,
+    name = "openfunction",
+    schema = schema,
+}
+
+
+function _M.check_schema(conf)
+    local ok, err = core.schema.check(schema, conf)
+    if not ok then
+        return false, err
+    end
+
+    return true
+end
+
+
+function _M.access(conf, ctx)
+    local params = {
+        method = ngx.req.get_method(),
+        body = core.request.get_body(),
+        keepalive = conf.keepalive,
+        ssl_verify = conf.ssl_verify,
+        headers = core.request.headers(ctx) or {}
+    }
+
+    -- setting authorization headers if not already set
+    if not params.headers["Authorization"] and conf.service_token then

Review Comment:
   service_token is a fixed value?



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r941963566


##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,104 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+
+local schema = {
+    type = "object",
+    properties = {
+        function_uri = {type = "string"},
+        ssl_verify = {
+            type = "boolean",
+            default = true,
+        },
+        service_token = {type = "string"},
+        timeout = {
+            type = "integer",
+            minimum = 1,
+            maximum = 60000,
+            default = 60000,
+            description = "timeout in milliseconds",
+        },
+        keepalive = {type = "boolean", default = true},
+        keepalive_timeout = {type = "integer", minimum = 1000, default = 60000},
+        keepalive_pool = {type = "integer", minimum = 1, default = 5}
+    },
+    required = {"function_uri"}
+}
+
+
+local _M = {
+    version = 0.1,
+    priority = -1902,
+    name = "openfunction",
+    schema = schema,
+}
+
+
+function _M.check_schema(conf)
+    local ok, err = core.schema.check(schema, conf)
+    if not ok then
+        return false, err
+    end
+
+    return true
+end
+
+
+function _M.access(conf, ctx)
+    local params = {
+        method = ngx.req.get_method(),
+        body = core.request.get_body(),
+        keepalive = conf.keepalive,
+        ssl_verify = conf.ssl_verify,
+        headers = core.request.headers(ctx) or {}
+    }
+
+    -- setting authorization headers if not already set
+    if not params.headers["Authorization"] and conf.service_token then

Review Comment:
   I think it is not a fixed value.Right now,Service_token depends on how user sets it in ingress-controller with basic auth . It can be "xx:xx",such as "test:test".



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r945478765


##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,131 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 Apache CNCF OpenFunction 插件的基本信息及使用方法。

Review Comment:
   Modified.
   OpenFunction is CNCF project not Apache. 



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

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

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


[GitHub] [apisix] tokers commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1220154891

   @jackkkkklee Well done, now let's focus on the docs and test cases, I think the implementation is really good!


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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r952377092


##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,181 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be sent to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which supports basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+
+### Install OpenFunction via Helm Chart
+
+The example below shows OpenFunction installed in Helm:
+
+```shell
+# add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+You can then verify if OpenFunction is ready:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### Create and Push a Function
+
+You can then create a function following the [sample](https://github.com/OpenFunction/samples)
+
+You'll need to push your function container image to a container registry like Docker Hub or Quay.io when building a function. To do that, you'll need to generate a secret for your container registry first.
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## Enable the Plugin
+
+You can now configure the Plugin on a specific Route and point to this running OpenFunction service:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+## Example usage
+
+Once you have configured the plugin, you can send a request to the Route and it will invoke the configured function:
+
+```shell
+curl -i http://127.0.0.1:9080/hello
+```
+
+This will give back the response from the function:
+
+```
+hello, test!
+```
+
+### Configuring path forwarding

Review Comment:
   ```suggestion
   ### Configure Path Transforming
   
   ```



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

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

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


[GitHub] [apisix] jackkkkklee commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1228412309

   @tokers  Could you please rerun ”CI / build (ubuntu-20.04, linux_openresty, t/node t/pubsub t/router t/script t/stream-node t/utils t/w... (pull_request) Failing after 17m...“?
   


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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r951216278


##########
t/plugin/openfunction/function-example/test-uri/hello.go:
##########
@@ -1,4 +1,6 @@
 /*
+ * Copyright 2022 The OpenFunction Authors.

Review Comment:
   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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r954484875


##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction

Review Comment:
   I think it should still be the name of plugin(openfunction). 



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

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

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r942727990


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,70 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+prepare_kind_k8s() {
+    curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
+    chmod +x ./kind
+    curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
+    sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
+    kind create cluster --name myk8s-01
+}
+
+install_openfuncntion() {
+    curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
+    helm repo add openfunction https://openfunction.github.io/charts/
+    helm repo update
+    kubectl create namespace openfunction
+    helm install openfunction --set global.Keda.enabled=false --set global.Dapr.enabled=false openfunction/openfunction -n openfunction
+    kubectl wait pods --all  --for=condition=Ready --timeout=300s -n openfunction
+    kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
+    kubectl delete deployment -n keda --all
+    kubectl delete deployment -n dapr-system --all
+    kubectl delete pod -n keda --all
+    kubectl delete pod -n dapr-system --all
+}
+
+set_container_registry_secret() {
+    REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=apisixtestaccount123 REGISTRY_PASSWORD=apisixtestaccount

Review Comment:
   Is there a lighter way (using less runtime memory) to run these services? I'm worried that running these services will again fill up the memory of the server where github action is running CI.



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r947747848


##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,125 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for ingress controller, .                                      |

Review Comment:
   It should be 'function entry points'



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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r941158749


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,70 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+prepare_kind_k8s() {
+    curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
+    chmod +x ./kind
+    curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
+    sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
+    kind create cluster --name myk8s-01
+}
+
+install_openfuncntion() {
+    curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
+    helm repo add openfunction https://openfunction.github.io/charts/
+    helm repo update
+    kubectl create namespace openfunction
+    helm install openfunction --set global.Keda.enabled=false --set global.Dapr.enabled=false openfunction/openfunction -n openfunction
+    kubectl wait pods --all  --for=condition=Ready --timeout=300s -n openfunction
+    kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
+    kubectl delete deployment -n keda --all
+    kubectl delete deployment -n dapr-system --all
+    kubectl delete pod -n keda --all
+    kubectl delete pod -n dapr-system --all
+}
+
+set_container_registry_secret() {
+    REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=apisixtestaccount123 REGISTRY_PASSWORD=apisixtestaccount

Review Comment:
   Why use this? We can push the docker images through `kind load docker-image`.



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,122 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenWhisk](https://openfunction.dev/) serverless platform.

Review Comment:
   ```suggestion
   The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
   ```



##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,104 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+
+local schema = {
+    type = "object",
+    properties = {
+        function_uri = {type = "string"},
+        ssl_verify = {
+            type = "boolean",
+            default = true,
+        },
+        service_token = {type = "string"},
+        timeout = {
+            type = "integer",
+            minimum = 1,
+            maximum = 60000,
+            default = 60000,
+            description = "timeout in milliseconds",
+        },
+        keepalive = {type = "boolean", default = true},
+        keepalive_timeout = {type = "integer", minimum = 1000, default = 60000},
+        keepalive_pool = {type = "integer", minimum = 1, default = 5}
+    },
+    required = {"function_uri"}
+}
+
+
+local _M = {
+    version = 0.1,
+    priority = -1902,
+    name = "openfunction",
+    schema = schema,
+}
+
+
+function _M.check_schema(conf)
+    local ok, err = core.schema.check(schema, conf)
+    if not ok then
+        return false, err
+    end
+
+    return true
+end
+
+
+function _M.access(conf, ctx)

Review Comment:
   Can we reuse code base in https://github.com/apache/apisix/blob/master/apisix/plugins/serverless/init.lua?



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,122 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenWhisk](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.
+
+## Attributes
+
+| Name              | Type    | Required | Default | Valid values | Description                                                                                                |
+| ----------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri      | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify        | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| service_token     | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for ingress controller, .                                      |
+| timeout           | integer | False    | 60000ms | [1, 60000]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive         | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool    | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction  calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+
+:::
+
+## Enabling the Plugin
+
+Before configuring the Plugin, you need to have OpenFunction running. The example below shows OpenFunction installed in Helm:
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+You can then verify if OpenFunction is ready:
+
+```shell
+kubectl get pods -namespace openfunction

Review Comment:
   ```suggestion
   kubectl get pods --namespace openfunction
   ```



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,122 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenWhisk](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.
+
+## Attributes
+
+| Name              | Type    | Required | Default | Valid values | Description                                                                                                |
+| ----------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri      | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify        | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| service_token     | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for ingress controller, .                                      |
+| timeout           | integer | False    | 60000ms | [1, 60000]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive         | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool    | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction  calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+
+:::
+
+## Enabling the Plugin
+
+Before configuring the Plugin, you need to have OpenFunction running. The example below shows OpenFunction installed in Helm:

Review Comment:
   Also give a link to the installation page of OpenFunction.



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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r942234217


##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,104 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+
+local schema = {
+    type = "object",
+    properties = {
+        function_uri = {type = "string"},
+        ssl_verify = {
+            type = "boolean",
+            default = true,
+        },
+        service_token = {type = "string"},
+        timeout = {
+            type = "integer",
+            minimum = 1,
+            maximum = 60000,
+            default = 60000,
+            description = "timeout in milliseconds",
+        },
+        keepalive = {type = "boolean", default = true},
+        keepalive_timeout = {type = "integer", minimum = 1000, default = 60000},
+        keepalive_pool = {type = "integer", minimum = 1, default = 5}
+    },
+    required = {"function_uri"}
+}
+
+
+local _M = {
+    version = 0.1,
+    priority = -1902,
+    name = "openfunction",
+    schema = schema,
+}
+
+
+function _M.check_schema(conf)
+    local ok, err = core.schema.check(schema, conf)
+    if not ok then
+        return false, err
+    end
+
+    return true
+end
+
+
+function _M.access(conf, ctx)

Review Comment:
   And code in init.lua, you can refer to azure-function for the detail.



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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r942235600


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,70 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+prepare_kind_k8s() {
+    curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
+    chmod +x ./kind
+    curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
+    sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
+    kind create cluster --name myk8s-01
+}
+
+install_openfuncntion() {
+    curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
+    helm repo add openfunction https://openfunction.github.io/charts/
+    helm repo update
+    kubectl create namespace openfunction
+    helm install openfunction --set global.Keda.enabled=false --set global.Dapr.enabled=false openfunction/openfunction -n openfunction
+    kubectl wait pods --all  --for=condition=Ready --timeout=300s -n openfunction
+    kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
+    kubectl delete deployment -n keda --all
+    kubectl delete deployment -n dapr-system --all
+    kubectl delete pod -n keda --all
+    kubectl delete pod -n dapr-system --all
+}
+
+set_container_registry_secret() {
+    REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=apisixtestaccount123 REGISTRY_PASSWORD=apisixtestaccount

Review Comment:
   You should avoid exposing your secrets here. By the way, is this for building openfunction itself or the function?



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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r951216508


##########
t/plugin/openfunction/function-example/test-uri/hello.go:
##########
@@ -1,4 +1,6 @@
 /*
+ * Copyright 2022 The OpenFunction Authors.

Review Comment:
   You can checkout the LICENSE file as an example.



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r948914339


##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,139 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).

Review Comment:
   Added



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

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

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


[GitHub] [apisix] jackkkkklee commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1219530925

   
   
   
   
   > > @tzssangglass Could you please re-run the fail test?
   > 
   > done
   
   Could you also re-run License checker / check-license (pull_request) ?
   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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] jackkkkklee commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1219422142

   @tzssangglass  Could you please re-run the fail test?


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

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

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


[GitHub] [apisix] soulbird commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
soulbird commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r950961394


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,16 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+wget https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz
+tar -zxvf pack-v0.27.0-linux.tgz
+
+# please update ./t/plugin/openfunction/function-example if you want to update function
+./pack build test-uri-image --path ./t/plugin/openfunction/function-example/test-uri  --builder openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld"  --env FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://goproxy.cn"
+./pack build test-body-image --path ./t/plugin/openfunction/function-example/test-body --builder openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld"  --env FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://goproxy.cn"
+./pack build test-header-image --path ./t/plugin/openfunction/function-example/test-header  --builder openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld"  --env FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://goproxy.cn"
+
+nohup docker run --rm --env="FUNC_CONTEXT={\"name\":\"HelloWorld\",\"version\":\"v1.0.0\",\"port\":\"8080\",\"runtime\":\"Knative\"}" --env="CONTEXT_MODE=self-host" --name test-uri -p 30584:8080  test-uri-image >/dev/null 2>&1 &
+nohup docker run --rm --env="FUNC_CONTEXT={\"name\":\"HelloWorld\",\"version\":\"v1.0.0\",\"port\":\"8080\",\"runtime\":\"Knative\"}" --env="CONTEXT_MODE=self-host" --name test-header -p 30583:8080 test-header-image >/dev/null 2>&1 &
+nohup docker run --rm --env="FUNC_CONTEXT={\"name\":\"HelloWorld\",\"version\":\"v1.0.0\",\"port\":\"8080\",\"runtime\":\"Knative\"}" --env="CONTEXT_MODE=self-host" --name test-body -p 30585:8080 test-body-image >/dev/null 2>&1 &

Review Comment:
   If you use a custom docker image, it's best to put it here: https://github.com/apache/apisix/blob/master/ci/pod/docker-compose.plugin.yml



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

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

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


[GitHub] [apisix] jackkkkklee commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1214813513

   @tokers Could you please re-run "CI / build (ubuntu-18.04, linux_openresty_1_19, t/plugin) (pull_request) " ?
   Timeout happened during building function.


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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r946328279


##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,36 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+local plugin_name, plugin_version, priority = "openfunction", 0.1, -1902
+
+local openfunction_authz_schema = {
+    service_token = {type = "string"}
+}
+
+local function request_processor(conf, ctx, params)
+    local headers = params.headers or {}
+    -- setting authorization headers if not already set
+    if not headers["authorization"] and conf.authorization

Review Comment:
   Yes,it is a problem.
   I think it can be avoided  by overwriting authorization headers only when 'conf.authorization.service_Token' is given by users ,since auth plugin runs before OpenFcuntion plugin. 
   However,it is still hard for user to apply user-specific authorization header when auth plugin runs.Will it be a good way to put user-specific token in an other header(e.g. 'o-function-token') and convert it to authorization header in access 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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r946518272


##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,36 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+local plugin_name, plugin_version, priority = "openfunction", 0.1, -1902
+
+local openfunction_authz_schema = {
+    service_token = {type = "string"}
+}
+
+local function request_processor(conf, ctx, params)
+    local headers = params.headers or {}
+    -- setting authorization headers if not already set
+    if not headers["authorization"] and conf.authorization

Review Comment:
   @jackkkkklee Just set the authorization header once users specify it in plugin config. `headers` variable is used only by this plugin and if you change it, the original request headers won't be changed, so there is no side-effect.



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r954479538


##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## 启用插件
+
+通过以下命令创建一个路由,并在配置文件中添加 `openfunction` 插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+### 测试请求
+
+使用 `curl` 命令测试:
+
+```shell
+curl -i http://127.0.0.1:9080/hello -X POST -d'test'
+```
+
+正常返回结果:
+
+```
+hello, test!
+```
+
+### 配置路径转发
+
+`OpenFunction` 插件还支持 URL 路径转发,同时将请求代理到上游的 OpenFunction API 端点。基本请求路径的扩展被附加到插件配置中指定的 `function_uri` 。

Review Comment:
   基本请求路径的扩展(如路由 `/hello/*` 中 `*` 的部分)会被添加到插件配置中指定的 `function_uri` 。
   加个例子会清晰一些吗?



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

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

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


[GitHub] [apisix] jackkkkklee commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1218262950

   @tzssangglass Could you please re-run "CI Centos7 / run ci on centos7 (t/admin t/cli t/config-center-yaml t/control t/core t/debug t/deploym" which has no contact with this pr?


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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r959202552


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,4 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+

Review Comment:
   No,we don't . I just run the function image in the dockerfile . And I ’ll discard the change in this file .



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

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

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


[GitHub] [apisix] tokers commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1221676116

   @jackkkkklee If some of the golang codes you added are from the OpenFucntion repo, please update the [LICENSE](https://github.com/apache/apisix/blob/master/LICENSE) to mark 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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] jackkkkklee commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1221723635

   > @jackkkkklee If some of the golang codes you added are from the OpenFucntion repo, please update the [LICENSE](https://github.com/apache/apisix/blob/master/LICENSE) to mark them.
   
   Added in the goland codes


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

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

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


[GitHub] [apisix] tzssangglass commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1220133123

   > Could you also re-run License checker / check-license (pull_request) ?
   > Thanks
   
   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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r949733421


##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,143 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送 function

Review Comment:
   ```suggestion
   ### 创建并推送函数
   ```



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,144 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+
+### Install OpenFunction via Helm Chart
+
+The example below shows OpenFunction installed in Helm:
+
+```shell
+# add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+You can then verify if OpenFunction is ready:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### Create and push a function

Review Comment:
   ```suggestion
   ### Create and Push a Function
   ```



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,144 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+
+### Install OpenFunction via Helm Chart
+
+The example below shows OpenFunction installed in Helm:
+
+```shell
+# add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+You can then verify if OpenFunction is ready:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### Create and push a function
+
+You can then create a function follow the [sample](https://github.com/OpenFunction/samples)
+
+When building a function, you’ll need to push your function container image to a container registry like Docker Hub or Quay.io. To do that you’ll need to generate a secret for your container registry first.
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## Enabling the Plugin

Review Comment:
   ```suggestion
   ## Enable the Plugin
   ```



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

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

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


[GitHub] [apisix] hf400159 commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r956675856


##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction

Review Comment:
   ok, you  also can add `API 网关`.



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r954591235


##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |

Review Comment:
   This is the link of openfunction gateway which uses k8s gateway.
   https://openfunction.dev/docs/concepts/networking/gateway/
   
   The define of function entry of openfunction (https://openfunction.dev/docs/concepts/networking/function-entrypoints/) which use k8s gateway to visit function from outsider.
   
   basic auth is  just a easy auth way that almost every k8s gateway has applied.



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r942061766


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,70 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+prepare_kind_k8s() {
+    curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
+    chmod +x ./kind
+    curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
+    sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
+    kind create cluster --name myk8s-01
+}
+
+install_openfuncntion() {
+    curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
+    helm repo add openfunction https://openfunction.github.io/charts/
+    helm repo update
+    kubectl create namespace openfunction
+    helm install openfunction --set global.Keda.enabled=false --set global.Dapr.enabled=false openfunction/openfunction -n openfunction
+    kubectl wait pods --all  --for=condition=Ready --timeout=300s -n openfunction
+    kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
+    kubectl delete deployment -n keda --all
+    kubectl delete deployment -n dapr-system --all
+    kubectl delete pod -n keda --all
+    kubectl delete pod -n dapr-system --all
+}
+
+set_container_registry_secret() {
+    REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=apisixtestaccount123 REGISTRY_PASSWORD=apisixtestaccount

Review Comment:
   The part of the openfuction building lifecycle, pushing the image to a registry, needs it.Will it be better to build locally to avoid this part?



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

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

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


[GitHub] [apisix] tokers commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1211725152

   @jackkkkklee Please make the CI pass. 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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r947417544


##########
apisix/plugins/openfunction.lua:
##########
@@ -18,17 +18,23 @@ local ngx_encode_base64 = ngx.encode_base64
 local plugin_name, plugin_version, priority = "openfunction", 0.1, -1902
 
 local openfunction_authz_schema = {
-    service_token = {type = "string"}
+    type = "object",
+    properties = {
+        service_token = {type = "string"},
+        user_token = {type = "string"}
+    }
 }
 
 local function request_processor(conf, ctx, params)
     local headers = params.headers or {}
-    -- setting authorization headers if not already set
-    if not headers["authorization"] and conf.authorization
-            and conf.authorization.service_token then
-        headers["authorization"] = "Basic " .. ngx_encode_base64(conf.authorization.service_token)
+    -- setting authorization headers if conf.authorization exists
+    if conf.authorization then
+        if conf.authorization.user_token then
+            headers["authorization"] = conf.authorization.user_token

Review Comment:
   removed 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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r945275843


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,13 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+docker pull apisixtestaccount123/sample-go-func:v1

Review Comment:
   I'm wondering if OpenFunction releases some sample functions 🤔.



##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,36 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+local plugin_name, plugin_version, priority = "openfunction", 0.1, -1902
+
+local openfunction_authz_schema = {
+    service_token = {type = "string"}
+}
+
+local function request_processor(conf, ctx, params)
+    local headers = params.headers or {}
+    -- setting authorization headers if not already set
+    if not headers["Authorization"] and conf.authorization

Review Comment:
   The local param `headers`.



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r945310133


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,13 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+docker pull apisixtestaccount123/sample-go-func:v1

Review Comment:
   They do, but the functions just print the URI of request, which doesn't meet my test cases(e.g. test body, test headers). Therefore, I just fork and change their functions a little bit.  



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

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

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


[GitHub] [apisix] soulbird commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
soulbird commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r950961394


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,16 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+wget https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz
+tar -zxvf pack-v0.27.0-linux.tgz
+
+# please update ./t/plugin/openfunction/function-example if you want to update function
+./pack build test-uri-image --path ./t/plugin/openfunction/function-example/test-uri  --builder openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld"  --env FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://goproxy.cn"
+./pack build test-body-image --path ./t/plugin/openfunction/function-example/test-body --builder openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld"  --env FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://goproxy.cn"
+./pack build test-header-image --path ./t/plugin/openfunction/function-example/test-header  --builder openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld"  --env FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://goproxy.cn"
+
+nohup docker run --rm --env="FUNC_CONTEXT={\"name\":\"HelloWorld\",\"version\":\"v1.0.0\",\"port\":\"8080\",\"runtime\":\"Knative\"}" --env="CONTEXT_MODE=self-host" --name test-uri -p 30584:8080  test-uri-image >/dev/null 2>&1 &
+nohup docker run --rm --env="FUNC_CONTEXT={\"name\":\"HelloWorld\",\"version\":\"v1.0.0\",\"port\":\"8080\",\"runtime\":\"Knative\"}" --env="CONTEXT_MODE=self-host" --name test-header -p 30583:8080 test-header-image >/dev/null 2>&1 &
+nohup docker run --rm --env="FUNC_CONTEXT={\"name\":\"HelloWorld\",\"version\":\"v1.0.0\",\"port\":\"8080\",\"runtime\":\"Knative\"}" --env="CONTEXT_MODE=self-host" --name test-body -p 30585:8080 test-body-image >/dev/null 2>&1 &

Review Comment:
   If you use a custom docker image, it's best to put it here: https://github.com/apache/apisix/blob/master/ci/pod/docker-compose.first.yml



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r951134712


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,16 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+wget https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz
+tar -zxvf pack-v0.27.0-linux.tgz
+
+# please update ./t/plugin/openfunction/function-example if you want to update function
+./pack build test-uri-image --path ./t/plugin/openfunction/function-example/test-uri  --builder openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld"  --env FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://goproxy.cn"
+./pack build test-body-image --path ./t/plugin/openfunction/function-example/test-body --builder openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld"  --env FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://goproxy.cn"
+./pack build test-header-image --path ./t/plugin/openfunction/function-example/test-header  --builder openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld"  --env FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://goproxy.cn"
+
+nohup docker run --rm --env="FUNC_CONTEXT={\"name\":\"HelloWorld\",\"version\":\"v1.0.0\",\"port\":\"8080\",\"runtime\":\"Knative\"}" --env="CONTEXT_MODE=self-host" --name test-uri -p 30584:8080  test-uri-image >/dev/null 2>&1 &
+nohup docker run --rm --env="FUNC_CONTEXT={\"name\":\"HelloWorld\",\"version\":\"v1.0.0\",\"port\":\"8080\",\"runtime\":\"Knative\"}" --env="CONTEXT_MODE=self-host" --name test-header -p 30583:8080 test-header-image >/dev/null 2>&1 &
+nohup docker run --rm --env="FUNC_CONTEXT={\"name\":\"HelloWorld\",\"version\":\"v1.0.0\",\"port\":\"8080\",\"runtime\":\"Knative\"}" --env="CONTEXT_MODE=self-host" --name test-body -p 30585:8080 test-body-image >/dev/null 2>&1 &

Review Comment:
   Added 
   



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r954658366


##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,181 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be sent to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which supports basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+
+### Install OpenFunction via Helm Chart

Review Comment:
   Thanks for your advice in docs!
   docs 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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] soulbird commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
soulbird commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r951173961


##########
.github/workflows/centos7-ci.yml:
##########
@@ -101,6 +101,7 @@ jobs:
     - name: Start CI env (PLUGIN_TEST)
       if: steps.test_env.outputs.type == 'plugin'
       run: |
+        sh t/plugin/openfunction/build-function-image.sh

Review Comment:
   I think the image can be built by moving the files in `t/plugin/openfunction/function-example` to `ci/pod/openfunction`, and then building the image, like: https://github.com/apache/apisix/blob/master/ci/pod/docker-compose.first.yml#L94. This makes it easier for us to manage all test images later. cc @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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] soulbird commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
soulbird commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r951173961


##########
.github/workflows/centos7-ci.yml:
##########
@@ -101,6 +101,7 @@ jobs:
     - name: Start CI env (PLUGIN_TEST)
       if: steps.test_env.outputs.type == 'plugin'
       run: |
+        sh t/plugin/openfunction/build-function-image.sh

Review Comment:
   I think the image can be built by moving the files in `t/plugin/openfunction/function-example` to `ci/pod/openfunction`, and then building the image, like: https://github.com/apache /apisix/blob/master/ci/pod/docker-compose.first.yml#L94. This makes it easier for us to manage all test images later. cc @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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r950781039


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,20 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+wget https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz
+tar -zxvf pack-v0.27.0-linux.tgz
+
+# please fork and repalce this(./samples/functions/knative/hello-world-go) if you want to update function
+git clone https://github.com/OpenFunction/samples.git
+git clone https://github.com/jackkkkklee/my-samples.git

Review Comment:
   @jackkkkklee Good idea. I think that's 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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r948892429


##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,139 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).

Review Comment:
   Add a sub title:
   
   ```
   ### Install OpenFunction via Helm Chart
   ```



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,139 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+The example below shows OpenFunction installed in Helm:
+
+```shell
+# add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+You can then verify if OpenFunction is ready:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+

Review Comment:
   Add a sub title:
   
   ```
   ### Push a Function
   ```



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r950701027


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,20 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+wget https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz
+tar -zxvf pack-v0.27.0-linux.tgz
+
+# please fork and repalce this(./samples/functions/knative/hello-world-go) if you want to update function
+git clone https://github.com/OpenFunction/samples.git
+git clone https://github.com/jackkkkklee/my-samples.git

Review Comment:
   How about create dir like ./t/plugin/openfunction/test-uri , ./t/plugin/openfunction/test-body ,./t/plugin/openfunction/test-header and put functions code in there 



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

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

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


[GitHub] [apisix] spacewander commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r959191367


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,4 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+

Review Comment:
   We don't need to touch this file?



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,161 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the Apache APISIX openfunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be sent to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which supports basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000 ms | [100, ...] ms| OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000 ms| [1000,...] ms| Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+
+### Create and Push a Function
+
+You can then create a function following the [sample](https://github.com/OpenFunction/samples)
+
+You'll need to push your function container image to a container registry like Docker Hub or Quay.io when building a function. To do that, you'll need to generate a secret for your container registry first.
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER= ${your_registry_user} REGISTRY_PASSWORD= ${your_registry_password}
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## Enable the Plugin
+
+You can now configure the Plugin on a specific Route and point to this running OpenFunction service:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '

Review Comment:
   ```suggestion
   curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   ```
   for the latest admin port 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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r942725322


##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,104 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+
+local schema = {
+    type = "object",
+    properties = {
+        function_uri = {type = "string"},
+        ssl_verify = {
+            type = "boolean",
+            default = true,
+        },
+        service_token = {type = "string"},
+        timeout = {
+            type = "integer",
+            minimum = 1,
+            maximum = 60000,
+            default = 60000,
+            description = "timeout in milliseconds",
+        },
+        keepalive = {type = "boolean", default = true},
+        keepalive_timeout = {type = "integer", minimum = 1000, default = 60000},
+        keepalive_pool = {type = "integer", minimum = 1, default = 5}
+    },
+    required = {"function_uri"}
+}
+
+
+local _M = {
+    version = 0.1,
+    priority = -1902,
+    name = "openfunction",
+    schema = schema,
+}
+
+
+function _M.check_schema(conf)
+    local ok, err = core.schema.check(schema, conf)
+    if not ok then
+        return false, err
+    end
+
+    return true
+end
+
+
+function _M.access(conf, ctx)
+    local params = {
+        method = ngx.req.get_method(),
+        body = core.request.get_body(),
+        keepalive = conf.keepalive,
+        ssl_verify = conf.ssl_verify,
+        headers = core.request.headers(ctx) or {}
+    }
+
+    -- setting authorization headers if not already set
+    if not params.headers["Authorization"] and conf.service_token then

Review Comment:
   got 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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] jackkkkklee commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1215129913

   > > Could you please re-run "CI / build (ubuntu-18.04, linux_openresty_1_19, t/plugin) (pull_request) " ?
   > > Timeout happened during building function.
   > 
   > accord to: https://github.com/apache/apisix/runs/7833789308?check_suite_focus=true, maybe some error in test cases?
   I think the root cause is network.
   In test case ,the server do not give response and test failed because of timeout in  pre env step.
   accord to https://github.com/apache/apisix/runs/7833789308?check_suite_focus=true#step:11:568 


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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r951214681


##########
t/plugin/openfunction/function-example/test-uri/hello.go:
##########
@@ -1,4 +1,6 @@
 /*
+ * Copyright 2022 The OpenFunction Authors.

Review Comment:
   Like adding  "hello.go file from OpenFunction/samples: https://github.com/OpenFunction/samples Apache 2.0" in License file ?



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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r949916810


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,20 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+wget https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz
+tar -zxvf pack-v0.27.0-linux.tgz
+
+# please fork and repalce this(./samples/functions/knative/hello-world-go) if you want to update function
+git clone https://github.com/OpenFunction/samples.git
+git clone https://github.com/jackkkkklee/my-samples.git

Review Comment:
   @tzssangglass @spacewander I think we may avoid these dependencies from personal repos or this repo will be messy.



##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,20 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+wget https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz
+tar -zxvf pack-v0.27.0-linux.tgz
+
+# please fork and repalce this(./samples/functions/knative/hello-world-go) if you want to update function

Review Comment:
   ```suggestion
   # please fork and replace this(./samples/functions/knative/hello-world-go) if you want to update function
   ```



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,181 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenFunction API endpoint as the upstream.

Review Comment:
   ```suggestion
   This Plugin can be configured on a Route and requests will be sent to the configured OpenFunction API endpoint as the upstream.
   ```



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r951206099


##########
.github/workflows/centos7-ci.yml:
##########
@@ -101,6 +101,7 @@ jobs:
     - name: Start CI env (PLUGIN_TEST)
       if: steps.test_env.outputs.type == 'plugin'
       run: |
+        sh t/plugin/openfunction/build-function-image.sh

Review Comment:
   Sure, it is good to move files in t/plugin/openfunction/function-example to ci/pod/openfunction, but building images of function in OpenFunction requires  using build-packs not dockerfile .



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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r951201846


##########
t/plugin/openfunction/function-example/test-uri/hello.go:
##########
@@ -1,4 +1,6 @@
 /*
+ * Copyright 2022 The OpenFunction Authors.

Review Comment:
   No, I mean we should also update the License file for APISIX.



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r945413140


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,13 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+docker pull apisixtestaccount123/sample-go-func:v1

Review Comment:
   I ‘ll add local function building process latter,then we just need to update the code of  repositories.



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

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

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


[GitHub] [apisix] tzssangglass commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1229519911

   > Could you please rerun ”CI / build (ubuntu-20.04, linux_openresty, t/node t/pubsub t/router t/script t/stream-node t/utils t/w... (pull_request) Failing after 17m...“?
   
   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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] hf400159 commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r953952195


##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,181 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be sent to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which supports basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+
+### Install OpenFunction via Helm Chart

Review Comment:
   same as zh



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## 启用插件
+
+通过以下命令创建一个路由,并在配置文件中添加 `openfunction` 插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+### 测试请求
+
+使用 `curl` 命令测试:
+
+```shell
+curl -i http://127.0.0.1:9080/hello -X POST -d'test'
+```
+
+正常返回结果:
+
+```
+hello, test!
+```
+
+### 配置路径转发
+
+`OpenFunction` 插件还支持 URL 路径转发,同时将请求代理到上游的 OpenFunction API 端点。基本请求路径的扩展被附加到插件配置中指定的 `function_uri` 。
+
+:::info IMPORTANT

Review Comment:
   ```suggestion
   :::info 重要
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## 启用插件
+
+通过以下命令创建一个路由,并在配置文件中添加 `openfunction` 插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+### 测试请求
+
+使用 `curl` 命令测试:
+
+```shell
+curl -i http://127.0.0.1:9080/hello -X POST -d'test'
+```
+
+正常返回结果:
+
+```
+hello, test!
+```
+
+### 配置路径转发
+
+`OpenFunction` 插件还支持 URL 路径转发,同时将请求代理到上游的 OpenFunction API 端点。基本请求路径的扩展被附加到插件配置中指定的 `function_uri` 。
+
+:::info IMPORTANT
+
+路由上配置的 `uri` 必须以 `*` 结尾,此功能才能正常工作。 APISIX 路由是严格匹配的,`*` 表示此 URI 的任何子路径都将匹配到同一路由。
+:::

Review Comment:
   ```suggestion
   路由上配置的 `uri` 必须以 `*` 结尾,此功能才能正常工作。APISIX 路由是严格匹配的,`*` 表示此 URI 的任何子路径都将匹配到同一路由。
   
   :::
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction

Review Comment:
   ```suggestion
   API 网关
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件

Review Comment:
   ```suggestion
   ## 前提条件
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。

Review Comment:
   ```suggestion
   因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,如果 `timeout` 字段的值设置太小,可能会导致大量请求失败。
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。

Review Comment:
   ```suggestion
   description: 本文介绍了 API 网关 Apache APISIX 的 openfunction 插件的基本信息及使用方法。
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## 启用插件
+
+通过以下命令创建一个路由,并在配置文件中添加 `openfunction` 插件:

Review Comment:
   ```suggestion
   你可以通过以下命令在指定路由中启用该插件:
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## 启用插件
+
+通过以下命令创建一个路由,并在配置文件中添加 `openfunction` 插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '

Review Comment:
   ```suggestion
   curl http://127.0.0.1:9080/apisix/admin/routes/1 \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## 启用插件
+
+通过以下命令创建一个路由,并在配置文件中添加 `openfunction` 插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+### 测试请求
+
+使用 `curl` 命令测试:
+
+```shell
+curl -i http://127.0.0.1:9080/hello -X POST -d'test'
+```
+
+正常返回结果:
+
+```
+hello, test!
+```
+
+### 配置路径转发
+
+`OpenFunction` 插件还支持 URL 路径转发,同时将请求代理到上游的 OpenFunction API 端点。基本请求路径的扩展被附加到插件配置中指定的 `function_uri` 。
+
+:::info IMPORTANT
+
+路由上配置的 `uri` 必须以 `*` 结尾,此功能才能正常工作。 APISIX 路由是严格匹配的,`*` 表示此 URI 的任何子路径都将匹配到同一路由。
+:::
+
+下面的示例配置了此功能:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello/*",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+现在,对路径 `hello/123` 的任何请求都将调用 OpenFunction 插件设置的对应的函数,并转发添加的路径:
+
+```shell
+curl  http://127.0.0.1:9080/hello/123
+```
+
+```shell
+Hello, 123!
+```
+
+## 禁用插件
+
+当你需要禁用 `openfunction` 插件时,可以通过以下命令删除相应的 JSON 配置,APISIX 将会自动重新加载相关配置,无需重启服务:

Review Comment:
   ```suggestion
   当你需要禁用该插件时,可通过以下命令删除相应的 JSON 配置,APISIX 将会自动重新加载相关配置,无需重启服务:
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note

Review Comment:
   ```suggestion
   :::note 注意
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## 启用插件
+
+通过以下命令创建一个路由,并在配置文件中添加 `openfunction` 插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+### 测试请求

Review Comment:
   ```suggestion
   ## 测试插件
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## 启用插件
+
+通过以下命令创建一个路由,并在配置文件中添加 `openfunction` 插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+### 测试请求
+
+使用 `curl` 命令测试:
+
+```shell
+curl -i http://127.0.0.1:9080/hello -X POST -d'test'
+```
+
+正常返回结果:
+
+```
+hello, test!
+```
+
+### 配置路径转发
+
+`OpenFunction` 插件还支持 URL 路径转发,同时将请求代理到上游的 OpenFunction API 端点。基本请求路径的扩展被附加到插件配置中指定的 `function_uri` 。

Review Comment:
   > 基本请求路径的扩展被附加到插件配置中指定的 `function_uri` 。
   
   我不太理解这句话,你可以描述的更清晰些吗?



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。

Review Comment:
   ```suggestion
   你可以参考 [OpenFunction 官方示例](https://github.com/OpenFunction/samples) 创建函数。构建函数时,你需要使用以下命令为容器仓库生成一个密钥,才可以将函数容器镜像推送到容器仓库( 例如 Docker Hub 或 Quay.io)。
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>

Review Comment:
   ```suggestion
   REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER= ${your_registry_user} REGISTRY_PASSWORD=${your_registry_password}
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |

Review Comment:
   > 支持函数入口的 basic auth 认证方式。
   
   Can you give a reference link?



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。

Review Comment:
   ```suggestion
   在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction。详情参考 [OpenFunction 安装指南](https://openfunction.dev/docs/getting-started/installation/)。
   
   请确保当前环境中已经安装对应版本的 Kubernetes 集群。
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```

Review Comment:
   ```suggestion
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```

Review Comment:
   前文已经给出安装 OpenFunction 的参考链接了,我觉得此处可以不用列出具体命令了。



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |

Review Comment:
   ```suggestion
   | keepalive_timeout           | integer | 否     | 60000 ms | [1000,...] ms | 当连接空闲时,保持该连接处于活动状态的时间,以毫秒为单位。               |
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |
+| keepalive                   | boolean | 否     | true    |              | 当设置为 `true` 时,保持连接的活动状态以便重复使用。         |
+| keepalive_timeout           | integer | 否     | 60000ms | [1000,...]ms | 当连接空闲时,保持该连接处于活动状态的时间(以毫秒为单位)。               |
+| keepalive_pool              | integer | 否     | 5       | [1,...]      | 连接断开之前,可接收的最大请求数。                           |
+
+:::note
+
+`timeout` 字段规定了 OpenFunction function 的最大执行时间,以及 APISIX 中 HTTP 客户端的请求超时时间。
+
+因为 OpenFunction function 调用可能会耗费很长时间来拉取容器镜像和启动容器,所以如果 `timeout` 字段值设置太小,可能会导致大量的失败请求。
+
+:::
+
+## 先决条件
+
+在使用 `openfunction` 插件之前,你需要通过以下命令运行 OpenFunction 。
+详情参考[官方安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。
+
+### 通过 Helm Chart 安装 OpenFunction
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 openfunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 创建并推送函数
+
+你可以通过官方示例创建函数 [sample](https://github.com/OpenFunction/samples) 。
+构建函数时,需要将函数容器镜像推送到容器仓库,如 Docker Hub 或 Quay.io。要做到这一点,首先需要输入如下命令为容器仓库生成一个密钥。
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## 启用插件
+
+通过以下命令创建一个路由,并在配置文件中添加 `openfunction` 插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+### 测试请求
+
+使用 `curl` 命令测试:
+
+```shell
+curl -i http://127.0.0.1:9080/hello -X POST -d'test'
+```
+
+正常返回结果:
+
+```
+hello, test!
+```
+
+### 配置路径转发
+
+`OpenFunction` 插件还支持 URL 路径转发,同时将请求代理到上游的 OpenFunction API 端点。基本请求路径的扩展被附加到插件配置中指定的 `function_uri` 。
+
+:::info IMPORTANT
+
+路由上配置的 `uri` 必须以 `*` 结尾,此功能才能正常工作。 APISIX 路由是严格匹配的,`*` 表示此 URI 的任何子路径都将匹配到同一路由。
+:::
+
+下面的示例配置了此功能:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello/*",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+现在,对路径 `hello/123` 的任何请求都将调用 OpenFunction 插件设置的对应的函数,并转发添加的路径:
+
+```shell
+curl  http://127.0.0.1:9080/hello/123
+```
+
+```shell
+Hello, 123!
+```
+
+## 禁用插件
+
+当你需要禁用 `openfunction` 插件时,可以通过以下命令删除相应的 JSON 配置,APISIX 将会自动重新加载相关配置,无需重启服务:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '

Review Comment:
   ```suggestion
   curl http://127.0.0.1:9080/apisix/admin/routes/1 \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |

Review Comment:
   ```suggestion
   | authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx`,支持函数入口的 basic auth 认证方式。 |
   ```



##########
docs/zh/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,179 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: 本文介绍了关于 CNCF OpenFunction 插件的基本信息及使用方法。
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## 描述
+
+`openfunction` 插件用于将开源的分布式无服务器平台 [CNCF OpenFunction](https://openfunction.dev/) 作为动态上游集成至 APISIX。
+
+启用 `openfunction` 插件后,该插件会终止对已配置 URI 的请求,并代表客户端向 OpenFunction 的 function 发起一个新的请求,然后 `openfunction` 插件会将响应信息返回至客户端。
+
+## 属性
+
+| 名称                         | 类型    | 必选项 | 默认值  | 有效值       | 描述                                                         |
+| --------------------------- | ------- | ------ | ------- | ------------ | ------------------------------------------------------------ |
+| function_uri                | string  | 是     |         |              | OpenFunction function uri,例如 `https://localhost:30858/default/function-sample`。     |
+| ssl_verify                  | boolean | 否     | true    |              | 当设置为 `true` 时执行 SSL 验证。                            |
+| authorization               | object  | 否     |         |              | 访问 OpenFunction 的函数的授权凭证。|
+| authorization.service_token | string  | 否     |         |              | OpenFunction service token,其格式为 `xxx:xxx` ,支持函数入口的 basic auth 认证方式。 |
+| timeout                     | integer | 否     | 3000ms  | [100,...]ms  | OpenFunction action 和 HTTP 调用超时时间(以毫秒为单位)。          |

Review Comment:
   ```suggestion
   | timeout                     | integer | 否     | 3000 ms  | [100,...] ms  | OpenFunction action 和 HTTP 调用超时时间,以毫秒为单位。          |
   ```



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r942239418


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,70 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+prepare_kind_k8s() {
+    curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
+    chmod +x ./kind
+    curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
+    sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
+    kind create cluster --name myk8s-01
+}
+
+install_openfuncntion() {
+    curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
+    helm repo add openfunction https://openfunction.github.io/charts/
+    helm repo update
+    kubectl create namespace openfunction
+    helm install openfunction --set global.Keda.enabled=false --set global.Dapr.enabled=false openfunction/openfunction -n openfunction
+    kubectl wait pods --all  --for=condition=Ready --timeout=300s -n openfunction
+    kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
+    kubectl delete deployment -n keda --all
+    kubectl delete deployment -n dapr-system --all
+    kubectl delete pod -n keda --all
+    kubectl delete pod -n dapr-system --all
+}
+
+set_container_registry_secret() {
+    REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=apisixtestaccount123 REGISTRY_PASSWORD=apisixtestaccount

Review Comment:
   Sure,for the function.
   I 'll avoid 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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r941964453


##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,104 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+
+local schema = {
+    type = "object",
+    properties = {
+        function_uri = {type = "string"},
+        ssl_verify = {
+            type = "boolean",
+            default = true,
+        },
+        service_token = {type = "string"},
+        timeout = {
+            type = "integer",
+            minimum = 1,
+            maximum = 60000,
+            default = 60000,
+            description = "timeout in milliseconds",
+        },
+        keepalive = {type = "boolean", default = true},
+        keepalive_timeout = {type = "integer", minimum = 1000, default = 60000},
+        keepalive_pool = {type = "integer", minimum = 1, default = 5}
+    },
+    required = {"function_uri"}
+}
+
+
+local _M = {
+    version = 0.1,
+    priority = -1902,
+    name = "openfunction",
+    schema = schema,
+}
+
+
+function _M.check_schema(conf)
+    local ok, err = core.schema.check(schema, conf)
+    if not ok then
+        return false, err
+    end
+
+    return true
+end
+
+
+function _M.access(conf, ctx)

Review Comment:
   Maybe you mean reuse https://github.com/apache/apisix/blob/master/apisix/plugins/serverless/generic-upstream.lua ?



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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r947672725


##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,125 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for ingress controller, .                                      |

Review Comment:
   Why mention the ingress controller?



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,125 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.

Review Comment:
   It's not OpenWhish.



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,125 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for ingress controller, .                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Enabling the Plugin
+
+Before configuring the plugin, you need to have OpenFunction running. For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+The example below shows OpenFunction installed in Helm:
+
+```shell
+#add the OpenFunction chart repository

Review Comment:
   ```suggestion
   # add the OpenFunction chart repository
   ```



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,125 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for ingress controller, .                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Enabling the Plugin
+
+Before configuring the plugin, you need to have OpenFunction running. For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+The example below shows OpenFunction installed in Helm:
+
+```shell
+#add the OpenFunction chart repository

Review Comment:
   Move these steps to the `Prerequisites` section (out of `Enabling the Plugin`).
   
   Also, we need to tell users that Kubernetes is required.



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,125 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for ingress controller, .                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Enabling the Plugin
+
+Before configuring the plugin, you need to have OpenFunction running. For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+The example below shows OpenFunction installed in Helm:
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+You can then verify if OpenFunction is ready:
+
+```shell
+kubectl get pods -namespace openfunction

Review Comment:
   ```suggestion
   kubectl get pods --namespace openfunction
   ```



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,125 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for ingress controller, .                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Enabling the Plugin
+
+Before configuring the plugin, you need to have OpenFunction running. For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+The example below shows OpenFunction installed in Helm:
+
+```shell
+#add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+You can then verify if OpenFunction is ready:
+
+```shell
+kubectl get pods -namespace openfunction
+```
+
+You can then create a function follow the [sample](https://github.com/OpenFunction/samples)
+
+You can now configure the Plugin on a specific Route and point to this running OpenFunction service:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+## Example usage
+
+Once you have configured the Plugin, you can send a request to the Route and it will invoke the configured function:

Review Comment:
   ```suggestion
   Once you have configured the plugin, you can send a request to the Route and it will invoke the configured function:
   ```



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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r947395440


##########
apisix/plugins/openfunction.lua:
##########
@@ -18,17 +18,23 @@ local ngx_encode_base64 = ngx.encode_base64
 local plugin_name, plugin_version, priority = "openfunction", 0.1, -1902
 
 local openfunction_authz_schema = {
-    service_token = {type = "string"}
+    type = "object",
+    properties = {
+        service_token = {type = "string"},
+        user_token = {type = "string"}
+    }
 }
 
 local function request_processor(conf, ctx, params)
     local headers = params.headers or {}
-    -- setting authorization headers if not already set
-    if not headers["authorization"] and conf.authorization
-            and conf.authorization.service_token then
-        headers["authorization"] = "Basic " .. ngx_encode_base64(conf.authorization.service_token)
+    -- setting authorization headers if conf.authorization exists
+    if conf.authorization then
+        if conf.authorization.user_token then
+            headers["authorization"] = conf.authorization.user_token

Review Comment:
   No, I don't think we need this.
   
   



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

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

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


[GitHub] [apisix] tzssangglass commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1215343401

   rerun


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

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

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


[GitHub] [apisix] spacewander commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r944148528


##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,122 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.
+
+## Attributes
+
+| Name              | Type    | Required | Default | Valid values | Description                                                                                                |
+| ----------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri      | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify        | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| service_token     | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for ingress controller, .                                      |
+| timeout           | integer | False    | 60000ms | [1, 60000]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive         | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool    | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction  calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Enabling the Plugin
+
+Before configuring the Plugin, you need to have OpenFunction running. For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).

Review Comment:
   ```suggestion
   Before configuring the plugin, you need to have OpenFunction running. For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
   ```



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,122 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be send to the configured OpenWhish API endpoint as the upstream.
+
+## Attributes
+
+| Name              | Type    | Required | Default | Valid values | Description                                                                                                |
+| ----------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri      | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify        | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| service_token     | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for ingress controller, .                                      |
+| timeout           | integer | False    | 60000ms | [1, 60000]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive         | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool    | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction  calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.

Review Comment:
   ```suggestion
   The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
   ```



##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,36 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+local plugin_name, plugin_version, priority = "openfunction", 0.1, -1902
+
+local openfunction_authz_schema = {
+    service_token = {type = "string"}
+}
+
+local function request_processor(conf, ctx, params)
+    local headers = params.headers or {}
+    -- setting authorization headers if not already set
+    if not headers["Authorization"] and conf.authorization

Review Comment:
   Does the header here need to be lower-case? And we need a test case that the user-specific Authorization header has higher priority.



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

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

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


[GitHub] [apisix] jackkkkklee commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
jackkkkklee commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r944180771


##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,36 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+local plugin_name, plugin_version, priority = "openfunction", 0.1, -1902
+
+local openfunction_authz_schema = {
+    service_token = {type = "string"}
+}
+
+local function request_processor(conf, ctx, params)
+    local headers = params.headers or {}
+    -- setting authorization headers if not already set
+    if not headers["Authorization"] and conf.authorization

Review Comment:
   Thanks for the reminding.
    Lower-case for headers is needed if you mean the local param 'headers', or you mean the header of docs above?
   
   Test case added.



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

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

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


[GitHub] [apisix] spacewander merged pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
spacewander merged PR #7634:
URL: https://github.com/apache/apisix/pull/7634


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

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

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r945396522


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,13 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+
+# prepare openfunction env
+docker pull apisixtestaccount123/sample-go-func:v1

Review Comment:
   can we expose the Dockerfile for `apisixtestaccount123/sample-go-func:v1`?
    My concern is that when we want to make updates based on this image later, then it will be difficult for us to do so. 



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

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

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


[GitHub] [apisix] tzssangglass commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1215099723

   > Could you please re-run "CI / build (ubuntu-18.04, linux_openresty_1_19, t/plugin) (pull_request) " ?
   > Timeout happened during building function.
   
   accord to: https://github.com/apache/apisix/runs/7833789308?check_suite_focus=true, maybe some error in test cases?


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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r946266422


##########
apisix/plugins/openfunction.lua:
##########
@@ -0,0 +1,36 @@
+--
+-- 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_encode_base64 = ngx.encode_base64
+local plugin_name, plugin_version, priority = "openfunction", 0.1, -1902
+
+local openfunction_authz_schema = {
+    service_token = {type = "string"}
+}
+
+local function request_processor(conf, ctx, params)
+    local headers = params.headers or {}
+    -- setting authorization headers if not already set
+    if not headers["authorization"] and conf.authorization

Review Comment:
   What if users configure an auth plugin with the OpenFunction plugin, and the authorization header from client is not designed for the FaaS. In such a case, the authentication will fail.



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

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

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


[GitHub] [apisix] tzssangglass commented on pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #7634:
URL: https://github.com/apache/apisix/pull/7634#issuecomment-1218960901

   > @tzssangglass Could you please re-run "CI Centos7 / run ci on centos7 (t/admin t/cli t/config-center-yaml t/control t/core t/debug t/deploym" which has no contact with this pr?
   
   rerun


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

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

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


[GitHub] [apisix] tokers commented on a diff in pull request #7634: feat: add openfunction plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7634:
URL: https://github.com/apache/apisix/pull/7634#discussion_r952057876


##########
ci/init-plugin-test-service.sh:
##########
@@ -41,3 +41,4 @@ docker exec -i rmqnamesrv /home/rocketmq/rocketmq-4.6.0/bin/mqadmin updateTopic
 
 # prepare vault kv engine
 docker exec -i vault sh -c "VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault secrets enable -path=kv -version=1 kv"
+

Review Comment:
   Discard this change.



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,181 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be sent to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+
+### Install OpenFunction via Helm Chart
+
+The example below shows OpenFunction installed in Helm:
+
+```shell
+# add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+You can then verify if OpenFunction is ready:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### Create and Push a Function
+
+You can then create a function follow the [sample](https://github.com/OpenFunction/samples)
+
+When building a function, you’ll need to push your function container image to a container registry like Docker Hub or Quay.io. To do that you’ll need to generate a secret for your container registry first.

Review Comment:
   "`suggestion
   You'll need to push your function container image to a container registry like Docker Hub or Quay.io when building a function. To do that, you'll need to generate a secret for your container registry first.
   ```



##########
docs/en/latest/plugins/openfunction.md:
##########
@@ -0,0 +1,181 @@
+---
+title: openfunction
+keywords:
+  - APISIX
+  - Plugin
+  - OpenFunction
+  - openfunction
+description: This document contains information about the CNCF OpenFunction Plugin.
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+## Description
+
+The `openfunction` Plugin is used to integrate APISIX with [CNCF OpenFunction](https://openfunction.dev/) serverless platform.
+
+This Plugin can be configured on a Route and requests will be sent to the configured OpenFunction API endpoint as the upstream.
+
+## Attributes
+
+| Name                        | Type    | Required | Default | Valid values | Description                                                                                                |
+| --------------------------- | ------- | -------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
+| function_uri                | string  | True     |         |              | function uri. For example, `https://localhost:30858/default/function-sample`.                              |
+| ssl_verify                  | boolean | False    | true    |              | When set to `true` verifies the SSL certificate.                                                           |
+| authorization               | object  | False    |         |              | Authorization credentials to access functions of OpenFunction.                                      |
+| authorization.service_token | string  | False    |         |              | The token format is 'xx:xx' which support basic auth for function entry points.                                      |
+| timeout                     | integer | False    | 3000ms  | [100, ...]ms | OpenFunction action and HTTP call timeout in ms.                                                              |
+| keepalive                   | boolean | False    | true    |              | When set to `true` keeps the connection alive for reuse.                                                   |
+| keepalive_timeout           | integer | False    | 60000ms | [1000,...]ms | Time is ms for connection to remain idle without closing.                                                  |
+| keepalive_pool              | integer | False    | 5       | [1,...]      | Maximum number of requests that can be sent on this connection before closing it.                          |
+
+:::note
+
+The `timeout` attribute sets the time taken by the OpenFunction to execute, and the timeout for the HTTP client in APISIX. OpenFunction calls may take time to pull the runtime image and start the container. So, if the value is set too small, it may cause a large number of requests to fail.
+
+:::
+
+## Prerequisites
+
+Before configuring the plugin, you need to have OpenFunction running.
+Installation of OpenFunction requires a certain version Kubernetes cluster.
+For details, please refer to [Installation](https://openfunction.dev/docs/getting-started/installation/).
+
+### Install OpenFunction via Helm Chart
+
+The example below shows OpenFunction installed in Helm:
+
+```shell
+# add the OpenFunction chart repository
+helm repo add openfunction https://openfunction.github.io/charts/
+helm repo update
+
+#install the OpenFunction chart
+kubectl create namespace openfunction
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+You can then verify if OpenFunction is ready:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### Create and Push a Function
+
+You can then create a function follow the [sample](https://github.com/OpenFunction/samples)
+
+When building a function, you’ll need to push your function container image to a container registry like Docker Hub or Quay.io. To do that you’ll need to generate a secret for your container registry first.
+
+```shell
+REGISTRY_SERVER=https://index.docker.io/v1/ REGISTRY_USER=<your_registry_user> REGISTRY_PASSWORD=<your_registry_password>
+kubectl create secret docker-registry push-secret \
+    --docker-server=$REGISTRY_SERVER \
+    --docker-username=$REGISTRY_USER \
+    --docker-password=$REGISTRY_PASSWORD
+```
+
+## Enable the Plugin
+
+You can now configure the Plugin on a specific Route and point to this running OpenFunction service:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "plugins": {
+        "openfunction": {
+            "function_uri": "http://localhost:3233/default/function-sample/test",
+            "authorization": {
+                "service_token": "test:test"
+            }
+        }
+    }
+}'
+```
+
+## Example usage
+
+Once you have configured the plugin, you can send a request to the Route and it will invoke the configured function:
+
+```shell
+curl -i http://127.0.0.1:9080/hello
+```
+
+This will give back the response from the function:
+
+```
+hello, test!
+```
+
+### Configuring path forwarding
+
+The `OpenFunction` Plugins also supports URL path forwarding while proxying requests to the OpenFunction API endpoints upstream. Extensions to the base request path gets appended to the `function_uri` specified in the Plugin configuration.

Review Comment:
   ```suggestion
   The `OpenFunction` Plugin also supports transforming the URL path while proxying requests to the OpenFunction API endpoints. Extensions to the base request path get appended to the `function_uri` specified in the Plugin configuration.
   ```



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

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

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