From afde10b1bb567692450d10538c224b6a3c15ef7e Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 30 Aug 2022 10:50:54 +0800 Subject: [PATCH] zh: localize /reference/config/analysis/ist0151/ (#11725) Signed-off-by: windsonsea Signed-off-by: windsonsea --- .../config/analysis/ist0151/index.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 content/zh/docs/reference/config/analysis/ist0151/index.md diff --git a/content/zh/docs/reference/config/analysis/ist0151/index.md b/content/zh/docs/reference/config/analysis/ist0151/index.md new file mode 100644 index 0000000000..75e6eeb436 --- /dev/null +++ b/content/zh/docs/reference/config/analysis/ist0151/index.md @@ -0,0 +1,104 @@ +--- +title: EnvoyFilterUsesRelativeOperation +layout: analysis-message +owner: istio/wg-user-experience-maintainers +test: n/a +--- + +当 `EnvoyFilter` 没有优先级且使用相对补丁操作(`INVALID`、`MERGE`、`REMOVE`、`INSERT_BEFORE`、`INSERT_AFTER`、`REPLACE`)时, +会出现此消息。使用相对补丁操作意味着当评估当前的 `EnvoyFilter` 过滤器时该操作依赖于另一个过滤器。 +为了确保按照用户想要的顺序应用 `EnvoyFilters`,应该赋予一个优先级或者应该使用一个非相对操作(`ADD` 或 `INSERT_FIRST`)。 + +## 示例 {#example} + +以一个带有 `INSERT_BEFORE` 补丁操作的 `EnvoyFilter` 为例: + +{{< text yaml >}} +apiVersion: networking.istio.io/v1alpha3 +kind: EnvoyFilter +metadata: + name: test-relative + namespace: bookinfo +spec: + workloadSelector: + labels: + app: reviews2 + configPatches: + # 第一个补丁将 Lua 过滤器添加到 listener/http 连接管理器 + - applyTo: HTTP_FILTER + match: + context: SIDECAR_INBOUND + listener: + portNumber: 8080 + filterChain: + filter: + name: "envoy.filters.network.http_connection_manager" + subFilter: + name: "envoy.filters.http.router" + patch: + operation: INSERT_BEFORE + value: # Lua filter specification + name: envoy.lua + typed_config: + "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua" + inlineCode: | + function envoy_on_request(request_handle) + -- Make an HTTP call to an upstream host with the following headers, body, and timeout. + local headers, body = request_handle:httpCall( + "lua_cluster", + { + [":method"] = "POST", + [":path"] = "/acl", + [":authority"] = "internal.org.net" + }, + "authorize call", + 5000) + end +{{< /text >}} + +## 解决办法 {#how-to-resolve} + +由于原来使用了 `INSERT_BEFORE` 的相对操作,所以现在将其更改为 `INSERT_FIRST` 的绝对操作将解决这个问题: + +{{< text yaml >}} +apiVersion: networking.istio.io/v1alpha3 +kind: EnvoyFilter +metadata: + name: test-relative + namespace: bookinfo +spec: + workloadSelector: + labels: + app: reviews2 + configPatches: + # 第一个补丁将 Lua 过滤器添加到 listener/http 连接管理器 + - applyTo: HTTP_FILTER + match: + context: SIDECAR_INBOUND + listener: + portNumber: 8080 + filterChain: + filter: + name: "envoy.filters.network.http_connection_manager" + subFilter: + name: "envoy.filters.http.router" + patch: + operation: INSERT_BEFORE + value: # Lua 过滤器规范 + name: envoy.lua + typed_config: + "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua" + inlineCode: | + function envoy_on_request(request_handle) + -- Make an HTTP call to an upstream host with the following headers, body, and timeout. + local headers, body = request_handle:httpCall( + "lua_cluster", + { + [":method"] = "POST", + [":path"] = "/acl", + [":authority"] = "internal.org.net" + }, + "authorize call", + 5000) + end +{{< /text >}}