istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/config/analysis/analyzers/testdata/relative-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-relative-1 6 namespace: bookinfo 7 spec: 8 workloadSelector: 9 labels: 10 app: reviews1 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_BEFORE 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-relative-2 70 namespace: bookinfo 71 spec: 72 workloadSelector: 73 labels: 74 app: reviews2 75 configPatches: 76 # The first patch adds the Lua filter to the listener/http connection manager 77 - applyTo: HTTP_FILTER 78 match: 79 context: SIDECAR_INBOUND 80 listener: 81 portNumber: 8080 82 filterChain: 83 filter: 84 name: "envoy.filters.network.http_connection_manager" 85 subFilter: 86 name: "envoy.filters.http.router" 87 patch: 88 operation: INSERT_AFTER 89 value: # Lua filter specification 90 name: envoy.lua2 91 typed_config: 92 "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua" 93 inlineCode: | 94 function envoy_on_request(request_handle) 95 -- Make an HTTP call to an upstream host with the following headers, body, and timeout. 96 local headers, body = request_handle:httpCall( 97 "lua_cluster", 98 { 99 [":method"] = "POST", 100 [":path"] = "/acl", 101 [":authority"] = "internal.org.net" 102 }, 103 "authorize call", 104 5000) 105 end 106 # The second patch adds the cluster that is referenced by the Lua code 107 # cds match is omitted as a new cluster is being added 108 - applyTo: CLUSTER 109 match: 110 context: SIDECAR_OUTBOUND 111 patch: 112 operation: ADD 113 value: # cluster specification 114 name: "lua2_cluster" 115 type: STRICT_DNS 116 connect_timeout: 0.5s 117 lb_policy: ROUND_ROBIN 118 load_assignment: 119 cluster_name: lua_cluster 120 endpoints: 121 - lb_endpoints: 122 - endpoint: 123 address: 124 socket_address: 125 protocol: TCP 126 address: "internal.org.net" 127 port_value: 8888 128 129 --- 130 apiVersion: networking.istio.io/v1alpha3 131 kind: EnvoyFilter 132 metadata: 133 name: test-relative-3 134 namespace: bookinfo 135 spec: 136 workloadSelector: 137 labels: 138 app: reviews-3 139 configPatches: 140 # The first patch adds the Lua filter to the listener/http connection manager 141 - applyTo: HTTP_FILTER 142 match: 143 context: SIDECAR_INBOUND 144 proxy: 145 proxyVersion: '^1\.11.*' 146 listener: 147 portNumber: 8080 148 filterChain: 149 filter: 150 name: "envoy.filters.network.http_connection_manager.InternalAddressConfig" 151 patch: 152 operation: INSERT_AFTER 153 value: # Lua filter specification 154 name: envoy.lua1 155 typed_config: 156 "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua" 157 inlineCode: | 158 function envoy_on_request(request_handle) 159 -- Make an HTTP call to an upstream host with the following headers, body, and timeout. 160 local headers, body = request_handle:httpCall( 161 "lua_cluster", 162 { 163 [":method"] = "POST", 164 [":path"] = "/acl", 165 [":authority"] = "internal.org.net" 166 }, 167 "authorize call", 168 5000) 169 end 170 - applyTo: CLUSTER 171 match: 172 context: SIDECAR_INBOUND 173 listener: 174 portNumber: 8080 175 filterChain: 176 filter: 177 name: "envoy.filters.network.http_connection_manager.InternalAddressConfig" 178 patch: 179 operation: INSERT_AFTER 180 value: # Lua filter specification 181 name: envoy.lua1 182 typed_config: 183 "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua" 184 inlineCode: | 185 function envoy_on_request(request_handle) 186 -- Make an HTTP call to an upstream host with the following headers, body, and timeout. 187 local headers, body = request_handle:httpCall( 188 "lua_cluster", 189 { 190 [":method"] = "POST", 191 [":path"] = "/acl", 192 [":authority"] = "internal.org.net" 193 }, 194 "authorize call", 195 5000) 196 end 197 198 199