Skip to content

Revisit Kubernetes Services mapping to Envoy v3.Cluster #5307

Closed

Description

@dprotaso

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).

Activity

  1. guydc commented on Feb 18, 2025

    @guydc
    Contributor

    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.

  2. arkodg commented on Feb 27, 2025

    @arkodg
    Contributor

    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

    @mathetake @cpakulski @nezdolik are they any other limitations of weighted clusters you are aware of ?

  3. muwaqar commented on Mar 17, 2025

    @muwaqar
    Contributor

    +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.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.

  4. github-actions commented on Apr 16, 2025

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had activity in the last 30 days.

  5. arkodg commented on Apr 25, 2025

    @arkodg
    Contributor

    the failover feature doesnt work for weighted clusters #5813

  6. github-actions commented on May 26, 2025

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had activity in the last 30 days.

  7. added
    kind/feature
    and removed on Nov 19, 2025
  8. added this to the Backlog milestone on Nov 19, 2025
  9. 25 remaining items

  10. muwaqar-cflt commented on Apr 22, 2026

    @muwaqar-cflt
    Contributor

    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.

  11. zhaohuabing commented on Apr 23, 2026

    @zhaohuabing
    Member

    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
  12. zhaohuabing commented on Apr 23, 2026

    @zhaohuabing
    Member

    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.

  13. muwaqar commented on Apr 23, 2026

    @muwaqar
    Contributor

    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).

  14. zirain commented on Apr 24, 2026

    @zirain
    Member

    @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.

  15. muwaqar-cflt commented on Apr 24, 2026

    @muwaqar-cflt
    Contributor

    Following the community meeting on 04/23, we've agreed to split this into two independent workstreams:

    1. 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.

    2. 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.

    cc @zirain @jukie @zhaohuabing @guydc

  16. kanurag94 commented on May 21, 2026

    @kanurag94
    Member

    @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)?

  17. muwaqar commented on May 21, 2026

    @muwaqar
    Contributor

    @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.

  18. github-actions commented on Jul 22, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had activity in the last 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions