istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pilot/pkg/config/kube/gateway/testdata/http.yaml (about) 1 apiVersion: gateway.networking.k8s.io/v1beta1 2 kind: GatewayClass 3 metadata: 4 name: istio 5 spec: 6 controllerName: istio.io/gateway-controller 7 --- 8 apiVersion: gateway.networking.k8s.io/v1beta1 9 kind: Gateway 10 metadata: 11 name: gateway 12 namespace: istio-system 13 spec: 14 addresses: 15 - value: istio-ingressgateway 16 type: Hostname 17 gatewayClassName: istio 18 listeners: 19 - name: default 20 hostname: "*.domain.example" 21 port: 80 22 protocol: HTTP 23 allowedRoutes: 24 namespaces: 25 from: All 26 --- 27 apiVersion: gateway.networking.k8s.io/v1beta1 28 kind: HTTPRoute 29 metadata: 30 name: http 31 namespace: default 32 spec: 33 parentRefs: 34 - name: gateway 35 namespace: istio-system 36 hostnames: ["first.domain.example", "another.domain.example"] 37 rules: 38 - matches: 39 - path: 40 type: PathPrefix 41 value: /get 42 headers: 43 - name: my-header 44 value: some-value 45 type: Exact 46 filters: 47 - type: RequestHeaderModifier 48 requestHeaderModifier: 49 add: 50 - name: my-added-header 51 value: added-value 52 remove: [my-removed-header] 53 - type: ResponseHeaderModifier 54 responseHeaderModifier: 55 add: 56 - name: my-added-resp-header 57 value: added-resp-value 58 remove: [my-removed-header] 59 backendRefs: 60 - name: httpbin 61 port: 80 62 --- 63 apiVersion: gateway.networking.k8s.io/v1beta1 64 kind: HTTPRoute 65 metadata: 66 name: http2 67 namespace: default 68 spec: 69 parentRefs: 70 - name: gateway 71 namespace: istio-system 72 hostnames: ["second.domain.example"] 73 rules: 74 - matches: 75 - path: 76 type: PathPrefix 77 value: /second 78 backendRefs: 79 - name: httpbin-second 80 port: 80 81 - matches: 82 - path: 83 type: PathPrefix 84 value: / 85 backendRefs: 86 - name: httpbin-wildcard 87 port: 80 88 --- 89 apiVersion: gateway.networking.k8s.io/v1beta1 90 kind: HTTPRoute 91 metadata: 92 name: redirect 93 namespace: default 94 spec: 95 parentRefs: 96 - name: gateway 97 namespace: istio-system 98 rules: 99 - filters: 100 - type: RequestRedirect 101 requestRedirect: 102 port: 8080 103 statusCode: 302 104 scheme: https 105 path: 106 type: ReplaceFullPath 107 replaceFullPath: /replace-full 108 --- 109 apiVersion: gateway.networking.k8s.io/v1beta1 110 kind: HTTPRoute 111 metadata: 112 name: redirect-prefix-replace 113 namespace: default 114 spec: 115 parentRefs: 116 - name: gateway 117 namespace: istio-system 118 hostnames: ["redirect.domain.example"] 119 rules: 120 - matches: 121 - path: 122 type: PathPrefix 123 value: /original 124 filters: 125 - type: RequestRedirect 126 requestRedirect: 127 port: 8080 128 statusCode: 302 129 scheme: https 130 path: 131 type: ReplacePrefixMatch 132 replacePrefixMatch: /replacement 133 --- 134 apiVersion: gateway.networking.k8s.io/v1beta1 135 kind: HTTPRoute 136 metadata: 137 name: rewrite 138 namespace: default 139 spec: 140 parentRefs: 141 - name: gateway 142 namespace: istio-system 143 rules: 144 - matches: 145 - path: 146 type: PathPrefix 147 value: /prefix-original 148 name: prefix-path-rewrite 149 filters: 150 - type: URLRewrite 151 urlRewrite: 152 hostname: "new.example.com" 153 path: 154 type: ReplacePrefixMatch 155 replacePrefixMatch: "/replacement" 156 backendRefs: 157 - name: httpbin 158 port: 80 159 - matches: 160 - path: 161 type: PathPrefix 162 value: /prefix-to-be-removed 163 name: prefix-to-be-removed 164 filters: 165 - type: URLRewrite 166 urlRewrite: 167 path: 168 type: ReplacePrefixMatch 169 replacePrefixMatch: "" 170 backendRefs: 171 - name: httpbin 172 port: 80 173 - matches: 174 - path: 175 type: PathPrefix 176 value: /full-original 177 name: full-path-rewrite 178 filters: 179 - type: URLRewrite 180 urlRewrite: 181 hostname: "new.example.com" 182 path: 183 type: ReplaceFullPath 184 replaceFullPath: "/replacement" 185 backendRefs: 186 - name: httpbin 187 port: 80 188 --- 189 apiVersion: gateway.networking.k8s.io/v1beta1 190 kind: HTTPRoute 191 metadata: 192 name: mirror 193 namespace: default 194 spec: 195 parentRefs: 196 - name: gateway 197 namespace: istio-system 198 rules: 199 - filters: 200 - type: RequestMirror 201 requestMirror: 202 backendRef: 203 name: httpbin-mirror 204 port: 80 205 - type: RequestMirror 206 requestMirror: 207 backendRef: 208 name: httpbin-second 209 port: 80 210 backendRefs: 211 - name: httpbin 212 port: 80 213 --- 214 apiVersion: gateway.networking.k8s.io/v1beta1 215 kind: HTTPRoute 216 metadata: 217 name: http-not-selected 218 namespace: default 219 spec: 220 parentRefs: 221 - name: gateway 222 namespace: istio-system 223 hostnames: ["should.not.select"] 224 rules: 225 - matches: 226 - path: 227 type: PathPrefix 228 value: /get 229 backendRefs: 230 - name: httpbin-bad 231 port: 80 232 --- 233 apiVersion: gateway.networking.k8s.io/v1beta1 234 kind: HTTPRoute 235 metadata: 236 name: http-timeout-request 237 namespace: default 238 spec: 239 parentRefs: 240 - name: gateway 241 namespace: istio-system 242 hostnames: ["timeout.domain.example"] 243 rules: 244 - matches: 245 - path: 246 type: PathPrefix 247 value: /get 248 backendRefs: 249 - name: httpbin 250 port: 80 251 timeouts: 252 request: 1ms 253 --- 254 apiVersion: gateway.networking.k8s.io/v1beta1 255 kind: HTTPRoute 256 metadata: 257 name: http-timeout-backend-request 258 namespace: default 259 spec: 260 parentRefs: 261 - name: gateway 262 namespace: istio-system 263 hostnames: ["timeout-backend.domain.example"] 264 rules: 265 - matches: 266 - path: 267 type: PathPrefix 268 value: /get 269 backendRefs: 270 - name: httpbin 271 port: 80 272 timeouts: 273 request: 2ms 274 backendRequest: 1ms