Skip to content

Commit 076d830

Browse files
authored
Docs: route rule name (#3299)
* Move GEP-995 to Experimental Signed-off-by: Guilherme Cassolato <[email protected]> * docs: Fix the description of the format for the name field of route rules Signed-off-by: Guilherme Cassolato <[email protected]> * docs: Route Rule name field Signed-off-by: Guilherme Cassolato <[email protected]> --------- Signed-off-by: Guilherme Cassolato <[email protected]>
1 parent 3b7ca06 commit 076d830

File tree

5 files changed

+67
-23
lines changed

5 files changed

+67
-23
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: HTTPRoute
3+
metadata:
4+
name: example-route
5+
spec:
6+
parentRefs:
7+
- name: example-gateway
8+
rules:
9+
- name: read-only
10+
matches:
11+
- method: GET
12+
backendRefs:
13+
- name: backend-mirror-svc
14+
port: 8080
15+
- name: write-only
16+
matches:
17+
- method: POST
18+
- method: PATCH
19+
- method: DELETE
20+
backendRefs:
21+
- name: backend-svc
22+
port: 8080

geps/gep-995/index.md

+4-13
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,10 @@ This GEP proposes to add a new optional `name` field to the [GRPCRouteRule](http
4141

4242
### Format
4343

44-
The name of a route rule, if present, MUST be a string that begins with a single lowercase letter (`a-z`) and is followed by any number of characters, from 0 to a maximum of 252, that is either a letter, a digit, or any of the following symbols `-`, `_`. The value of the `name` field MUST be treated as case-sensitive.
45-
46-
A simple regular expression that can be used to test a string conforms with the format of the `name` field for route rules, compatible with Golang's [`regexp`](https://pkg.go.dev/regexp) package, is: `^[a-z][-_a-zA-Z0-9]{0,252}$`. (Provided as example)
47-
48-
A set of [kubebuilder](https://book.kubebuilder.io/reference/markers/crd-validation) annotations for the validation of patterns compatible with the `name` field, to be used in CRDs, is: (Provided as example)
49-
50-
```yaml
51-
// +kubebuilder:validation:Pattern=`^[a-z][-_a-zA-Z0-9]*$`
52-
// +kubebuilder:validation:MinLength=1
53-
// +kubebuilder:validation:MaxLength=253
54-
```
55-
56-
This format for the `name` field of route rules differs from the pattern adopted for the [`SectionName`](https://github.com/kubernetes-sigs/gateway-api/blob/f544a46ef92b7f234ee3e7bf50da35b05f862c35/apis/v1/shared_types.go#L624C10-L624C10) type, which was thought for specifying mainly DNS subdomain names ([RFC 1123](https://www.rfc-editor.org/rfc/rfc1123)), due to its use in the gateway listeners originally.
44+
If specified, the name of a route rule MUST comply with the [`SectionName`](https://github.com/kubernetes-sigs/gateway-api/blob/v1.0.0/apis/v1/shared_types.go#L607-L624) type:
45+
- starts and ends with a lower case Latin letter (`a-z`) or digit (`0-9`);
46+
- accepts any lower case Latin letter (`a-z`), digits (`0-9`), and the following special characters: `-`, `.`;
47+
- contains a minimum of 1 and maximum of 253 characters.
5748

5849
### Volition
5950

mkdocs.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ nav:
123123
- geps/gep-1867/index.md
124124
- geps/gep-2648/index.md
125125
- geps/gep-2649/index.md
126-
# - Implementable:
126+
- Implementable:
127+
- geps/gep-3155/index.md
127128
- Experimental:
128129
- geps/gep-995/index.md
129130
- geps/gep-1619/index.md

site-src/api-types/grpcroute.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ The specification of a GRPCRoute consists of:
6565
matching the Host header of gRPC requests.
6666
- [Rules][grpcrouterule]- Define a list of rules to perform actions against
6767
matching gRPC requests. Each rule consists of [matches][matches],
68-
[filters][filters] (optional), and [backendRefs][backendRef] (optional)
69-
fields.
68+
[filters][filters] (optional), [backendRefs][backendRef] (optional), and
69+
[name][name] (optional) fields.
7070

7171
<!--- Editable SVG available at site-src/images/grpcroute-basic-example.svg -->
7272
The following illustrates a GRPCRoute that sends all traffic to one Service:
@@ -217,6 +217,18 @@ Service:
217217
Reference the [backendRef][backendRef] API documentation for additional details
218218
on `weight` and other fields.
219219

220+
#### Name (optional)
221+
222+
??? example "Experimental Channel since v1.2.0"
223+
224+
This concept has been part of the Experimental Channel since `v1.2.0`.
225+
For more information on release channels, refer to our
226+
[versioning guide](/concepts/versioning).
227+
228+
GRPCRoute Rules include an optional `name` field. The applications for the name of a route rule are implementation-specific. It can be used to reference individual route rules by name from other resources, such as in the `sectionName` field of metaresources ([GEP-2648](https://gateway-api.sigs.k8s.io/geps/gep-2648/#apply-policies-to-sections-of-a-resource)), in the status stanzas of resources related to the route object, to identify internal configuration objects generated by the implementation from GRPCRoute Rule, etc.
229+
230+
If specified, the value of the name field must comply with the [`SectionName`](https://github.com/kubernetes-sigs/gateway-api/blob/v1.0.0/apis/v1/shared_types.go#L607-L624) type.
231+
220232
## Status
221233

222234
Status defines the observed state of the GRPCRoute.

site-src/api-types/httproute.md

+25-7
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ The specification of an HTTPRoute consists of:
1919
matching the Host header of HTTP requests.
2020
- [Rules][httprouterule]- Define a list of rules to perform actions against
2121
matching HTTP requests. Each rule consists of [matches][matches],
22-
[filters][filters] (optional), [backendRefs][backendRef] (optional) and [timeouts][timeouts] (optional)
23-
fields.
22+
[filters][filters] (optional), [backendRefs][backendRef] (optional),
23+
[timeouts][timeouts] (optional), and [name][name] (optional) fields.
2424

2525
The following illustrates an HTTPRoute that sends all traffic to one Service:
2626
![httproute-basic-example](/images/httproute-basic-example.svg)
@@ -193,7 +193,7 @@ Conformance levels are defined by the filter type:
193193
- Implementers are encouraged to support "extended" filters.
194194
- "Implementation-specific" filters have no API guarantees across implementations.
195195

196-
Specifying a core filter multiple times has unspecified or
196+
Specifying a core filter multiple times has unspecified or
197197
implementation-specific conformance.
198198

199199
All filters are expected to be compatible with each other except for the
@@ -233,7 +233,7 @@ on `weight` and other fields.
233233
??? example "Experimental Channel since v1.0.0"
234234

235235
HTTPRoute timeouts have been part of the Experimental Channel since `v1.0.0`.
236-
For more information on release channels, refer to our
236+
For more information on release channels, refer to our
237237
[versioning guide](/concepts/versioning).
238238

239239
HTTPRoute Rules include a `Timeouts` field. If unspecified, timeout behavior is implementation-specific.
@@ -256,16 +256,34 @@ The following example uses the `request` field which will cause a timeout if a c
256256

257257
Reference the [timeouts][timeouts] API documentation for additional details.
258258

259+
#### Name (optional)
260+
261+
??? example "Experimental Channel since v1.2.0"
262+
263+
This concept has been part of the Experimental Channel since `v1.2.0`.
264+
For more information on release channels, refer to our
265+
[versioning guide](/concepts/versioning).
266+
267+
HTTPRoute Rules include an optional `name` field. The applications for the name of a route rule are implementation-specific. It can be used to reference individual route rules by name from other resources, such as in the `sectionName` field of metaresources ([GEP-2648](https://gateway-api.sigs.k8s.io/geps/gep-2648/#apply-policies-to-sections-of-a-resource)), in the status stanzas of resources related to the route object, to identify internal configuration objects generated by the implementation from HTTPRoute Rule, etc.
268+
269+
If specified, the value of the name field must comply with the [`SectionName`](https://github.com/kubernetes-sigs/gateway-api/blob/v1.0.0/apis/v1/shared_types.go#L607-L624) type.
270+
271+
The following example specifies the `name` field to identify HTTPRoute Rules used to split traffic between a _read-only_ backend service and a _write-only_ one:
272+
273+
```yaml
274+
{% include 'experimental/http-route-rule-name.yaml' %}
275+
```
276+
259277
##### Backend Protocol
260278

261279
??? example "Experimental Channel since v1.0.0"
262280

263281
This concept has been part of the Experimental Channel since `v1.0.0`.
264-
For more information on release channels, refer to our
282+
For more information on release channels, refer to our
265283
[versioning guide](/concepts/versioning).
266284

267-
Some implementations may require the [backendRef][backendRef] to be labeled
268-
explicitly in order to route traffic using a certain protocol. For Kubernetes
285+
Some implementations may require the [backendRef][backendRef] to be labeled
286+
explicitly in order to route traffic using a certain protocol. For Kubernetes
269287
Service backends this can be done by specifying the [`appProtocol`][appProtocol]
270288
field.
271289

0 commit comments

Comments
 (0)