envoyproxy / envoyproxy/gateway
Cluster Duplication for Identical backendRef across Multiple Rules in a Single HTTPRoute
- Dominant language
- Go
- Stars
- 3k
- Forks
- 864
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 140
Description
*Description*:
Currently, Envoy Gateway generates a separate cluster per rule in an HTTPRoute, even when all the rules reference the same backendRef. This results in redundant cluster configurations, and lead to:
- Increased memory usage in the Envoy proxy.
- Larger and more complex xDS configurations.
- Longer configuration propagation and reload times.
- Additional overhead when debugging or monitoring Envoy behavior.
Example HTTPRoute snippet
```
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: sample-route
spec:
rules:
- matches:
- path:
type: PathPrefix
value: /v1
backendRefs:
- name: my-backend
port: 8080
- matches:
- path:
type: PathPrefix
value: /v2
backendRefs:
- name: my-backend
port: 8080
filters:
- type: URLRewrite
urlRewrite:
path:
replacePrefixMatch: /
type: ReplacePrefixMatch
```
In this example, even though both rules reference the same backend (my-backend:8080), two separate clusters are created in the Envoy config.
Is there a specific reason this behaviour considered? Are there any existing proposals to deduplicate clusters and reuse the single cluster across multiple rules with the same backendRef?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.