Description
I was trying to write an issue describing what conformance tests should look like for this, and I think.
On the HTTPBackendRef type definition we say that if the referent can't be found or is not allowed by a ReferenceGrant the BackendRef must be dropped from the Gateway.
gateway-api/apis/v1beta1/httproute_types.go
Lines 870 to 879 in 3f4b981
On the BackendRefs field we say "When a BackendRef is invalid, 500 status codes MUST be returned for requests that would have otherwise been routed to an invalid backend." "Invalid" is defined to include both of the scenarios described above.
gateway-api/apis/v1beta1/httproute_types.go
Lines 207 to 218 in 3f4b981
I think the rationale behind both of these conflicting guidelines makes sense in isolation. Maybe the following guidelines make sense:
- Don't attach a Route to a Gateway if a Route has no valid BackendRefs or include a filter with an invalid reference - this will result in a 404 unless another Route matches.
- Do attach a Route to a Gateway if only a portion of BackendRefs are invalid - this will result in a 500 for traffic that would have otherwise been routed to the invalid BackendRef.
The motivation for 2 is to avoid dropping a Route entirely if someone adds an invalid reference as part of a traffic split, ie send 10% to canary service, but that new reference to canary service is broken. I'm not sure that 2 is worthwhile, so an alternative would be to just say that Routes should not be attached if they contain any invalid references.
Note: I think this is a blocker for v0.5.0, but not v0.5.0-rc1.
I know a lot of people have been involved in this broader discussion around status codes, apologies if I miss anyone here. As always, appreciate anyone's thoughts on this.
/cc @mikemorris @nathancoleman @youngnick @howardjohn @shaneutt