You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Revisit Kubernetes Services mapping to Envoy v3.Cluster #5307
Description:
I was surprised to see that Kubernetes services weren't mapped to envoy v3.Clusters. One thing I was hoping for was to create high level Gateway Policy resources that would then reconcile EnvoyPatchPolicy. I prefer not to build out an entire extension service.
I wanted my policy to target k8s services and then creating a patch could modify the v3.Cluster
Unfortunately, it seems like Gateway HTTPRoute backends maps to envoy v3.Clusters (which has it's own side effects #5230).
Reacted by Richard Ahlquist, Miguel Elias dos Santos, Suhail Abood, John, Pierre Ozoux, Karol Szwaj, joakimstrandberg, Philipp G., Igor Nikiforov and CARBONNEAUX Mathieu
In general, I agree that in some cases it could be beneficial to map Backends/Services to a single cluster. For example, users may want to apply limits such as circuit breakers on a per-proxy-per-backend basis, and not have these limits duplicated per-route-backendref. Other issues include excessive active health checking from duplication of clusters and their HC settings, inconsistent passive health check status.
agree with @guydc's points around setting per backend values. The reason to keep fields such as circuitBreaker and healthCheck in the BackendTrafficPolicy instead of a dedicated policy like BackendPolicy was to prioritize usability and reduce the number of place to author intent. We should revisit this design decision based off more user feedback
There are limitations with weighted clusters, adding the ones I can think of here
Revisiting the current design would allow us to extend custom backend policies cleanly.
The current extension hook (Translation) for v3.Cluster is very primitive, and does not provide any context to mutate a v3.Cluster xDS.
If we have a Envoy v3.Cluster-per-BackendReference, we could introduce a Cluster Modification hook to the extension server API, and pass a list of Unstructured resources (corresponding to the Policy resources EG watched for the corresponding BackendReference) as context to be able to mutate the xDS.
Thanks for the feedback @illrill@arkodg — this is a good point.
We initially designed MergeBackends=true around the Backend-level policy as the trigger for cluster sharing. But you're right that the two concerns can be decoupled — in the absence of a Backend-level policy, the Gateway-targeted BTP's CDS fields can serve as the floor for the shared cluster, so MergeBackends can still achieve deduplication without requiring Application Developers to create any additional resources.
That said, this doesn't address the Service Owner goal — being able to specify operational traits (circuit breakers, active health checks, etc.) for their service once, rather than duplicating them across every Route-targeted or Gateway-targeted BTP. At least in our (Confluent) use cases, the scenarios that need MergeBackends are almost always the ones where backend-specific policies like circuit breakers and active health checks are currently specified on a per-Route basis, because it doesn't make sense to set them as Gateway-level defaults (different services need different thresholds).
So we'd still want the Backend-level policy as the configuration mechanism for shared clusters — but I agree it doesn't need to be a prerequisite for sharing to kick in. We can update the design to reflect this separation.
Thanks @muwaqar for putting this design together and iterating on it. The write-up makes the trade-offs much clearer.
One concern I have is around the merge model described for Option 1 when MergeBackends=true.
My understanding is that once multiple Routes share a single backend cluster, a formal 3-level merge of
Gateway-BTP -> Backend-BTP -> Route-BTP
does not seem well-defined for ClusterSettings. A shared Envoy Cluster can only have one effective value for cluster-scoped fields such as:
healthCheck
circuitBreaker
loadBalancer
upstream timeout
connection / DNS / HTTP2 settings
So if two Routes reference the same backend but specify different route-targeted ClusterSettings, it is not obvious how both can be merged onto the same shared cluster in a predictable way.
Because of that, I wonder if for MergeBackends=true the safer model would be:
allow ClusterSettings only on backend-targeted BTPs (Service / ServiceImport / Backend)
reject shared-cluster-affecting ClusterSettings on route- or gateway-targeted BTPs
continue to allow only route-scoped behavior on route-targeted BTPs
If so, Option 1 may still work, but the merge model would be more of a split ownership model than a true 3-level merge for all fields:
shared CDS/backend-cluster settings are owned by backend-targeted policy
route/RDS settings are owned by route-targeted policy
Backward compatibility is preserved via an explicit opt-in flag (MergeBackends). Existing BackendTrafficPolicy (BTP) resources attached to Routes continue to be honored; when a Route's BTP carries CDS fields, a dedicated cluster is generated for that Route (current behavior).
This fallback feels a bit implicit, and may be confusing when MergeBackends=true. Personally, I would prefer to reject route-targeted BTP CDS fields in that mode, rather than silently de-merge back to a dedicated per-route cluster. That seems easier to reason about and gives a clearer ownership boundary for shared cluster config.
My understanding is that once multiple Routes share a single backend cluster, a formal 3-level merge ... does not seem well-defined for ClusterSettings
the proposal is that if a Route-targeted-BTP exists with CDS fields populated, that is an opt-out from shared cluster, and a dedicated upstream cluster similar to how it is done today will be created for that route. (5.2)
similarly any features (ref) that does not work well with shared clusters would render the existing behavior (5.4).
shared clusters are for only when MergeBackends=true AND the above do not hold.
This fallback feels a bit implicit
There may be users already using BTP who may want the performance benefits where applicable without breaking the features they are relying on (linked above). Hence, the proposed best-effort behavior of MergeBackends=true (5.4). It could be made Strict as well (or expose it as a knob thru config).
Following the community meeting on 04/23, we've agreed to split this into two independent workstreams:
Backend-level policy for BTP (Backend-level policy for CDS configuration #8844)
Extend BackendTrafficPolicy to support Backend targets (Service, ServiceImport), so Service Owners can specify CDS settings (health checks, circuit breakers, etc.) once per service instead of duplicating across every Route-targeted BTP. This is a configuration simplification only — no change to CDS topology. This will be introduced behind an opt-in flag in EnvoyGateway.spec.extensionApis.
Cluster (CDS) deduplication
Introduce an opt-in flag on EnvoyProxy.spec to change CDS topology from 1:1 to N:1 — routes to the same backend share a single cluster. This builds on Backend-level policy for CDS configuration #8844 but doesn't require it; the Gateway-targeted BTP can serve as the floor for shared cluster config in its absence.
We're tackling #8844 first. A design doc is attached to that issue for review.
The design doc for the cluster deduplication aspect only relevant to this ticket can be found here.
@muwaqar Thank you for picking this up. Do you have any plans to pick 2nd soon? This is much needed for us. If needed, I can also try contributing as per your design doc (lgtm)?
@kanurag94 Yes the work items will be done in order, I am currently hoping to do both. unfortunately did not get much traction from reviewers as they were wrapping up 1.8 release, hopefully will get reviews/approvals when 1.8 is wrapped up and 1.9 release process begins.
Activity
guydc commentedon Feb 18, 2025
In general, I agree that in some cases it could be beneficial to map Backends/Services to a single cluster. For example, users may want to apply limits such as circuit breakers on a per-proxy-per-backend basis, and not have these limits duplicated per-route-backendref. Other issues include excessive active health checking from duplication of clusters and their HC settings, inconsistent passive health check status.
arkodg commentedon Feb 27, 2025
agree with @guydc's points around setting per backend values. The reason to keep fields such as
circuitBreakerandhealthCheckin the BackendTrafficPolicy instead of a dedicated policy like BackendPolicy was to prioritize usability and reduce the number of place to author intent. We should revisit this design decision based off more user feedbackThere are limitations with weighted clusters, adding the ones I can think of here
@mathetake @cpakulski @nezdolik are they any other limitations of weighted clusters you are aware of ?
muwaqar commentedon Mar 17, 2025
+1
Gateway API spec recently seems to be introducing policies on a per-
BackendReference(Service,ServiceImport,Backend) basis as well.For example:
gateway.networking.k8s.io/v1alpha3:BackendTLSPolicy(reference)gateway.networking.k8s.io/v1alpha2:BackendLBPolicy(reference)Revisiting the current design would allow us to extend custom backend policies cleanly.
The current extension hook (Translation) for
v3.Clusteris very primitive, and does not provide any context to mutate av3.ClusterxDS.If we have a Envoy
v3.Cluster-per-BackendReference, we could introduce aClusterModification hook to the extension server API, and pass a list ofUnstructuredresources (corresponding to the Policy resources EG watched for the correspondingBackendReference) as context to be able to mutate the xDS.github-actions commentedon Apr 16, 2025
This issue has been automatically marked as stale because it has not had activity in the last 30 days.
arkodg commentedon Apr 25, 2025
the failover feature doesnt work for weighted clusters #5813
github-actions commentedon May 26, 2025
This issue has been automatically marked as stale because it has not had activity in the last 30 days.
25 remaining items
muwaqar-cflt commentedon Apr 22, 2026
Thanks for the feedback @illrill @arkodg — this is a good point.
We initially designed MergeBackends=true around the Backend-level policy as the trigger for cluster sharing. But you're right that the two concerns can be decoupled — in the absence of a Backend-level policy, the Gateway-targeted BTP's CDS fields can serve as the floor for the shared cluster, so MergeBackends can still achieve deduplication without requiring Application Developers to create any additional resources.
That said, this doesn't address the Service Owner goal — being able to specify operational traits (circuit breakers, active health checks, etc.) for their service once, rather than duplicating them across every Route-targeted or Gateway-targeted BTP. At least in our (Confluent) use cases, the scenarios that need MergeBackends are almost always the ones where backend-specific policies like circuit breakers and active health checks are currently specified on a per-Route basis, because it doesn't make sense to set them as Gateway-level defaults (different services need different thresholds).
So we'd still want the Backend-level policy as the configuration mechanism for shared clusters — but I agree it doesn't need to be a prerequisite for sharing to kick in. We can update the design to reflect this separation.
zhaohuabing commentedon Apr 23, 2026
Thanks @muwaqar for putting this design together and iterating on it. The write-up makes the trade-offs much clearer.
One concern I have is around the merge model described for Option 1 when
MergeBackends=true.My understanding is that once multiple Routes share a single backend cluster, a formal 3-level merge of
Gateway-BTP -> Backend-BTP -> Route-BTPdoes not seem well-defined for
ClusterSettings. A shared EnvoyClustercan only have one effective value for cluster-scoped fields such as:healthCheckcircuitBreakerloadBalancertimeoutSo if two Routes reference the same backend but specify different route-targeted
ClusterSettings, it is not obvious how both can be merged onto the same shared cluster in a predictable way.Because of that, I wonder if for
MergeBackends=truethe safer model would be:ClusterSettingsonly on backend-targeted BTPs (Service/ServiceImport/Backend)ClusterSettingson route- or gateway-targeted BTPsIf so, Option 1 may still work, but the merge model would be more of a split ownership model than a true 3-level merge for all fields:
zhaohuabing commentedon Apr 23, 2026
This fallback feels a bit implicit, and may be confusing when
MergeBackends=true. Personally, I would prefer to reject route-targeted BTP CDS fields in that mode, rather than silently de-merge back to a dedicated per-route cluster. That seems easier to reason about and gives a clearer ownership boundary for shared cluster config.muwaqar commentedon Apr 23, 2026
the proposal is that if a Route-targeted-BTP exists with CDS fields populated, that is an opt-out from shared cluster, and a dedicated upstream cluster similar to how it is done today will be created for that route. (5.2)
similarly any features (ref) that does not work well with shared clusters would render the existing behavior (5.4).
shared clusters are for only when MergeBackends=true AND the above do not hold.
There may be users already using BTP who may want the performance benefits where applicable without breaking the features they are relying on (linked above). Hence, the proposed best-effort behavior of MergeBackends=true (5.4). It could be made Strict as well (or expose it as a knob thru config).
zirain commentedon Apr 24, 2026
@muwaqar base on today's discussion, let's go for option 1 and focus on bring this into v1.9 as an experimental feature to gather more feedback.
muwaqar-cflt commentedon Apr 24, 2026
Following the community meeting on 04/23, we've agreed to split this into two independent workstreams:
Backend-level policy for BTP (Backend-level policy for CDS configuration #8844)
Extend BackendTrafficPolicy to support Backend targets (Service, ServiceImport), so Service Owners can specify CDS settings (health checks, circuit breakers, etc.) once per service instead of duplicating across every Route-targeted BTP. This is a configuration simplification only — no change to CDS topology. This will be introduced behind an opt-in flag in
EnvoyGateway.spec.extensionApis.Cluster (CDS) deduplication
Introduce an opt-in flag on
EnvoyProxy.specto change CDS topology from 1:1 to N:1 — routes to the same backend share a single cluster. This builds on Backend-level policy for CDS configuration #8844 but doesn't require it; the Gateway-targeted BTP can serve as the floor for shared cluster config in its absence.We're tackling #8844 first. A design doc is attached to that issue for review.
The design doc for the cluster deduplication aspect only relevant to this ticket can be found here.
cc @zirain @jukie @zhaohuabing @guydc
kanurag94 commentedon May 21, 2026
@muwaqar Thank you for picking this up. Do you have any plans to pick 2nd soon? This is much needed for us. If needed, I can also try contributing as per your design doc (lgtm)?
muwaqar commentedon May 21, 2026
@kanurag94 Yes the work items will be done in order, I am currently hoping to do both. unfortunately did not get much traction from reviewers as they were wrapping up 1.8 release, hopefully will get reviews/approvals when 1.8 is wrapped up and 1.9 release process begins.
github-actions commentedon Jul 22, 2026
This issue has been automatically marked as stale because it has not had activity in the last 30 days.