Skip to content

Commit b1e595c

Browse files
zirainrudrakhp
authored andcommitted
docs: fix gwapi docs (#7408)
* docs: fix gwapi docs Signed-off-by: zirain <[email protected]> * fix Signed-off-by: zirain <[email protected]> * update Signed-off-by: zirain <[email protected]> --------- Signed-off-by: zirain <[email protected]>
1 parent ee28700 commit b1e595c

File tree

8 files changed

+135
-69
lines changed

8 files changed

+135
-69
lines changed

site/content/en/latest/api/gateway_api/backendtlspolicy.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ title = "BackendTLSPolicy"
33
+++
44

55

6-
The `BackendTLSPolicy` resource is Alpha and has been part of
7-
the Experimental Channel since `v1.0.0`. For more information on release
8-
channels, refer to our [versioning guide](https://gateway-api.sigs.k8s.io/concepts/versioning).
6+
The `BackendTLSPolicy` resource is GA and has been part of the Standard
7+
Channel since `v1.4.0`. For more information on release channels, refer
8+
to our [versioning guide](https://gateway-api.sigs.k8s.io/concepts/versioning).
99

1010
[BackendTLSPolicy][backendtlspolicy] is a Gateway API type for specifying the TLS configuration
1111
of the connection from the Gateway to a backend pod/s via the Service API object.
@@ -18,11 +18,11 @@ how to connect to a backend pod that has its own certificate.
1818

1919
While there are other API objects provided for TLS to be configured for **passthrough** and **edge** termination,
2020
this API object allows users to specifically configure **backend** TLS termination. For more information on TLS
21-
configuration in Gateway API, see [TLS Configuration](https://gateway-api.sigs.k8s.io/guides/tls/).
21+
configuration in Gateway API, see [TLS Configuration](https://gateway-api.sigs.k8s.io/guides/tls).
2222

2323
![Image showing three TLS Termination Types](https://gateway-api.sigs.k8s.io/images/tls-termination-types.png)
2424

25-
BackendTLSPolicy is a Direct [PolicyAttachment](https://gateway-api.sigs.k8s.io/reference/policy-attachment/) without defaults or overrides,
25+
BackendTLSPolicy is a Direct [PolicyAttachment](https://gateway-api.sigs.k8s.io/reference/policy-attachment) without defaults or overrides,
2626
applied to a Service that accesses a backend, where the BackendTLSPolicy resides in the same namespace as the
2727
Service to which it is applied. The BackendTLSPolicy and the Service must reside in the same namespace in order
2828
to prevent the complications involved with sharing trust across namespace boundaries.
@@ -37,19 +37,21 @@ The specification of a [BackendTLSPolicy][backendtlspolicy] consists of:
3737
- [Validation][validation] - Defines the configuration for TLS, including hostname, CACertificateRefs, and
3838
WellKnownCACertificates.
3939
- [Hostname][hostname] - Defines the Server Name Indication (SNI) that the Gateway uses to connect to the backend.
40+
- [SubjectAltNames][subjectAltNames] - Specifies one or more Subject Alternative Names that the backend certificate must match. When specified, the certificate must have at least one matching SAN. This field enables separation between SNI (hostname) and certificate identity validation. A maximum of 5 SANs are allowed.
4041
- [CACertificateRefs][caCertificateRefs] - Defines one or more references to objects that contain PEM-encoded TLS certificates,
4142
which are used to establish a TLS handshake between the Gateway and backend Pod. Either CACertificateRefs or
4243
WellKnownCACertificates may be specified, but not both.
4344
- [WellKnownCACertificates][wellKnownCACertificates] - Specifies whether system CA certificates may be used in the TLS
4445
handshake between the Gateway and backend Pod. Either CACertificateRefs or WellKnownCACertificates may be specified, but not both.
46+
- [Options][options] - A map of key/value pairs enabling extended TLS configuration for implementations that choose to provide support. Check your implementation's documentation for details.
4547

4648
The following chart outlines the object definitions and relationship:
4749
```mermaid
4850
flowchart LR
4951
backendTLSPolicy[["<b>backendTLSPolicy</b> <hr><align=left>BackendTLSPolicySpec: spec<br>PolicyStatus: status</align>"]]
5052
spec[["<b>spec</b><hr>PolicyTargetReferenceWithSectionName: targetRefs <br> BackendTLSPolicyValidation: tls"]]
5153
status[["<b>status</b><hr>[ ]PolicyAncestorStatus: ancestors"]]
52-
validation[["<b>tls</b><hr>LocalObjectReference: caCertificateRefs<br>wellKnownCACertificatesType: wellKnownCACertificates/<br>PreciseHostname: hostname"]]
54+
validation[["<b>tls</b><hr>LocalObjectReference: caCertificateRefs<br>wellKnownCACertificatesType: wellKnownCACertificates<br>PreciseHostname: hostname<br>[]SubjectAltName: subjectAltNames"]]
5355
ancestorStatus[["<b>ancestors</b><hr>AncestorRef: parentReference<br>GatewayController: controllerName<br>[]Condition: conditions"]]
5456
targetRefs[[<b>targetRefs</b><hr>]]
5557
service["<b>service</>"]
@@ -68,15 +70,10 @@ The following illustrates a BackendTLSPolicy that configures TLS for a Service s
6870
flowchart LR
6971
client(["client"])
7072
gateway["Gateway"]
71-
style gateway fill:#02f,color:#fff
7273
httproute["HTTP<BR>Route"]
73-
style httproute fill:#02f,color:#fff
7474
service["Service"]
75-
style service fill:#02f,color:#fff
7675
pod1["Pod"]
77-
style pod1 fill:#02f,color:#fff
7876
pod2["Pod"]
79-
style pod2 fill:#02f,color:#fff
8077
client -.->|HTTP <br> request| gateway
8178
gateway --> httproute
8279
httproute -.->|BackendTLSPolicy|service
@@ -110,6 +107,31 @@ Also note:
110107

111108
- Wildcard hostnames are not allowed.
112109

110+
#### Subject Alternative Names
111+
112+
113+
This field was added to BackendTLSPolicy in `v1.2.0`
114+
The subjectAltNames field enables basic mutual TLS configuration between Gateways and backends, as well as the optional use of SPIFFE. When subjectAltNames is specified, the certificate served by the backend must have at least one Subject Alternative Name matching one of the specified values. This is particularly useful for SPIFFE implementations where URI-based SANs may not be valid SNIs.
115+
Subject Alternative Names may contain one of either a Hostname or URI field, and must contain a Type specifying whether Hostname or URI is chosen.
116+
117+
118+
- IP addresses and wildcard hostnames are not allowed. (see the description for Hostname above for more details).
119+
- Hostname: DNS name format
120+
- URI: URI format (e.g., SPIFFE ID)
121+
122+
#### TLS Options
123+
124+
125+
This field was added to BackendTLSPolicy in `v1.2.0`
126+
The options field allows specification of implementation-specific TLS configurations. This can include:
127+
128+
- Vendor-specific mutual TLS automation configuration
129+
- Minimum supported TLS version restrictions
130+
- Supported cipher suite configurations
131+
132+
Check your implementation documentation for details.
133+
134+
###
113135
#### Certificates
114136

115137
The BackendTLSPolicyValidation must contain a certificate reference of some kind, and contains two ways to configure the
@@ -140,7 +162,9 @@ uses `PolicyAncestorStatus` to allow you to know which parentReference set that
140162
[backendtlspolicy]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#backendtlspolicy
141163
[validation]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#backendtlspolicyvalidation
142164
[caCertificateRefs]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#localobjectreference
143-
[wellKnownCACertificates]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#wellknowncacertificatestype
165+
[wellKnownCACertificates]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#localobjectreference
144166
[hostname]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#precisehostname
145167
[rfc-3986]: https://tools.ietf.org/html/rfc3986
146168
[targetRefs]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#localpolicytargetreferencewithsectionname
169+
[subjectAltNames]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#subjectaltname
170+
[options]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#backendtlspolicyspec

site/content/en/latest/api/gateway_api/grpcroute.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ header "my.filter.com". Note that GRPCRoute uses HTTPRoute filters for features
171171
with functionality identical to HTTPRoute, such as this.
172172

173173
```yaml
174-
#$ Used in:
175-
#$ - site-src/api-types/grpcroute.md
176174
apiVersion: gateway.networking.k8s.io/v1
177175
kind: GRPCRoute
178176
metadata:
@@ -224,8 +222,6 @@ The following example forwards gRPC requests for the method `User.Login` to serv
224222
header `magic: foo` to service "my-service2" on port `50051`:
225223

226224
```yaml
227-
#$ Used in:
228-
#$ - site-src/api-types/grpcroute.md
229225
apiVersion: gateway.networking.k8s.io/v1
230226
kind: GatewayClass
231227
metadata:
@@ -289,8 +285,6 @@ The following example uses the `weight` field to forward 90% of gRPC requests to
289285
Service:
290286

291287
```yaml
292-
#$ Used in:
293-
#$ - site-src/api-types/grpcroute.md
294288
apiVersion: gateway.networking.k8s.io/v1
295289
kind: GRPCRoute
296290
metadata:
@@ -321,7 +315,7 @@ on `weight` and other fields.
321315
For more information on release channels, refer to our
322316
[versioning guide](https://gateway-api.sigs.k8s.io/concepts/versioning).
323317

324-
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.
318+
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/index#section-names)), in the status stanzas of resources related to the route object, to identify internal configuration objects generated by the implementation from GRPCRoute Rule, etc.
325319

326320
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.
327321

@@ -368,12 +362,12 @@ Multiple GRPCRoutes can be attached to a single Gateway resource. Importantly,
368362
only one Route rule may match each request. For more information on how conflict
369363
resolution applies to merging, refer to the [API specification][grpcrouterule].
370364

371-
[grpcroute]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#grpcroute
372-
[grpcrouterule]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#grpcrouterule
373-
[hostname]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#hostname
365+
[grpcroute]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#grpcroute
366+
[grpcrouterule]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#grpcrouterule
367+
[hostname]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#hostname
374368
[rfc-3986]: https://tools.ietf.org/html/rfc3986
375-
[matches]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#grpcroutematch
376-
[filters]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#grpcroutefilter
377-
[backendRef]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#grpcroutebackendref
378-
[parentRef]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#parentref
379-
[name]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#sectionname
369+
[matches]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#grpcroutematch
370+
[filters]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#grpcroutefilter
371+
[backendRef]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#grpcbackendref
372+
[parentRef]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#parentreference
373+
[name]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#sectionname

site/content/en/latest/api/gateway_api/httproute.md

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ strategies, rate-limiting, and traffic shaping.
181181
The following example adds header "my-header: foo" to HTTP requests with Host
182182
header "my.filter.com".
183183
```yaml
184-
#$ Used in:
185-
#$ - site-src/api-types/httproute.md
186184
apiVersion: gateway.networking.k8s.io/v1
187185
kind: HTTPRoute
188186
metadata:
@@ -233,18 +231,16 @@ are specified that would result in a response being sent, a 404 error code
233231
is returned.
234232

235233
The following example forwards HTTP requests for path prefix `/bar` to service
236-
"my-service1" on port `8080`, and HTTP requests fulfilling _all_ four of the
234+
"my-service1" on port `8080`, and HTTP requests fulfilling _all_ four of the
237235
following criteria
238236

239-
- header `magic: foo`
237+
- header `magic: foo`
240238
- query param `great: example`
241239
- path prefix `/some/thing`
242240
- method `GET`
243241

244242
to service "my-service2" on port `8080`:
245243
```yaml
246-
#$ Used in:
247-
#$ - site-src/api-types/httproute.md
248244
apiVersion: gateway.networking.k8s.io/v1
249245
kind: GatewayClass
250246
metadata:
@@ -307,9 +303,6 @@ The following example uses the `weight` field to forward 90% of HTTP requests to
307303
`foo.example.com` to the "foo-v1" Service and the other 10% to the "foo-v2"
308304
Service:
309305
```yaml
310-
#$ Used in:
311-
#$ - site-src/guides/traffic-splitting.md
312-
#$ - site-src/api-types/httproute.md
313306
apiVersion: gateway.networking.k8s.io/v1
314307
kind: HTTPRoute
315308
metadata:
@@ -350,7 +343,7 @@ There are 2 kinds of timeouts that can be configured in an HTTPRoute Rule:
350343

351344
Because the `request` timeout encompasses the `backendRequest` timeout, the value of `backendRequest` must not be greater than the value of `request` timeout.
352345

353-
Timeouts are optional, and their fields are of type [Duration](https://gateway-api.sigs.k8s.io/geps/gep-2257). A zero-valued timeout ("0s") MUST be interpreted as disabling the timeout. A valid non-zero-valued timeout MUST be >= 1ms.
346+
Timeouts are optional, and their fields are of type [Duration](https://gateway-api.sigs.k8s.io/geps/gep-2257/index). A zero-valued timeout ("0s") MUST be interpreted as disabling the timeout. A valid non-zero-valued timeout MUST be >= 1ms.
354347

355348
The following example uses the `request` field which will cause a timeout if a client request is taking longer than 10 seconds to complete. The example also defines a 2s `backendRequest` which specifies a timeout for an individual request from the gateway to a backend service `timeout-svc`:
356349

@@ -385,7 +378,7 @@ Reference the [timeouts][timeouts] API documentation for additional details.
385378
For more information on release channels, refer to our
386379
[versioning guide](https://gateway-api.sigs.k8s.io/concepts/versioning).
387380

388-
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.
381+
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/index#section-names)), in the status stanzas of resources related to the route object, to identify internal configuration objects generated by the implementation from HTTPRoute Rule, etc.
389382

390383
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.
391384

@@ -471,14 +464,14 @@ only one Route rule may match each request. For more information on how conflict
471464
resolution applies to merging, refer to the [API specification][httprouterule].
472465

473466

474-
[httproute]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#httproute
475-
[httprouterule]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#httprouterule
476-
[hostname]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#hostname
467+
[httproute]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#httproute
468+
[httprouterule]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#httprouterule
469+
[hostname]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#hostname
477470
[rfc-3986]: https://tools.ietf.org/html/rfc3986
478-
[matches]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#httproutematch
479-
[filters]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#httproutefilter
480-
[backendRef]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#httpbackendref
481-
[parentRef]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#parentref
482-
[timeouts]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#httproutetimeouts
471+
[matches]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#httproutematch
472+
[filters]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#httproutefilter
473+
[backendRef]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#httpbackendref
474+
[parentRef]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#parentreference
475+
[timeouts]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#httproutetimeouts
483476
[appProtocol]: https://kubernetes.io/docs/concepts/services-networking/service/#application-protocol
484-
[sectionName]: https://gateway-api.sigs.k8s.io/reference/1.4/spec#sectionname
477+
[sectionName]: https://gateway-api.sigs.k8s.io/reference/1.4/spec/#sectionname

site/content/en/latest/api/gateway_api/referencegrant.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ While the API is simplistic in nature, it comes with a few notable decisions:
9090
other. This makes it impossible for them to conflict with each other.
9191
9292
Please see the [API
93-
Specification](https://gateway-api.sigs.k8s.io/reference/1.4/spec#gateway.networking.k8s.io/v1alpha2.ReferenceGrant)
93+
Specification](https://gateway-api.sigs.k8s.io/reference/spec#referencegrant)
9494
for more details on how specific ReferenceGrant fields are interpreted.
9595
9696
## Implementation Guidelines
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# DOC_DEST_DIR=/path/to/dir YAML_SRC_BASE_URL=... SYNC_FILES="a.md b.md" ./tools/hack/gwapi-doc-download-includes.sh
5+
6+
: "${DOC_DEST_DIR:=site/content/en/latest/api/gateway_api}"
7+
: "${YAML_SRC_BASE_URL:=https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/main/examples}"
8+
: "${SYNC_FILES:=gateway.md gatewayclass.md httproute.md grpcroute.md backendtlspolicy.md referencegrant.md}"
9+
: "${LOG_TARGET:=echo \"[docs]\"}"
10+
11+
GREP=$(command -v grep)
12+
SED=$(command -v sed)
13+
# use ggrep/gsed on macOS if available
14+
if [[ "$(uname)" == "Darwin" ]]; then
15+
if command -v ggrep &> /dev/null; then
16+
GREP=$(command -v ggrep)
17+
fi
18+
if command -v gsed &> /dev/null; then
19+
SED=$(command -v gsed)
20+
fi
21+
fi
22+
23+
for file in $SYNC_FILES; do
24+
echo "processing: $file"
25+
src="$DOC_DEST_DIR/$file"
26+
if [ ! -f "$src" ]; then
27+
echo " skip: $src not found"
28+
continue
29+
fi
30+
31+
# Extract the path inside {% include 'path' %} and download each referenced file
32+
includes=$($GREP -oP "{% include '\K[^']+" "$src" || true)
33+
for include_path in $includes; do
34+
filename=$(basename "$include_path")
35+
dest="$DOC_DEST_DIR/$filename"
36+
dest_dir=$(dirname "$dest")
37+
mkdir -p "$dest_dir"
38+
url="$YAML_SRC_BASE_URL/$include_path"
39+
echo "downloading $url to $dest"
40+
curl -sSL -o "$dest" "$url"
41+
42+
# Remove lines start with `#$`
43+
$SED -i '/^#\$/d' "$dest"
44+
done
45+
done

tools/make/common.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616

1717
SHELL:=/usr/bin/env bash -euo pipefail
1818

19+
GNU_SED := $(shell sed --version >/dev/null 2>&1 && echo "yes" || echo "no")
20+
ifeq ($(GNU_SED),yes)
21+
SED=sed -i
22+
else
23+
SED=sed -i ''
24+
endif
25+
1926
# ====================================================================================================
2027
# ROOT Options:
2128
# ====================================================================================================

0 commit comments

Comments
 (0)