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

2022-08-30 Thread GitBox


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.
+---
+
+
+
+## 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| 6 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-unsubscr...@apisix.apache.org

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

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

2022-08-11 Thread GitBox


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.
+---
+
+
+
+## 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| 6ms | [1, 6]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| 6ms | [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.
+---
+
+
+
+## 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| 6ms | [1, 6]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| 6ms | [1000,...]ms | Time is ms 
for connect