From b95972a5db5889c307b52fd6a1855811dbe21529 Mon Sep 17 00:00:00 2001 From: SylviaBABY Date: Wed, 26 Jan 2022 09:39:13 +0800 Subject: [PATCH 1/2] docs: add APISIX 2.12.0 Release Blog --- .../2022/01/25/release-apache-apisix-2.12.md | 205 ++++++++++++++++++ .../2022/01/25/release-apache-apisix-2.12.md | 205 ++++++++++++++++++ 2 files changed, 410 insertions(+) create mode 100644 website/blog/2022/01/25/release-apache-apisix-2.12.md create mode 100644 website/i18n/zh/docusaurus-plugin-content-blog/2022/01/25/release-apache-apisix-2.12.md diff --git a/website/blog/2022/01/25/release-apache-apisix-2.12.md b/website/blog/2022/01/25/release-apache-apisix-2.12.md new file mode 100644 index 0000000000000..d5ca5ac9c6112 --- /dev/null +++ b/website/blog/2022/01/25/release-apache-apisix-2.12.md @@ -0,0 +1,205 @@ +--- +title: "Apache APISIX 2.12.0 is Released, More Features Coming!" +authors: + - name: "Zexuan Luo" + title: "Author" + url: "https://github.com/spacewander" + image_url: "https://avatars.githubusercontent.com/u/4161644?v=4" + - name: "Sylvia" + title: "Technical Writer" + url: "https://github.com/SylviaBABY" + image_url: "https://avatars.githubusercontent.com/u/39793568?v=4" +keywords: +- Apache APISIX +- 2.12.0 +- Release +- Serverless +- Plugin +description: Following the release of version 2.11.0, Apache APISIX will also bring you the first version with new features in 2022 during the upcoming Spring Festival. +tags: [Release,Technology,Ecosystem] +--- + +> Following the release of version 2.11.0, Apache APISIX will also bring you the first version with new features in 2022 during the upcoming Spring Festival. + + + +## New Feature: More Serverless Integrations + +Remember that in the last release, Apache APISIX added support for Azure Function. This new version is also full of intention, adding support for more Serverless vendors in the feature set. + +Users can now also combine AWS Lambda and Apache OpenWhisk in Apache APISIX to expose specific functions on the gateway. + +## New features: More Forensic Plugins + +This new release also brings two new plugins that we've been waiting for: `forward-auth` and `opa`. + +- The `forward-auth` plugin is similar to Traefik's plugin of the same name, which allows sending the information of the current request to an external service for authentication. +- The `opa` plugin integrates with the well-known Open Policy Agent, which can perform complex authentication functions via OPA. + +These two plugins will add to the forensic functionality of Apache APISIX, giving users richer and easier forensic operations. + +## New features: More Logging Features + +In addition to the forensic plugins mentioned above, this new release will also bring three new logging plugins: `google-cloud-logging`, `splunk-hec-logging` and `rocketmq-logger`. + +In the future, Apache APISIX will connect to more and more logging service providers and open source brokers to make logging easier. + +### Support for logging response bodies + +The 2.12.0 release also supports logging of response bodies at the logging level. As with other Apache APISIX features, this feature can be enabled dynamically via expressions. This makes it possible to log only when a specific Content-Type and Content-Length is returned upstream, without having to worry about the problems associated with full response body collection. + +An example can be found below. + +```json +{ + "plugins": { + "kafka-logger": { + "broker_list" : { + "127.0.0.1":9092 + }, + "kafka_topic" : "test2", + "include_resp_body": true, + "include_resp_body_expr": [ + [ + "sent_http_content_length", + "<", + "4096" + ], + [ + "sent_http_content_type", + "==", + "application/json" + ], + ] + } + }, + "upstream": { + "nodes": { + "127.0.0.1:1980": 1 + }, + "type": "roundrobin" + }, + "uri": "/hello" +} +``` + +> The above configuration will log only when Content-Length < 4096 and Content-Type is "application/json". + +### Support for registering custom variables + +Another feature closely related to logging is that the new version of Apache APISIX now supports registration of custom variables. Combined with APISIX's custom logging format, it is possible to fully customize the reported log content. This means that log generation and reporting can be decoupled without modifying specific logging plugins. Here is a simple demonstration with an example. + +For example, we can register a variable a6_route_labels in our own plug-in. + +```c +local core = require "apisix.core" + +core.ctx.register_var("a6_route_labels", function(ctx) + local route = ctx.matched_route and ctx.matched_route.value + if route and route.labels then + return route.labels + end + return nil +end) +``` + +And use it in a custom log format. + +```json +{ + "log_format": { + "host": "$host", + "labels": "$a6_route_labels", + "client_ip": "$remote_addr" + } +} +``` + +Suppose our Route looks like this. + +```json +{ + "plugins": { + "http-logger": { + "uri": "http://127.0.0.1:1980/log", + "batch_max_size": 1, + "concat_method": "json" + } + }, + "upstream": { + "nodes": { + "127.0.0.1:1982": 1 + }, + "type": "roundrobin" + }, + "labels": { + "k": "v" + }, + "uri": "/hello" +} +``` + +Eventually you will receive the log as shown below. + +``` +{"client_ip":"127.0.0.1","host":"localhost","labels":{"k":"v"},"route_id":"1"} +``` + +## New: L4 Proxy Support for TLS over TCP Upstream + +With the new Upstream Scheme introduced in version 2.12.0, Apache APISIX now supports proxying to TLS over TCP. + +See below for details, just specify Scheme as TLS in the Upstream configuration. + +```json +{ + "scheme": "tls", + "nodes": { + "127.0.0.1:1995": 1 + }, + "type": "roundrobin" +} +``` + +The TCP proxy feature of Apache APISIX is now fully supported by TLS. In addition, we also support configuring the Access Log of the L4 proxy in a static file. + +``` +stream: + enable_access_log: false # enable access log or not, default false + access_log: logs/access_stream.log + access_log_format: "$remote_addr [$time_local] $protocol $status $bytes_sent $bytes_received $session_time" + # create your custom log format by visiting http://nginx.org/en/docs/varindex.html + access_log_format_escape: default # allows setting json or default characters escaping in variables +``` + +## Update: Multi-language plug-ins continue to improve + +### WASM ecosystem is more feature-rich + +In previous releases, Apache APISIX has opened up support for the WASM ecosystem. In version 2.12.0, a number of details have been updated for the WASM ecosystem. + +Apache APISIX now supports running WASM code at the header_filter stage, making up for the fact that existing external plugins cannot modify the response. + +In addition, we also support HTTP communication inside WASM through Apache APISIX as a host. With this feature, we have also re-implemented the forward-auth plugin with WASM. The functionality of the plugin is almost identical to the Lua version, and even the test cases pass with a name change from the Lua version. + +### Java Plugin Runner latest version released + +Of course, we haven't forgotten to update for existing external plugins, and with this 2.12.0 release, Apache APISIX now allows external plugins to fetch request bodies. + +For example, the recent release of Java Plugin Runner version 2 includes this feature. The new version of the Java Plugin Runner also supports dynamic fetching of APISIX variables at runtime. + +## More details + +In addition to the new features and components mentioned above, Apache APISIX version 2.12.0 has been updated with the following features. + +- gRPC-Web support: After gRPC proxies and HTTP to gRPC, we welcome the third member of the gRPC family. Apache APISIX now also supports the proxy gRPC Web protocol. +- `limit-count` enhancements: The `limit-count` plugin now supports sharing of counters between requests and routes, which is quite flexible. + +More details about the Apache APISIX 2.12.0 update can be found in the [Change log](https://github.com/apache/apisix/blob/release/2.12/CHANGELOG.md#2120) corresponding to this release. + +## Download + +To obtain the latest version of Apache APISIX 2.12.0, you can download it via the following path. + +- Source code: Please visit [Download page](https://apisix.apache.org/downloads/) +- Binary installation package: Please visit [Installation Guide](https://apisix.apache.org/zh/docs/apisix/how-to-build/) diff --git a/website/i18n/zh/docusaurus-plugin-content-blog/2022/01/25/release-apache-apisix-2.12.md b/website/i18n/zh/docusaurus-plugin-content-blog/2022/01/25/release-apache-apisix-2.12.md new file mode 100644 index 0000000000000..fab340d92220b --- /dev/null +++ b/website/i18n/zh/docusaurus-plugin-content-blog/2022/01/25/release-apache-apisix-2.12.md @@ -0,0 +1,205 @@ +--- +title: "Apache APISIX 2.12.0 版本发布,新功能更适配新一年!" +authors: + - name: "罗泽轩" + title: "Author" + url: "https://github.com/spacewander" + image_url: "https://avatars.githubusercontent.com/u/4161644?v=4" + - name: "苏钰" + title: "Technical Writer" + url: "https://github.com/SylviaBABY" + image_url: "https://avatars.githubusercontent.com/u/39793568?v=4" +keywords: +- Apache APISIX +- 2.12.0 +- 版本发布 +- Serverless +- 插件 +description: 继 2.11.0 版本发布之后,Apache APISIX 也在即将到来的新春佳节,为大家带来 2022 年第一个带有新功能的版本。 +tags: [Release,Technology,Ecosystem] +--- + +> 继 2.11.0 版本发布之后,Apache APISIX 也在即将到来的新春佳节,为大家带来 2022 年第一个带有新功能的版本。 + + + +## 新功能:更多的 Serverless 集成 + +还记得在上个版本里,Apache APISIX 增加了对 Azure Function 的支持。而这次新版本中也是用意满满,在功能上又加入了对更多 Serverless 厂商的支持。 + +如今用户也可以在 Apache APISIX 中结合 AWS Lambda 和 Apache OpenWhisk,在网关上进行特定函数的暴露。 + +## 新功能:更多的鉴权插件 + +此次的新版本,还将带来两个众人翘首以盼的新插件:`forward-auth` 和 `opa`。 + +- forward-auth 插件跟 Traefik 的同名插件功能类似,该插件可以允许把当前请求的信息发送给外部服务进行鉴权。 +- opa 插件则整合了著名的 Open Policy Agent,该插件可以通过 OPA 来完成复杂的鉴权功能。 + +通过上述两个插件,将为 Apache APISIX 的鉴权功能锦上添花,给用户带来更多丰富和上手简单的鉴权操作。 + +## 新功能:更多的日志功能 + +除了上边提到的鉴权插件,本次新版本还将带来三个新的日志插件:`google-cloud-logging`、`splunk-hec-logging` 以及 `rocketmq-logger`。 + +从插件名称上也很容易理解,通过上述三个插件可以把日志分别发送到 Google Cloud、Splunk 和 Apache RocketMQ。未来,Apache APISIX 将会对接越来越多的日志服务商和开源 Broker,让日志处理变得更加轻松。 + +### 支持记录响应体 + +同时,此次 2.12.0 版本还在日志层面支持记录响应体。与 Apache APISIX 其他功能一样,该功能也可以通过表达式进行动态开启。这样在使用中,就可以实现仅在上游返回特定的 Content-Type 和 Content-Length 时进行日志记录,不用再去顾虑全量采集响应体而带来的问题了。 + +具体示例可参考下方: + +```json +{ + "plugins": { + "kafka-logger": { + "broker_list" : { + "127.0.0.1":9092 + }, + "kafka_topic" : "test2", + "include_resp_body": true, + "include_resp_body_expr": [ + [ + "sent_http_content_length", + "<", + "4096" + ], + [ + "sent_http_content_type", + "==", + "application/json" + ], + ] + } + }, + "upstream": { + "nodes": { + "127.0.0.1:1980": 1 + }, + "type": "roundrobin" + }, + "uri": "/hello" +} +``` + +> 上述配置会仅在 Content-Length < 4096 且 Content-Type 为 "application/json" 才记录日志。 + +### 支持注册自定义变量 + +另一个跟日志紧密相关的功能,就是新版本的 Apache APISIX 已支持注册自定义变量。同时结合 APISIX 的自定义日志格式,就可以实现完全自定义上报的日志内容。即无需修改具体的日志插件,就能实现日志生成和上报的解耦合。这里我们通过一个示例进行简单演示一下。 + +比如我们可以在自己的插件中注册一个 a6_route_labels 的变量: + +```c +local core = require "apisix.core" + +core.ctx.register_var("a6_route_labels", function(ctx) + local route = ctx.matched_route and ctx.matched_route.value + if route and route.labels then + return route.labels + end + return nil +end) +``` + +并在自定义日志格式中使用它: + +```json +{ + "log_format": { + "host": "$host", + "labels": "$a6_route_labels", + "client_ip": "$remote_addr" + } +} +``` + +假设我们的 Route 长这样: + +```json +{ + "plugins": { + "http-logger": { + "uri": "http://127.0.0.1:1980/log", + "batch_max_size": 1, + "concat_method": "json" + } + }, + "upstream": { + "nodes": { + "127.0.0.1:1982": 1 + }, + "type": "roundrobin" + }, + "labels": { + "k": "v" + }, + "uri": "/hello" +} +``` + +最终就会收到如下所示的日志: + +``` +{"client_ip":"127.0.0.1","host":"localhost","labels":{"k":"v"},"route_id":"1"} +``` + +## 新功能:L4 代理支持 TLS over TCP 上游 + +在 2.12.0 版本中还引入了新的 Upstream Scheme,现在 Apache APISIX 已支持代理到 TLS over TCP 上游了。 + +具体做法可参考下方,只需在 Upstream 配置中指明 Scheme 为 TLS 即可。 + +```json +{ + "scheme": "tls", + "nodes": { + "127.0.0.1:1995": 1 + }, + "type": "roundrobin" +} +``` + +至此 Apache APISIX 的 TCP 代理功能得到了 TLS 全方位的支持。此外,我们还支持在静态文件中配置 L4 代理的 Access Log: + +``` +stream: + enable_access_log: false # enable access log or not, default false + access_log: logs/access_stream.log + access_log_format: "$remote_addr [$time_local] $protocol $status $bytes_sent $bytes_received $session_time" + # create your custom log format by visiting http://nginx.org/en/docs/varindex.html + access_log_format_escape: default # allows setting json or default characters escaping in variables +``` + +## 更新:多语言插件持续完善 + +### WASM 生态功能更加丰富 + +在之前版本中,Apache APISIX 已开放了对 WASM 生态的支持。而在 2.12.0 版本中,针对 WASM 生态又做了不少的更新细节。 + +目前 Apache APISIX 已经支持在 header_filter 的阶段运行 WASM 代码,弥补了现有外部插件无法修改响应的不足。 + +此外,我们还支持在 WASM 里面通过 Apache APISIX 这个宿主进行 HTTP 通讯。借助这一功能,我们用 WASM 也重新实现了 forward-auth 插件。该插件的功能几乎和 Lua 版本一模一样,甚至连测试用例也是在 Lua 版本上改了下名字就能通过了。 + +### Java Plugin Runner 最新版本发布 + +当然,我们也没有忘记针对现有的外部插件进行更新,本次 2.12.0 版本中,Apache APISIX 已允许外部插件获取请求体。 + +比如最近发布的 Java Plugin Runner 第二版就包含了这一功能。新版本的 Java Plugin Runner 还支持在运行时动态获取 APISIX 变量。 + +## 更多细节 + +除了上述新功能和组件外,Apache APISIX 2.12.0 版本还更新了如下功能: + +- gRPC-Web 的支持:继 gRPC 代理、HTTP 转 gRPC 之后,我们迎来了 gRPC 家族的第三个成员。现在 Apache APISIX 也支持代理 gRPC Web 协议了。 +- limit-count 的增强:如今 limit-count 插件的计数器已经支持在请求间、路由间进行共享,可以说是相当灵活了。 + +更多关于 Apache APISIX 2.12.0 的更新细节,可以查看本次发布对应的 [Change log](https://github.com/apache/apisix/blob/release/2.12/CHANGELOG.md#2120)。 + +## 下载 + +想要获取最新的 Apache APISIX 2.12.0 版本,可通过以下路径下载: + +- 源代码:请访问[下载页面](https://apisix.apache.org/downloads/) +- 二进制安装包:请访问[安装指南](https://apisix.apache.org/zh/docs/apisix/how-to-build/) From b26ee71df36652147720467acca823a6d307f293 Mon Sep 17 00:00:00 2001 From: SylviaBABY Date: Wed, 26 Jan 2022 11:28:50 +0800 Subject: [PATCH 2/2] update comments --- .../2022/01/25/release-apache-apisix-2.12.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/i18n/zh/docusaurus-plugin-content-blog/2022/01/25/release-apache-apisix-2.12.md b/website/i18n/zh/docusaurus-plugin-content-blog/2022/01/25/release-apache-apisix-2.12.md index fab340d92220b..3be853fe50029 100644 --- a/website/i18n/zh/docusaurus-plugin-content-blog/2022/01/25/release-apache-apisix-2.12.md +++ b/website/i18n/zh/docusaurus-plugin-content-blog/2022/01/25/release-apache-apisix-2.12.md @@ -42,7 +42,7 @@ tags: [Release,Technology,Ecosystem] 除了上边提到的鉴权插件,本次新版本还将带来三个新的日志插件:`google-cloud-logging`、`splunk-hec-logging` 以及 `rocketmq-logger`。 -从插件名称上也很容易理解,通过上述三个插件可以把日志分别发送到 Google Cloud、Splunk 和 Apache RocketMQ。未来,Apache APISIX 将会对接越来越多的日志服务商和开源 Broker,让日志处理变得更加轻松。 +从插件名称上也很容易理解,通过上述三个插件可以把日志分别发送到 Google Cloud、Splunk 和 Apache RocketMQ。未来,Apache APISIX 将会对接越来越多的日志服务商和开源 Broker,让日志处理变得更加轻松。 ### 支持记录响应体