From cb7de00ee93c0f11ad9873a1efe2e506bf130a91 Mon Sep 17 00:00:00 2001 From: dpasiukevich Date: Tue, 14 Jun 2022 17:39:46 +0000 Subject: [PATCH] Move error status code from 404 to 500 * If there are no matching routes, a 404 should be generated * If there are matching routes but no/missing backends/endpoints to route to, a 500 (specifically) should be generated. --- apis/v1alpha2/httproute_types.go | 6 +++--- apis/v1beta1/httproute_types.go | 6 +++--- .../gateway.networking.k8s.io_httproutes.yaml | 12 ++++++------ .../gateway.networking.k8s.io_httproutes.yaml | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apis/v1alpha2/httproute_types.go b/apis/v1alpha2/httproute_types.go index f10f3ea8d6..4c9be7b87a 100644 --- a/apis/v1alpha2/httproute_types.go +++ b/apis/v1alpha2/httproute_types.go @@ -202,7 +202,7 @@ type HTTPRouteRule struct { // BackendRefs defines the backend(s) where matching requests should be // sent. // - // A 404 status code MUST be returned if there are no BackendRefs or filters + // A 500 status code MUST be returned if there are no BackendRefs or filters // specified that would result in a response being sent. // // A BackendRef is considered invalid when it refers to: @@ -212,11 +212,11 @@ type HTTPRouteRule struct { // * a resource in another namespace when the reference has not been // explicitly allowed by a ReferenceGrant (or equivalent concept). // - // When a BackendRef is invalid, 404 status codes MUST be returned for + // When a BackendRef is invalid, 500 status codes MUST be returned for // requests that would have otherwise been routed to an invalid backend. If // multiple backends are specified, and some are invalid, the proportion of // requests that would otherwise have been routed to an invalid backend - // MUST receive a 404 status code. + // MUST receive a 500 status code. // // When a BackendRef refers to a Service that has no ready endpoints, it is // recommended to return a 503 status code. diff --git a/apis/v1beta1/httproute_types.go b/apis/v1beta1/httproute_types.go index a62c91117a..36cb682026 100644 --- a/apis/v1beta1/httproute_types.go +++ b/apis/v1beta1/httproute_types.go @@ -201,7 +201,7 @@ type HTTPRouteRule struct { // BackendRefs defines the backend(s) where matching requests should be // sent. // - // A 404 status code MUST be returned if there are no BackendRefs or filters + // A 500 status code MUST be returned if there are no BackendRefs or filters // specified that would result in a response being sent. // // A BackendRef is considered invalid when it refers to: @@ -211,11 +211,11 @@ type HTTPRouteRule struct { // * a resource in another namespace when the reference has not been // explicitly allowed by a ReferenceGrant (or equivalent concept). // - // When a BackendRef is invalid, 404 status codes MUST be returned for + // When a BackendRef is invalid, 500 status codes MUST be returned for // requests that would have otherwise been routed to an invalid backend. If // multiple backends are specified, and some are invalid, the proportion of // requests that would otherwise have been routed to an invalid backend - // MUST receive a 404 status code. + // MUST receive a 500 status code. // // When a BackendRef refers to a Service that has no ready endpoints, it is // recommended to return a 503 status code. diff --git a/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml b/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml index 946412451d..e4b1acdc8a 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml @@ -218,18 +218,18 @@ spec: properties: backendRefs: description: "BackendRefs defines the backend(s) where matching - requests should be sent. \n A 404 status code MUST be returned + requests should be sent. \n A 500 status code MUST be returned if there are no BackendRefs or filters specified that would result in a response being sent. \n A BackendRef is considered invalid when it refers to: \n * an unknown or unsupported kind of resource * a resource that does not exist * a resource in another namespace when the reference has not been explicitly allowed by a ReferenceGrant (or equivalent concept). \n When - a BackendRef is invalid, 404 status codes MUST be returned + a BackendRef is invalid, 500 status codes MUST be returned for requests that would have otherwise been routed to an invalid backend. If multiple backends are specified, and some are invalid, the proportion of requests that would otherwise have - been routed to an invalid backend MUST receive a 404 status + been routed to an invalid backend MUST receive a 500 status code. \n When a BackendRef refers to a Service that has no ready endpoints, it is recommended to return a 503 status code. \n Support: Core for Kubernetes Service Support: Custom @@ -1750,18 +1750,18 @@ spec: properties: backendRefs: description: "BackendRefs defines the backend(s) where matching - requests should be sent. \n A 404 status code MUST be returned + requests should be sent. \n A 500 status code MUST be returned if there are no BackendRefs or filters specified that would result in a response being sent. \n A BackendRef is considered invalid when it refers to: \n * an unknown or unsupported kind of resource * a resource that does not exist * a resource in another namespace when the reference has not been explicitly allowed by a ReferenceGrant (or equivalent concept). \n When - a BackendRef is invalid, 404 status codes MUST be returned + a BackendRef is invalid, 500 status codes MUST be returned for requests that would have otherwise been routed to an invalid backend. If multiple backends are specified, and some are invalid, the proportion of requests that would otherwise have - been routed to an invalid backend MUST receive a 404 status + been routed to an invalid backend MUST receive a 500 status code. \n When a BackendRef refers to a Service that has no ready endpoints, it is recommended to return a 503 status code. \n Support: Core for Kubernetes Service Support: Custom diff --git a/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml b/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml index 49483b8c87..d9c23e6c5b 100644 --- a/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml +++ b/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml @@ -192,18 +192,18 @@ spec: properties: backendRefs: description: "BackendRefs defines the backend(s) where matching - requests should be sent. \n A 404 status code MUST be returned + requests should be sent. \n A 500 status code MUST be returned if there are no BackendRefs or filters specified that would result in a response being sent. \n A BackendRef is considered invalid when it refers to: \n * an unknown or unsupported kind of resource * a resource that does not exist * a resource in another namespace when the reference has not been explicitly allowed by a ReferenceGrant (or equivalent concept). \n When - a BackendRef is invalid, 404 status codes MUST be returned + a BackendRef is invalid, 500 status codes MUST be returned for requests that would have otherwise been routed to an invalid backend. If multiple backends are specified, and some are invalid, the proportion of requests that would otherwise have - been routed to an invalid backend MUST receive a 404 status + been routed to an invalid backend MUST receive a 500 status code. \n When a BackendRef refers to a Service that has no ready endpoints, it is recommended to return a 503 status code. \n Support: Core for Kubernetes Service Support: Custom @@ -1479,18 +1479,18 @@ spec: properties: backendRefs: description: "BackendRefs defines the backend(s) where matching - requests should be sent. \n A 404 status code MUST be returned + requests should be sent. \n A 500 status code MUST be returned if there are no BackendRefs or filters specified that would result in a response being sent. \n A BackendRef is considered invalid when it refers to: \n * an unknown or unsupported kind of resource * a resource that does not exist * a resource in another namespace when the reference has not been explicitly allowed by a ReferenceGrant (or equivalent concept). \n When - a BackendRef is invalid, 404 status codes MUST be returned + a BackendRef is invalid, 500 status codes MUST be returned for requests that would have otherwise been routed to an invalid backend. If multiple backends are specified, and some are invalid, the proportion of requests that would otherwise have - been routed to an invalid backend MUST receive a 404 status + been routed to an invalid backend MUST receive a 500 status code. \n When a BackendRef refers to a Service that has no ready endpoints, it is recommended to return a 503 status code. \n Support: Core for Kubernetes Service Support: Custom