Skip to content

bug: return 500 for HTTPRoute rules without backendRefs #477

Description

@kayx23

Current Behavior

API7 Ingress Controller 2.2.0 and the current master branch do not generate the Gateway API 500 fallback when an HTTPRoute rule omits backendRefs or sets it to an empty list.

The HTTPRoute translator currently adds fault-injection only when backend resolution returns an error. With no backend references to resolve, backendErr remains nil and the rule does not receive the required fallback response.

The HTTPRouteNoBackendRefs Gateway API conformance test is already identified as a known gap in #467, but the behavior does not have a dedicated implementation issue. This is remaining work under the Gateway API 1.6 tracking issue #429.

Apache APISIX Ingress Controller addressed the no-backend case in apache/apisix-ingress-controller#2804. The corresponding Gateway API 1.6 port in #431 did not include that change.

Expected Behavior

An HTTPRoute rule that omits backendRefs, or sets it to an empty list, should explicitly return HTTP 500 when the rule has no filter that produces a response. This should satisfy the Gateway API 1.6 HTTPRouteNoBackendRefs conformance test.

Rules that intentionally produce a response without a backend must continue to work. In particular:

  • A RequestRedirect filter without a backend must keep returning its redirect response.
  • API7 response-producing ExtensionRef plugins must not be overwritten by an unconditional fault-injection fallback.

The upstream implementation recognizes RequestRedirect, but API7 also needs regression coverage for its response-producing ExtensionRef use case before the upstream change is adopted.

Steps to Reproduce

  1. Install API7 Ingress Controller 2.2.0 with Gateway API 1.6 CRDs and configure a working Gateway.

  2. Apply an HTTPRoute containing rules with omitted and empty backendRefs:

    apiVersion: gateway.networking.k8s.io/v1
    kind: HTTPRoute
    metadata:
      name: no-backendrefs
    spec:
      parentRefs:
        - name: gateway
      rules:
        - matches:
            - path:
                type: Exact
                value: /omitted
        - matches:
            - path:
                type: Exact
                value: /empty
          backendRefs: []
  3. Request /omitted and /empty through the Gateway.

  4. Observe that the rules do not explicitly return the required 500 response.

The upstream Gateway API fixture and assertions are in HTTPRouteNoBackendRefs.

Acceptance Criteria

  • Omitted or empty backendRefs with no response-producing filter returns 500.
  • RequestRedirect without a backend continues to work.
  • A response-producing API7 ExtensionRef plugin without a backend continues to work.
  • Translator regression tests cover all three cases.
  • HTTPRouteNoBackendRefs is removed from the known-gap skip list and passes in the applicable conformance modes.

Environment

  • API7 Ingress Controller: 2.2.0 and current master
  • Gateway API: 1.6.0

Related

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions