Skip to content

Commit

Permalink
Add guide for UpstreamSettingsPolicy (#2987)
Browse files Browse the repository at this point in the history
Problem: As a user, I want an example of how to configure upstream 
settings for my application.

Solution: Add a how-to guide describing how to configure 
upstream zone size and keepalives for services. Also adds 
UpstreamSettingsPolicy to the table in the custom policies 
document and moves the custom policies document closer 
to the top of the overview page to increase visibility.
  • Loading branch information
kate-osborn authored Jan 9, 2025
1 parent 046f2d3 commit 2ea899a
Show file tree
Hide file tree
Showing 11 changed files with 422 additions and 17 deletions.
13 changes: 13 additions & 0 deletions examples/upstream-settings-policy/1m-zone-size.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: gateway.nginx.org/v1alpha1
kind: UpstreamSettingsPolicy
metadata:
name: 1m-zone-size
spec:
targetRefs:
- group: core
kind: Service
name: tea
- group: core
kind: Service
name: coffee
zoneSize: 1m
3 changes: 1 addition & 2 deletions examples/upstream-settings-policy/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# UpstreamSettingsPolicy

This directory contains example YAMLs for testing the UpstreamSettingsPolicy CRD. Eventually, this will be converted
into a how-to-guide.
This directory contains the YAML files used in the [UpstreamSettingsPolicy](https://docs.nginx.com/nginx-gateway-fabric/how-to/traffic-management/upstream-settings/) guide.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
rules:
- matches:
- path:
type: PathPrefix
type: Exact
value: /coffee
backendRefs:
- name: coffee
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
apiVersion: gateway.nginx.org/v1alpha1
kind: UpstreamSettingsPolicy
metadata:
name: upstream-settings-policy
name: upstream-keepalives
spec:
zoneSize: 512k
targetRefs:
- group: core
kind: Service
name: coffee
keepAlive:
connections: 32
requests: 1001
time: 300s
timeout: 60s
2 changes: 1 addition & 1 deletion site/content/how-to/monitoring/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ To enable tracing, you must configure two resources:

The `NginxProxy` resource contains configuration for the collector, and applies to all Gateways and routes under the GatewayClass. It does not enable tracing, but is a prerequisite to the next piece of configuration.

- `ObservabilityPolicy`: This resource is a [Direct PolicyAttachment](https://gateway-api.sigs.k8s.io/reference/policy-attachment/) that targets HTTPRoutes or GRPCRoutes. It is created by the [application developer](https://gateway-api.sigs.k8s.io/concepts/roles-and-personas/) and enables tracing for a specific route or routes. It requires the `NginxProxy` resource to exist in order to complete the tracing configuration.
- `ObservabilityPolicy`: This resource is a [Direct Policy Attachment](https://gateway-api.sigs.k8s.io/reference/policy-attachment/) that targets HTTPRoutes or GRPCRoutes. It is created by the [application developer](https://gateway-api.sigs.k8s.io/concepts/roles-and-personas/) and enables tracing for a specific route or routes. It requires the `NginxProxy` resource to exist in order to complete the tracing configuration.

For all the possible configuration options for these resources, see the [API reference]({{< relref "reference/api.md" >}}).

Expand Down
2 changes: 1 addition & 1 deletion site/content/how-to/traffic-management/client-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The settings in `ClientSettingsPolicy` correspond to the following NGINX directi
- [`keepalive_time`](<https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_time>)
- [`keepalive_timeout`](<https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout>)

`ClientSettingsPolicy` is an [Inherited PolicyAttachment](https://gateway-api.sigs.k8s.io/reference/policy-attachment/) that can be applied to a Gateway, HTTPRoute, or GRPCRoute in the same namespace as the `ClientSettingsPolicy`.
`ClientSettingsPolicy` is an [Inherited Policy Attachment](https://gateway-api.sigs.k8s.io/reference/policy-attachment/) that can be applied to a Gateway, HTTPRoute, or GRPCRoute in the same namespace as the `ClientSettingsPolicy`.

When applied to a Gateway, the settings specified in the `ClientSettingsPolicy` affect all HTTPRoutes and GRPCRoutes attached to the Gateway. This allows Cluster Operators to set defaults for all applications using the Gateway.

Expand Down
Loading

0 comments on commit 2ea899a

Please sign in to comment.