envoyproxy / envoyproxy/gateway
Reordering HTTPRoute rules causes brief 503 errors to clients
- Dominant language
- Go
- Stars
- 3k
- Forks
- 864
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 140
Description
*Description*:
I believe this is similar to (or the same as) #6287, but I'm opening a new issue since we hit this problem in an actual production use case.
For readability, we had been defining the **last** rule in `HTTPRoute.spec.rules` as a catch-all default rule (`path: { type: PathPrefix, value: / }`), and placing newly added rules above it in whatever order was easiest to read.
However, with Envoy, whenever the **index of a rule changes**, clients receive `503` responses for several seconds.
*Repro steps*:
Switching back and forth between the two manifests below triggers `503` errors **every time**. The only meaningful difference is that the `/` PathPrefix rule moves from index `0` (Example A) to index `1` (Example B).
**Example A:**
```yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: site
spec:
parentRefs:
- name: eg
hostnames: ["example.com"]
rules:
- matches:
- { path: { type: PathPrefix, value: / } }
backendRefs:
- { name: frontend, port: 80 }
```
**Example B:**
```yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: site
spec:
parentRefs:
- name: eg
hostnames: ["example.com"]
rules:
- matches:
- { path: { type: PathPrefix, value: /api/ } }
backendRefs:
- { name: backend, port: 80 }
- matches:
- { path: { type: PathPrefix, value: / } }
backendRefs:
- { name: frontend, port: 80 }
```
Applying A, then B, then A (etc.) produces a short window of `503` responses on each transition.
*Environment*:
Envoy Gateway version: `1.8.0`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.