Skip to content

Commit 256bde1

Browse files
docs: document gatewayApi.rules[].name and sectionName targeting
Update the Helm chart README to: - include the optional 'name' field in the Advanced Gateway API configuration example - add a new subsection explaining how rules[].name maps to sectionName on policies (SecurityPolicy, BackendTrafficPolicy, etc.) so that consumers can target individual HTTPRoute rules. Addresses Copilot review comment on Chart.yaml:37. Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
1 parent 62ead53 commit 256bde1

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

helm/oauth2-proxy/README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ gatewayApi:
361361
hostnames:
362362
- oauth.example.com
363363
rules:
364-
- matches:
364+
- name: oauth2
365+
matches:
365366
- path:
366367
type: PathPrefix
367368
value: /oauth2
@@ -380,6 +381,31 @@ gatewayApi:
380381
If you don't specify custom rules, the chart will create a default rule that matches all paths with `PathPrefix: /` and routes to the oauth2-proxy service.
381382
If you don't specify a sectionName, the rules will be applied to all listeners of the referenced Gateway.
382383

384+
### Targeting Rules with Policies via `sectionName`
385+
386+
The optional `name` field on each rule (e.g. `rules[].name: oauth2`) lets policies such as `SecurityPolicy`, `BackendTrafficPolicy`, or any other Gateway API policy that supports `sectionName` target a specific HTTPRoute rule rather than the entire route. Example:
387+
388+
```yaml
389+
apiVersion: gateway.envoyproxy.io/v1alpha1
390+
kind: SecurityPolicy
391+
metadata:
392+
name: oauth2-proxy-policy
393+
spec:
394+
targetRefs:
395+
- group: gateway.networking.k8s.io
396+
kind: HTTPRoute
397+
name: oauth2-proxy
398+
sectionName: oauth2 # matches rules[].name above
399+
jwt:
400+
providers:
401+
- name: example
402+
issuer: https://issuer.example.com
403+
remoteJWKS:
404+
uri: https://issuer.example.com/.well-known/jwks.json
405+
```
406+
407+
Without a rule `name`, policies cannot target individual rules and must apply to the whole HTTPRoute.
408+
383409
## TLS Configuration
384410

385411
See: [TLS Configuration](https://oauth2-proxy.github.io/oauth2-proxy/configuration/tls/).

0 commit comments

Comments
 (0)