-
Notifications
You must be signed in to change notification settings - Fork 647
Open
Description
Description:
When defining multiple backends in backendRefs in an HTTPRoute that mix Service and Backend (CRD) kinds, the order of the backends matters. If a Service type backend is listed first and a Backend CRD is listed second, the backends fail to generate proper Envoy clusters, resulting in "no healthy upstream" errors.
I have a use case for the fixes
#7950
#7826
Environment:
- Envoy Gateway version: latest
- Kubernetes version: v1.32.9-eks-3025e55
Repro steps:
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: test-mixed-backends
spec:
parentRefs:
- name: envoy-gateway
namespace: envoy-gateway
hostnames:
- example.com
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: local-backend-svc # Service type FIRST
port: 80
weight: 1
filters:
- type: URLRewrite
urlRewrite:
hostname: "example.com"
- group: gateway.envoyproxy.io # Backend CRD SECOND
kind: Backend
name: external-backend
weight: 1
filters:
- type: URLRewrite
urlRewrite:
hostname: "external-backend.foo.bar.com"
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: Backend
metadata:
name: external-backend
spec:
endpoints:
- fqdn:
hostname: external-backend.foo.bar.com
port: 8443
tls:
sni: external-backend.foo.bar.com
wellKnownCACertificates: SystemThe order of backendRefs should not affect whether the backends are correctly translated into Envoy clusters. Both configurations should produce identical functional results.
Working config:
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: test-mixed-backends
spec:
parentRefs:
- name: envoy-gateway
namespace: envoy-gateway
hostnames:
- example.com
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- group: gateway.envoyproxy.io # Backend CRD FIRST
kind: Backend
name: external-backend
weight: 50
- name: local-backend-svc # Service type SECOND
port: 80
weight: 50Actual Behavior
- Non-working (Service first): Generates separate clusters per backend (
rule/0/backend/0,rule/0/backend/1), but the Service-based cluster lacks proper endpoint configuration, resulting in "no healthy upstream" errors. - Working (Backend first): Generates a single weighted cluster (
rule/0) with both backends as endpoints in theload_assignment.
The issue appears to be in the NeedsClusterPerSetting() function and related logic in the IR translation layer.
fsmedw
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingSomething isn't working