Skip to content

Commit 9deb057

Browse files
authored
[GEP-1911] Update BackendRef with GEP details (#2444)
* just mention service protocol field * add backend protocol GEP details to BackendRef * mark backend protocol section experimental * fix regexp generation * fix nits * relax requirements to SHOULD and only drop language around Endpoints/EndpointSlices * Drop 'Gateway' in some clauses so that appProtocol can apply to mesh use cases * Update godoc so it appears in the CRD generated docs * clarify multiplexing clause * drop reference to GEP - adjust requirement level * drop multiplexing backend clause
1 parent 3b87766 commit 9deb057

11 files changed

+219
-20
lines changed

apis/v1alpha2/grpcroute_types.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,31 @@ type GRPCRouteFilter struct {
549549
}
550550

551551
// GRPCBackendRef defines how a GRPCRoute forwards a gRPC request.
552+
//
553+
// Note that when a namespace different than the local namespace is specified, a
554+
// ReferenceGrant object is required in the referent namespace to allow that
555+
// namespace's owner to accept the reference. See the ReferenceGrant
556+
// documentation for details.
557+
//
558+
// <gateway:experimental:description>
559+
//
560+
// When the BackendRef points to a Kubernetes Service, implementations SHOULD honor the
561+
// appProtocol field if it is set for the target Service Port.
562+
//
563+
// Implementations supporting appProtocol SHOULD recognize the Kubernetes Standard Application Protocols
564+
// defined in [KEP-3726].
565+
//
566+
// If a Service appProtocol isn't specified an implementation MAY infer the backend
567+
// protocol through its own means. Implementations MAY infer the protocol from the
568+
// Route type referring to the backend Service.
569+
//
570+
// If a Route is not able to send traffic to the backend using the specified protocol then
571+
// the backend is considered invalid. Implementations MUST set ResolvedRefs condition to
572+
// False with the "UnsupportedProtocol".
573+
//
574+
// </gateway:experimental:description>
575+
//
576+
// [KEP-3726]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-network/3726-standard-application-protocols
552577
type GRPCBackendRef struct {
553578
// BackendRef is a reference to a backend to forward matched requests to.
554579
//

apis/v1beta1/httproute_types.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,32 @@ type HTTPRequestMirrorFilter struct {
11101110
BackendRef BackendObjectReference `json:"backendRef"`
11111111
}
11121112

1113-
// HTTPBackendRef defines how a HTTPRoute should forward an HTTP request.
1113+
// HTTPBackendRef defines how a HTTPRoute forwards a HTTP request.
1114+
//
1115+
// Note that when a namespace different than the local namespace is specified, a
1116+
// ReferenceGrant object is required in the referent namespace to allow that
1117+
// namespace's owner to accept the reference. See the ReferenceGrant
1118+
// documentation for details.
1119+
//
1120+
// <gateway:experimental:description>
1121+
//
1122+
// When the BackendRef points to a Kubernetes Service, implementations SHOULD honor the
1123+
// appProtocol field if it is set for the target Service Port.
1124+
//
1125+
// Implementations supporting appProtocol SHOULD recognize the Kubernetes Standard Application Protocols
1126+
// defined in [KEP-3726].
1127+
//
1128+
// If a Service appProtocol isn't specified an implementation MAY infer the backend
1129+
// protocol through its own means. Implementations MAY infer the protocol from the
1130+
// Route type referring to the backend Service.
1131+
//
1132+
// If a Route is not able to send traffic to the backend using the specified protocol then
1133+
// the backend is considered invalid. Implementations MUST set ResolvedRefs condition to
1134+
// False with the "UnsupportedProtocol".
1135+
//
1136+
// </gateway:experimental:description>
1137+
//
1138+
// [KEP-3726]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-network/3726-standard-application-protocols
11141139
type HTTPBackendRef struct {
11151140
// BackendRef is a reference to a backend to forward matched requests to.
11161141
//

apis/v1beta1/shared_types.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,26 @@ type PortNumber int32
243243
// ReferenceGrant object is required in the referent namespace to allow that
244244
// namespace's owner to accept the reference. See the ReferenceGrant
245245
// documentation for details.
246+
//
247+
// <gateway:experimental:description>
248+
//
249+
// When the BackendRef points to a Kubernetes Service, implementations SHOULD honor the
250+
// appProtocol field if it is set for the target Service Port.
251+
//
252+
// Implementations supporting appProtocol SHOULD recognize the Kubernetes Standard Application Protocols
253+
// defined in [KEP-3726].
254+
//
255+
// If a Service appProtocol isn't specified an implementation MAY infer the backend
256+
// protocol through its own means. Implementations MAY infer the protocol from the
257+
// Route type referring to the backend Service.
258+
//
259+
// If a Route is not able to send traffic to the backend using the specified protocol then
260+
// the backend is considered invalid. Implementations MUST set ResolvedRefs condition to
261+
// False with the "UnsupportedProtocol".
262+
//
263+
// </gateway:experimental:description>
264+
//
265+
// [KEP-3726]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-network/3726-standard-application-protocols
246266
type BackendRef struct {
247267
// BackendObjectReference references a Kubernetes object.
248268
BackendObjectReference `json:",inline"`
@@ -342,6 +362,7 @@ const (
342362
// * "RefNotPermitted"
343363
// * "InvalidKind"
344364
// * "BackendNotFound"
365+
// * "UnsupportedProtocol"
345366
//
346367
// Controllers may raise this condition with other reasons,
347368
// but should prefer to use the reasons listed above to improve
@@ -366,6 +387,11 @@ const (
366387
// This reason is used with the "ResolvedRefs" condition when one of the
367388
// Route's rules has a reference to a resource that does not exist.
368389
RouteReasonBackendNotFound RouteConditionReason = "BackendNotFound"
390+
391+
// This reason is used with the "ResolvedRefs" condition when one of the
392+
// Route's rules has a reference to a resource with an app protocol that
393+
// is not supported by this implementation.
394+
RouteReasonUnsupportedProtocol RouteConditionReason = "UnsupportedProtocol"
369395
)
370396

371397
// RouteParentStatus describes the status of a route with respect to an

config/crd/experimental/gateway.networking.k8s.io_grpcroutes.yaml

Lines changed: 19 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml

Lines changed: 38 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/experimental/gateway.networking.k8s.io_tlsroutes.yaml

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)