From e25f9ced6c3630e30fc5d38a1a6f478ff15deaf7 Mon Sep 17 00:00:00 2001 From: huabing zhao Date: Mon, 14 Aug 2023 16:16:10 +0800 Subject: [PATCH] small wording Signed-off-by: huabing zhao --- apis/v1alpha2/tcproute_types.go | 9 +++++++++ apis/v1alpha2/tlsroute_types.go | 9 +++++++++ apis/v1alpha2/udproute_types.go | 9 +++++++++ apis/v1beta1/httproute_types.go | 9 +++++++++ geps/gep-713.md | 10 +++++----- 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/apis/v1alpha2/tcproute_types.go b/apis/v1alpha2/tcproute_types.go index fe927ab8d4..011842f5d4 100644 --- a/apis/v1alpha2/tcproute_types.go +++ b/apis/v1alpha2/tcproute_types.go @@ -59,6 +59,15 @@ type TCPRouteStatus struct { // TCPRouteRule is the configuration for a given rule. type TCPRouteRule struct { + // Name is the name of the Route rule. If more than one Route Rule is + // present, each Rule MUST specify a name. The names of Rules MUST be unique + // within a Route. + // + // Support: Core + // + // +optional + Name *SectionName `json:"name,omitempty"` + // BackendRefs defines the backend(s) where matching requests should be // sent. If unspecified or invalid (refers to a non-existent resource or a // Service with no endpoints), the underlying implementation MUST actively diff --git a/apis/v1alpha2/tlsroute_types.go b/apis/v1alpha2/tlsroute_types.go index afe34d82d6..afe14f3779 100644 --- a/apis/v1alpha2/tlsroute_types.go +++ b/apis/v1alpha2/tlsroute_types.go @@ -100,6 +100,15 @@ type TLSRouteStatus struct { // TLSRouteRule is the configuration for a given rule. type TLSRouteRule struct { + // Name is the name of the Route rule. If more than one Route Rule is + // present, each Rule MUST specify a name. The names of Rules MUST be unique + // within a Route. + // + // Support: Core + // + // +optional + Name *SectionName `json:"name,omitempty"` + // BackendRefs defines the backend(s) where matching requests should be // sent. If unspecified or invalid (refers to a non-existent resource or // a Service with no endpoints), the rule performs no forwarding; if no diff --git a/apis/v1alpha2/udproute_types.go b/apis/v1alpha2/udproute_types.go index 9e3770c293..0b7dfa2688 100644 --- a/apis/v1alpha2/udproute_types.go +++ b/apis/v1alpha2/udproute_types.go @@ -59,6 +59,15 @@ type UDPRouteStatus struct { // UDPRouteRule is the configuration for a given rule. type UDPRouteRule struct { + // Name is the name of the Route rule. If more than one Route Rule is + // present, each Rule MUST specify a name. The names of Rules MUST be unique + // within a Route. + // + // Support: Core + // + // +optional + Name *SectionName `json:"name,omitempty"` + // BackendRefs defines the backend(s) where matching requests should be // sent. If unspecified or invalid (refers to a non-existent resource or a // Service with no endpoints), the underlying implementation MUST actively diff --git a/apis/v1beta1/httproute_types.go b/apis/v1beta1/httproute_types.go index 7cfda8f7ec..ff20d531a6 100644 --- a/apis/v1beta1/httproute_types.go +++ b/apis/v1beta1/httproute_types.go @@ -132,6 +132,15 @@ type HTTPRouteSpec struct { // +kubebuilder:validation:XValidation:message="Within backendRefs, when using RequestRedirect filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.backendRefs) && self.backendRefs.exists_one(b, (has(b.filters) && b.filters.exists_one(f, has(f.requestRedirect) && has(f.requestRedirect.path) && f.requestRedirect.path.type == 'ReplacePrefixMatch' && has(f.requestRedirect.path.replacePrefixMatch))) )) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true" // +kubebuilder:validation:XValidation:message="Within backendRefs, When using URLRewrite filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.backendRefs) && self.backendRefs.exists_one(b, (has(b.filters) && b.filters.exists_one(f, has(f.urlRewrite) && has(f.urlRewrite.path) && f.urlRewrite.path.type == 'ReplacePrefixMatch' && has(f.urlRewrite.path.replacePrefixMatch))) )) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true" type HTTPRouteRule struct { + // Name is the name of the Route rule. If more than one Route Rule is + // present, each Rule MUST specify a name. The names of Rules MUST be unique + // within a Route. + // + // Support: Core + // + // +optional + Name *SectionName `json:"name,omitempty"` + // Matches define conditions used for matching the rule against incoming // HTTP requests. Each match is independent, i.e. this rule will be matched // if **any** one of the matches is satisfied. diff --git a/geps/gep-713.md b/geps/gep-713.md index 2e4b6c8df5..1c1e7d406a 100644 --- a/geps/gep-713.md +++ b/geps/gep-713.md @@ -683,11 +683,11 @@ the same behavior and semantics, although they may not be able to support attachment of all types of policy at all potential attachment points. ### Apply Policies to Sections of a Resource -Policies can be targeted at specific matches within nested objects. For example, -it's useful to attach policies to a specific Gateway listeners. +Policies can target specific matches within nested objects. For instance, rather than +applying a policy to the entire Gateway, we may want to attach it to a particular Gateway listener. -For example, an optional `sectionName` field can be set in the `targetRef` of a policy -to refer to a specific listener in the target Gateway. +To achieve this, an optional `sectionName` field can be set in the `targetRef` of a policy +to refer to a specific listener within the target Gateway. ```yaml apiVersion: networking.acme.io/v1alpha2 @@ -709,7 +709,7 @@ The `sectionName` field could also be used to target a specific section of other * xRoute.Rules.Name * Service.Ports.Name -This would require adding a `Name` field to those sub-resources that don't have a name yet. For example, +This would require adding a `Name` field to those sub-resources that currently lack a name. For example, a `Name` field could be added to the `RouteRule` object: ```go type RouteRule struct {