Skip to content

Failover isn't working when backend-level filter is applied #5813

Open

Description

@MaYuan-02

Failover in this doc cannot work as expected when backend-level filter is applied.
After simulating the active app failure, Envoy continues sending requests to it

In the released v1.3.0, I observed that failover depends on a "BIG"(rule-level) cluster, with weights for different backends within a rule set in the endpoints.
This implementation make add-header filter at the backend level defective.
I notice this issue has been fixed in #3246. But this disrupts failover.
When I enable backend-level filter, the rule-level cluster is absent, causing the failover to not work in this scenario.

Repro steps:

Include sample requests, environment, etc. All data and inputs
required to reproduce the bug.

Note: If there are privacy concerns, sanitize the data prior to
sharing.

Environment:

Include the environment like gateway version, envoy version and so on.

Logs:

Include the access logs and the Envoy logs.

Activity

  1. changed the title [-]Failover isn't working in the latest build[/-] [+]Failover isn't working when backend-level filter is applied[/+] on Apr 25, 2025
  2. MaYuan-02 commented on Apr 25, 2025

    @MaYuan-02
    ContributorAuthor

    The current failover requires integration with the health check feature and does not allow users to specify target services for failover, which can be somewhat confusing. Can we consider making some modifications to this feature's API?

    I have a preliminary idea:
    Failover is actually based on the endpoint's priority. Could we support referencing multiple services in the Envoy Gateway backend, allowing users to set priority and overprovisioning factors for each service?

  3. arkodg commented on Apr 25, 2025

    @arkodg
    Contributor

    thanks for flagging this
    when backend specific filters are set, internally weighted clusters is used per backendRef, and i dont think there's any way to set priority for a cluster atm
    https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-msg-config-route-v3-weightedcluster

  4. arkodg commented on Apr 25, 2025

    @arkodg
    Contributor

    cc @mathetake @yuzisun this affects Envoy AI Gateway features that may rely on backend specific filters in the future (credential injection per backend)

    one way to solve this could be to add a priority field within weighted clusters in upstream envoy proxy

  5. added
    kind/bug
    and removed on Apr 25, 2025
  6. MaYuan-02 commented on Apr 27, 2025

    @MaYuan-02
    ContributorAuthor

    I'm considering whether we could allow users to set a failover target, not just the other backend within the same rule. By doing this, we could merge the failover cluster endpoints with the normal endpoints into a single large cluster, setting the failover endpoints to a lower priority.

    We could implement this using HTTPRouteFilter or BackendTrafficPolicy.

    apiVersion: gateway.networking.k8s.io/v1
    kind: HTTPRoute
    metadata:
      name: route
    spec:
      parentRefs:
        - name: example-gateway
      hostnames:
        - "example.com"
      rules:
        - matches:
            - path:
                type: PathPrefix
                value: /
          backendRefs:
          - name: svc-1
            port: 8000
            weight: 1
            filters:
            - type: ExtensionRef
              extensionRef:
                group: xxx
                kind: HTTPRouteFilter
                name: test-failover
    ---
    apiVersion: gateway.envoyproxy.io/v1alpha1
    kind: HTTPRouteFilter
    metadata:
      name: fail-over
    spec:
      failover: 
        bakcendRef:
          xx: xx
        overprovisioning: x
    
  7. arkodg commented on Apr 28, 2025

    @arkodg
    Contributor

    I like the idea @MaYuan-02, modifying it a bit, fallback or priority can be defined per Endpoint in

    Endpoints []BackendEndpoint `json:"endpoints,omitempty"`

  8. MaYuan-02 commented on Apr 29, 2025

    @MaYuan-02
    ContributorAuthor

    @arkodg Thanks for your reply. I will draft a detailed implementation plan and begin work on it shortly.

  9. github-actions commented on May 29, 2025

    @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

No one assigned

    Labels

    kind/bugstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions