From 0e0f5c594ba443cf1648c54ea18b36d6de9c6086 Mon Sep 17 00:00:00 2001 From: Antonette Caldwell Date: Sat, 20 Aug 2022 22:54:06 -0500 Subject: [PATCH] Fix Envoy proxy failing in tcp-metrics Description: This fixes a previous open issue https://github.com/layer5io/wasm-filters/issues/39 Updated envoy.yaml - Envoy now calls for typed_config - Rearranged placement of the filters, but it probably can be reworked to make it cleaner - Clusters is now set up with individual load assignment, no longer uses hosts --- tcp-metrics/Cargo.toml | 2 +- tcp-metrics/envoy.yaml | 96 ++++++++++++++++++++++++------------------ 2 files changed, 56 insertions(+), 42 deletions(-) diff --git a/tcp-metrics/Cargo.toml b/tcp-metrics/Cargo.toml index 6c46b66..9b8e1bb 100644 --- a/tcp-metrics/Cargo.toml +++ b/tcp-metrics/Cargo.toml @@ -10,5 +10,5 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -proxy-wasm = "0.1.0" +proxy-wasm = "0.2.0" wasm-bindgen = "0.2" diff --git a/tcp-metrics/envoy.yaml b/tcp-metrics/envoy.yaml index 4aac1f5..222082f 100644 --- a/tcp-metrics/envoy.yaml +++ b/tcp-metrics/envoy.yaml @@ -7,57 +7,71 @@ static_resources: port_value: 80 filter_chains: - filters: - - name: envoy.filters.network.wasm - config: - config: - name: "tcp_metrics" - root_id: "tcp_metrics" - vm_config: - runtime: "envoy.wasm.runtime.v8" - code: - local: - filename: "/etc/tcp_metrics.wasm" - allow_precompiled: true - - name: envoy.tcp_proxy - config: - stat_prefix: ingress_tcp - cluster: web_service + - name: envoy.filters.network.tcp_proxy + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy + stat_prefix: ingress_tcp + cluster: web_service - name: staticreply address: socket_address: address: 127.0.0.1 port_value: 8099 filter_chains: - - filters: - - name: envoy.http_connection_manager - config: - stat_prefix: ingress_http - codec_type: auto - route_config: - name: local_route - virtual_hosts: - - name: local_service - domains: - - "*" - routes: - - match: - prefix: "/" - direct_response: - status: 200 - body: - inline_string: "example body\n" - http_filters: - - name: envoy.router - config: {} + - filters: + - name: envoy.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: ingress_http + codec_type: AUTO + route_config: + name: local_route + virtual_hosts: + - name: local_service + domains: + - "*" + routes: + - match: + prefix: "/" + direct_response: + status: 200 + body: + inline_string: "example body\n" + http_filters: + - name: envoy.filters.http.wasm + typed_config: + "@type": type.googleapis.com/udpa.type.v1.TypedStruct + type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm + value: + config: + vm_config: + vm_id: "tcp_metrics" + runtime: "envoy.wasm.runtime.v8" + code: + local: + filename: "/etc/tcp_metrics.wasm" + - name: envoy.filters.http.router clusters: - name: web_service - connect_timeout: 0.25s type: STRICT_DNS lb_policy: round_robin - hosts: - - socket_address: - address: web_service - port_value: 5678 + connect_timeout: 0.25s + load_assignment: + cluster_name: web_service + endpoints: + - locality: + region: local + zone: zone-1 + load_balancing_weight: 1 + priority: 0 + lb_endpoints: + - endpoint: + address: + socket_address: + address: web_service + port_value: 5678 + hostname: web_service + admin: access_log_path: "/dev/null" address: