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/09/19 03:23:45 UTC

[GitHub] [apisix-website] tokers commented on a diff in pull request #1325: docs: add APISIX integrate OpenFunction blog

tokers commented on code in PR #1325:
URL: https://github.com/apache/apisix-website/pull/1325#discussion_r973838952


##########
blog/zh/blog/2022/09/20/apisix-integrate-cncf-openfunction.md:
##########
@@ -0,0 +1,209 @@
+---
+title: "API 网关 Apache APISIX 集成 CNCF OpenFunction"
+authors:
+  - name: 李从旺
+    title: Author
+    url: https://github.com/jackkkkklee
+    image_url: https://github.com/jackkkkklee.png
+keywords: 
+- API 网关
+- Apache APISIX
+- CNCF
+- OpenFunction
+- Serverless
+description: 本文为大家介绍了 Apache APISIX `openfunction` 插件的功能与使用步骤,为 APISIX 的无服务领域功能再添一员。
+tags: [Plugins,Ecosystem]
+---
+
+> 本文作者李从旺,开源爱好者与云原生技术爱好者,目前于佐治亚理工学院深圳校区进修硕士学位。本篇文章是在参与 APISIX 开源之夏项目「集成 OpenFunction 至 Apache APISIX」的功能呈现,希望此功能可以让你在使用 APISIX 进行扩展事时更加便捷。
+
+<!--truncate-->
+
+在无服务时代,API 网关依旧是管理和充分利用无服务器平台的关键。因此,Apache APISIX 社区也紧跟趋势,在过去的一年多时间内集成了无服务器提供商,如 [AWS Lambda](https://aws.amazon.com/lambda/) 和 [Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview),以及开源的无服务平台 [Apache OpenWhisk](https://openwhisk.apache.org/) 等。
+
+本月,APISIX 又新增了不少生态插件,其中就包括与 [OpenFunction](https://openfunction.dev/) 集成的无服务插件 `openfunction`。本文将介绍 Apache APISIX 新的无服务插件 `openfunction`,并带来更多集成细节。
+
+## Apache APISIX
+
+[Apache APISIX](https://apisix.apache.org/) 是一个动态、实时、高性能的 API 网关,提供负载均衡、动态上游、灰度发布、服务熔断、身份认证、可观测性等丰富的流量管理功能。Apache APISIX 不仅支持插件动态变更和热插拔,而且拥有众多实用的插件。
+
+## OpenFunction
+
+OpenFunction 是一个云原生的开源 FaaS 平台,旨在让用户专注于自己的业务逻辑,而不必维护底层运行时环境和基础设施。
+
+核心功能包括:
+
+- 与云提供商的 BaaS 解耦
+- 可插入的架构,允许多个函数运行时
+- 同时支持同步和异步函数
+- 独特的异步函数支持,可以直接使用来自事件源的事件
+- 支持直接从函数源代码生成兼容 OCI 的容器镜像。
+- 灵活的从 0 到 n 的自动缩放
+- 支持基于事件源的特定指标的高级异步功能自动缩放
+- 通过引入 [Dapr](https://dapr.io/) 简化同步和异步功能的 BaaS 集成
+- [K8s Gateway API](https://gateway-api.sigs.k8s.io/) 提供的高级函数入口和流量管理(进行中)
+- 灵活易用的事件管理框架
+
+## 集成原理
+
+该插件会将正在进行的请求转发到用户定义的特定 URI,并提供相关的授权细节、请求头、请求正文和查询字符串,然后将响应返回给原始的客户端。
+
+无服务具有高度可扩展和成本低等优势,使用这种方式部署业务服务能够极大降低资源使用和投入成本。如果你正在使用 OpenFunction 作为无服务平台,你就可以使用 Apache APISIX 去代理这些函数的请求,为函数请求追加服务治理的能力。
+
+正如前文提到的 OpenFunction 核心功能,[K8s Gateway API](https://gateway-api.sigs.k8s.io/)  提供了函数的入口。OpenFunction 的认证方式取决于 K8s 网关,且随网关的选择而变化。因此这个插件只支持标准的 Basic Auth 认证方式。
+
+## 如何使用插件
+
+### 步骤一:安装与运行 APISIX
+
+在这里,我们推荐使用 Docker 快速安装 APISIX,因此你需要预先安装 [Docker](https://www.docker.com/) 和 [Docker Compose](https://docs.docker.com/compose/)。
+
+安装详情以及更多安装方式请参考[APISIX 安装指南](https://apisix.apache.org/zh/docs/apisix/installation-guide/)。
+
+首先下载 [apisix-docker](https://github.com/apache/apisix-docker) 仓库。
+
+```shell
+git clone https://github.com/apache/apisix-docker.git
+
+cd apisix-docker/example
+```
+
+然后使用 `docker-compose` 启用 APISIX。
+
+对于 **x86** 系统,可以参考:
+
+```shell
+
+docker-compose -p docker-apisix up -d
+
+```
+
+对于 **ARM/M1** 系统,可以参考:
+
+```
+
+docker-compose -p docker-apisix -f docker-compose-arm64.yml up -d
+
+```
+
+后续的使用步骤请参考 [快速入门指南](https://apisix.apache.org/zh/docs/apisix/getting-started/)。
+
+### 步骤二: 通过 Helm Chart 安装 OpenFunction
+
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。详情可参考 [OpenFunction 安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+
+```shell
+# 添加 OpenFunction 到 Chart 存储库
+
+helm repo add openfunction https://openfunction.github.io/charts/
+
+helm repo update
+```
+
+```shell
+# 安装 OpenFunction chart
+
+kubectl create namespace openfunction
+
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 OpenFunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 步骤三:创建并推送函数
+
+你可以参考 [OpenFunction 官方示例](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
+```
+
+### 步骤四:启用插件
+
+你可以通过以下命令在指定路由中启用该插件:
+
+```shell
+curl http://127.0.0.1:9180/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+
+{
+

Review Comment:
   Remove empty lines to make the snippet more compact.



##########
blog/zh/blog/2022/09/20/apisix-integrate-cncf-openfunction.md:
##########
@@ -0,0 +1,209 @@
+---
+title: "API 网关 Apache APISIX 集成 CNCF OpenFunction"
+authors:
+  - name: 李从旺
+    title: Author
+    url: https://github.com/jackkkkklee
+    image_url: https://github.com/jackkkkklee.png
+keywords: 

Review Comment:
   Add the `Kubernetes` as another keyword.



##########
blog/zh/blog/2022/09/20/apisix-integrate-cncf-openfunction.md:
##########
@@ -0,0 +1,209 @@
+---
+title: "API 网关 Apache APISIX 集成 CNCF OpenFunction"
+authors:
+  - name: 李从旺
+    title: Author
+    url: https://github.com/jackkkkklee
+    image_url: https://github.com/jackkkkklee.png
+keywords: 
+- API 网关
+- Apache APISIX
+- CNCF
+- OpenFunction
+- Serverless
+description: 本文为大家介绍了 Apache APISIX `openfunction` 插件的功能与使用步骤,为 APISIX 的无服务领域功能再添一员。
+tags: [Plugins,Ecosystem]
+---
+
+> 本文作者李从旺,开源爱好者与云原生技术爱好者,目前于佐治亚理工学院深圳校区进修硕士学位。本篇文章是在参与 APISIX 开源之夏项目「集成 OpenFunction 至 Apache APISIX」的功能呈现,希望此功能可以让你在使用 APISIX 进行扩展事时更加便捷。
+
+<!--truncate-->
+
+在无服务时代,API 网关依旧是管理和充分利用无服务器平台的关键。因此,Apache APISIX 社区也紧跟趋势,在过去的一年多时间内集成了无服务器提供商,如 [AWS Lambda](https://aws.amazon.com/lambda/) 和 [Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview),以及开源的无服务平台 [Apache OpenWhisk](https://openwhisk.apache.org/) 等。
+
+本月,APISIX 又新增了不少生态插件,其中就包括与 [OpenFunction](https://openfunction.dev/) 集成的无服务插件 `openfunction`。本文将介绍 Apache APISIX 新的无服务插件 `openfunction`,并带来更多集成细节。
+
+## Apache APISIX
+
+[Apache APISIX](https://apisix.apache.org/) 是一个动态、实时、高性能的 API 网关,提供负载均衡、动态上游、灰度发布、服务熔断、身份认证、可观测性等丰富的流量管理功能。Apache APISIX 不仅支持插件动态变更和热插拔,而且拥有众多实用的插件。
+
+## OpenFunction
+
+OpenFunction 是一个云原生的开源 FaaS 平台,旨在让用户专注于自己的业务逻辑,而不必维护底层运行时环境和基础设施。
+
+核心功能包括:
+
+- 与云提供商的 BaaS 解耦
+- 可插入的架构,允许多个函数运行时
+- 同时支持同步和异步函数
+- 独特的异步函数支持,可以直接使用来自事件源的事件
+- 支持直接从函数源代码生成兼容 OCI 的容器镜像。
+- 灵活的从 0 到 n 的自动缩放
+- 支持基于事件源的特定指标的高级异步功能自动缩放
+- 通过引入 [Dapr](https://dapr.io/) 简化同步和异步功能的 BaaS 集成
+- [K8s Gateway API](https://gateway-api.sigs.k8s.io/) 提供的高级函数入口和流量管理(进行中)
+- 灵活易用的事件管理框架
+
+## 集成原理
+
+该插件会将正在进行的请求转发到用户定义的特定 URI,并提供相关的授权细节、请求头、请求正文和查询字符串,然后将响应返回给原始的客户端。
+
+无服务具有高度可扩展和成本低等优势,使用这种方式部署业务服务能够极大降低资源使用和投入成本。如果你正在使用 OpenFunction 作为无服务平台,你就可以使用 Apache APISIX 去代理这些函数的请求,为函数请求追加服务治理的能力。
+
+正如前文提到的 OpenFunction 核心功能,[K8s Gateway API](https://gateway-api.sigs.k8s.io/)  提供了函数的入口。OpenFunction 的认证方式取决于 K8s 网关,且随网关的选择而变化。因此这个插件只支持标准的 Basic Auth 认证方式。
+
+## 如何使用插件
+
+### 步骤一:安装与运行 APISIX
+
+在这里,我们推荐使用 Docker 快速安装 APISIX,因此你需要预先安装 [Docker](https://www.docker.com/) 和 [Docker Compose](https://docs.docker.com/compose/)。
+
+安装详情以及更多安装方式请参考[APISIX 安装指南](https://apisix.apache.org/zh/docs/apisix/installation-guide/)。
+
+首先下载 [apisix-docker](https://github.com/apache/apisix-docker) 仓库。
+
+```shell
+git clone https://github.com/apache/apisix-docker.git
+
+cd apisix-docker/example
+```
+
+然后使用 `docker-compose` 启用 APISIX。
+
+对于 **x86** 系统,可以参考:
+
+```shell
+
+docker-compose -p docker-apisix up -d
+
+```
+
+对于 **ARM/M1** 系统,可以参考:
+
+```
+
+docker-compose -p docker-apisix -f docker-compose-arm64.yml up -d
+
+```
+
+后续的使用步骤请参考 [快速入门指南](https://apisix.apache.org/zh/docs/apisix/getting-started/)。
+
+### 步骤二: 通过 Helm Chart 安装 OpenFunction
+
+请确保当前环境中已经安装对应版本的 Kubernetes 集群。详情可参考 [OpenFunction 安装指南](https://openfunction.dev/docs/getting-started/installation/) 。
+
+```shell
+# 添加 OpenFunction 到 Chart 存储库
+
+helm repo add openfunction https://openfunction.github.io/charts/
+
+helm repo update
+```
+
+```shell
+# 安装 OpenFunction chart
+
+kubectl create namespace openfunction
+
+helm install openfunction openfunction/openfunction -n openfunction
+```
+
+你可以通过以下命令来验证 OpenFunction 是否已经安装成功:
+
+```shell
+kubectl get pods --namespace openfunction
+```
+
+### 步骤三:创建并推送函数
+
+你可以参考 [OpenFunction 官方示例](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 \
+

Review Comment:
   Remove the empty lines.



-- 
This is an automated message from the 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