istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/config/analysis/analyzers/testdata/absolute-envoy-filter-operation.yaml (about) 1 # If the patch operation is INSERT_FIRST or priority is set, then the analyzer will not do anything 2 apiVersion: networking.istio.io/v1alpha3 3 kind: EnvoyFilter 4 metadata: 5 name: test-reviews-lua-1 6 namespace: bookinfo 7 spec: 8 workloadSelector: 9 labels: 10 app: reviews 11 configPatches: 12 # The first patch adds the lua filter to the listener/http connection manager 13 - applyTo: HTTP_FILTER 14 match: 15 context: SIDECAR_INBOUND 16 listener: 17 portNumber: 8080 18 filterChain: 19 filter: 20 name: "envoy.filters.network.http_connection_manager" 21 subFilter: 22 name: "envoy.filters.http.router" 23 patch: 24 operation: INSERT_FIRST 25 value: # lua filter specification 26 name: envoy.lua 27 typed_config: 28 "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua" 29 inlineCode: | 30 function envoy_on_request(request_handle) 31 -- Make an HTTP call to an upstream host with the following headers, body, and timeout. 32 local headers, body = request_handle:httpCall( 33 "lua_cluster", 34 { 35 [":method"] = "POST", 36 [":path"] = "/acl", 37 [":authority"] = "internal.org.net" 38 }, 39 "authorize call", 40 5000) 41 end 42 # The second patch adds the cluster that is referenced by the lua code 43 # cds match is omitted as a new cluster is being added 44 - applyTo: CLUSTER 45 match: 46 context: SIDECAR_OUTBOUND 47 patch: 48 operation: ADD 49 value: # cluster specification 50 name: "lua_cluster" 51 type: STRICT_DNS 52 connect_timeout: 0.5s 53 lb_policy: ROUND_ROBIN 54 load_assignment: 55 cluster_name: lua_cluster 56 endpoints: 57 - lb_endpoints: 58 - endpoint: 59 address: 60 socket_address: 61 protocol: TCP 62 address: "internal.org.net" 63 port_value: 8888 64 65 --- 66 apiVersion: networking.istio.io/v1alpha3 67 kind: EnvoyFilter 68 metadata: 69 name: test-reviews-lua-2 70 namespace: bookinfo 71 spec: 72 workloadSelector: 73 labels: 74 app: reviews 75 priority: 10 76 configPatches: 77 # The first patch adds the lua filter to the listener/http connection manager 78 - applyTo: HTTP_FILTER 79 match: 80 context: SIDECAR_INBOUND 81 listener: 82 portNumber: 8080 83 filterChain: 84 filter: 85 name: "envoy.filters.network.http_connection_manager" 86 subFilter: 87 name: "envoy.filters.http.router" 88 patch: 89 operation: INSERT_BEFORE 90 value: # lua filter specification 91 name: envoy.lua 92 typed_config: 93 "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua" 94 inlineCode: | 95 function envoy_on_request(request_handle) 96 -- Make an HTTP call to an upstream host with the following headers, body, and timeout. 97 local headers, body = request_handle:httpCall( 98 "lua_cluster", 99 { 100 [":method"] = "POST", 101 [":path"] = "/acl", 102 [":authority"] = "internal.org.net" 103 }, 104 "authorize call", 105 5000) 106 end 107 # The second patch adds the cluster that is referenced by the lua code 108 # cds match is omitted as a new cluster is being added 109 - applyTo: CLUSTER 110 match: 111 context: SIDECAR_OUTBOUND 112 patch: 113 operation: ADD 114 value: # cluster specification 115 name: "lua_cluster" 116 type: STRICT_DNS 117 connect_timeout: 0.5s 118 lb_policy: ROUND_ROBIN 119 load_assignment: 120 cluster_name: lua_cluster 121 endpoints: 122 - lb_endpoints: 123 - endpoint: 124 address: 125 socket_address: 126 protocol: TCP 127 address: "internal.org.net" 128 port_value: 8888 129 --- 130 131