Skip to content

Incorrect Cluster Mapping in Route Config When adding URLRewrite Filter #7019

@sekar-saravanan

Description

@sekar-saravanan

Description:
When generating an HTTPRoute with filters defined at both HTTPRoute/Rule and HTTPRoute/Rule/BackendRef levels, Envoy creates clusters at the HTTPRoute/Rule/BackendRef level but incorrectly maps the route to a non-existent HTTPRoute/Rule level cluster.

Example HTTPRoute Manifest

spec:
  rules:
  - backendRefs:
    - filters:
      - requestHeaderModifier:
          remove:
          - X-Unused
        type: RequestHeaderModifier
      group: ""
      kind: Service
      name: eg-validator-default
      port: 8080
      weight: 90
    - filters:
      - requestHeaderModifier:
          remove:
          - X-Unused
        type: RequestHeaderModifier
      group: ""
      kind: Service
      name: eg-validator-canary
      port: 8080
      weight: 10
    filters:
    - type: URLRewrite
      urlRewrite:
        path:
          replacePrefixMatch: /
          type: ReplacePrefixMatch
    matches:
    - path:
        type: PathPrefix
        value: /v1

Observed Envoy Cluster Config

Clusters created:
httproute/devops/eg-validator-internal/rule/0/backend/0
httproute/devops/eg-validator-internal/rule/0/backend/1

Route mapped to:
httproute/devops/eg-validator-internal/rule/0 (which is not exists)

Note:

Repro steps:

  • Create an HTTPRoute as shown in the example spec with filters at both BackendRef and Rule levels.
  • Apply the configuration to Envoy Gateway.
  • Inspect the generated Envoy cluster and route configuration.
  • Notice that the route points to a cluster name which is not exists.

Environment:
Kubernetes Version: 1.31
Envoy Gateway Version: 1.5.0
Gateway API Version: 1.3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions