api7 / api7/api7-ingress-controller
bug: return 500 for HTTPRoute rules without backendRefs
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 5
- Forks
- 5
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 10
Description
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
RequestRedirectfilter without a backend must keep returning its redirect response. - API7 response-producing
ExtensionRefplugins must not be overwritten by an unconditionalfault-injectionfallback.
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
-
Install API7 Ingress Controller 2.2.0 with Gateway API 1.6 CRDs and configure a working Gateway.
-
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: [] -
Request
/omittedand/emptythrough the Gateway. -
Observe that the rules do not explicitly return the required
500response.
The upstream Gateway API fixture and assertions are in HTTPRouteNoBackendRefs.
Acceptance Criteria
- Omitted or empty
backendRefswith no response-producing filter returns500. RequestRedirectwithout a backend continues to work.- A response-producing API7
ExtensionRefplugin without a backend continues to work. - Translator regression tests cover all three cases.
HTTPRouteNoBackendRefsis 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
- #429
- #431
- #467
- apache/apisix-ingress-controller#2804
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the HTTPRoute translator, the HTTPRouteNoBackendRefs conformance fixture and assertions, and the known-gap skip list. Review how backend resolution and response-producing RequestRedirect or ExtensionRef filters are handled, then add translator regression coverage for omitted and empty backendRefs and run the applicable conformance modes. Done means all three response cases pass and the known gap is no longer skipped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- api, backend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100