You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: charts/nginx-gateway-fabric/README.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -246,7 +246,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
246
246
|`nginx.usage.resolver`| The nameserver used to resolve the NGINX Plus usage reporting endpoint. Used with NGINX Instance Manager. | string |`""`|
247
247
|`nginx.usage.secretName`| The name of the Secret containing the JWT for NGINX Plus usage reporting. Must exist in the same namespace that the NGINX Gateway Fabric control plane is running in (default namespace: nginx-gateway). | string |`"nplus-license"`|
248
248
|`nginx.usage.skipVerify`| Disable client verification of the NGINX Plus usage reporting server certificate. | bool |`false`|
249
-
| `nginxGateway` | The nginxGateway section contains configuration for the NGINX Gateway Fabric control plane deployment. | object | `{"affinity":{},"autoscaling":{"enable":false},"config":{"logging":{"level":"info"}},"configAnnotations":{},"extraVolumeMounts":[],"extraVolumes":[],"gatewayClassAnnotations":{},"gatewayClassName":"nginx","gatewayControllerName":"gateway.nginx.org/nginx-gateway-controller","gwAPIExperimentalFeatures":{"enable":false},"gwAPIInferenceExtension":{"enable":false,"endpointPicker":{"disableTLS":false,"skipVerify":true}},"image":{"pullPolicy":"Always","repository":"ghcr.io/nginx/nginx-gateway-fabric","tag":"edge"},"kind":"deployment","labels":{},"leaderElection":{"enable":true,"lockName":""},"lifecycle":{},"metrics":{"enable":true,"port":9113,"secure":false},"name":"","nodeSelector":{},"podAnnotations":{},"productTelemetry":{"enable":true},"readinessProbe":{"enable":true,"initialDelaySeconds":3,"port":8081},"replicas":1,"resources":{},"service":{"annotations":{},"labels":{}},"serviceAccount":{"annotations":{},"imagePullSecret":"","imagePullSecrets":[],"name":""},"snippetsFilters":{"enable":false},"terminationGracePeriodSeconds":30,"tolerations":[],"topologySpreadConstraints":[]}` |
249
+
| `nginxGateway` | The nginxGateway section contains configuration for the NGINX Gateway Fabric control plane deployment. | object | `{"affinity":{},"autoscaling":{"enable":false},"config":{"logging":{"level":"info"}},"configAnnotations":{},"extraVolumeMounts":[],"extraVolumes":[],"gatewayClassAnnotations":{},"gatewayClassName":"nginx","gatewayControllerName":"gateway.nginx.org/nginx-gateway-controller","gwAPIExperimentalFeatures":{"enable":false},"gwAPIInferenceExtension":{"enable":false,"endpointPicker":{"disableTLS":false,"skipVerify":true}},"image":{"pullPolicy":"Always","repository":"ghcr.io/nginx/nginx-gateway-fabric","tag":"edge"},"kind":"deployment","labels":{},"leaderElection":{"enable":true,"lockName":""},"lifecycle":{},"metrics":{"enable":true,"port":9113,"secure":false},"name":"","nodeSelector":{},"podAnnotations":{},"productTelemetry":{"enable":true},"readinessProbe":{"enable":true,"initialDelaySeconds":3,"port":8081},"replicas":1,"resources":{},"service":{"annotations":{},"labels":{}},"serviceAccount":{"annotations":{},"imagePullSecret":"","imagePullSecrets":[],"name":""},"snippetsFilters":{"enable":false},"snippetsPolicies":{"enable":false},"terminationGracePeriodSeconds":30,"tolerations":[],"topologySpreadConstraints":[]}` |
250
250
|`nginxGateway.affinity`| The affinity of the NGINX Gateway Fabric control plane pod. | object |`{}`|
251
251
|`nginxGateway.autoscaling`| Autoscaling configuration for the NGINX Gateway Fabric control plane. | object |`{"enable":false}`|
252
252
|`nginxGateway.autoscaling.enable`| Enable or disable Horizontal Pod Autoscaler for the control plane. | bool |`false`|
@@ -290,6 +290,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
290
290
|`nginxGateway.serviceAccount.imagePullSecrets`| A list of secret names containing docker registry credentials for the control plane. Secrets must exist in the same namespace as the helm release. | list |`[]`|
291
291
|`nginxGateway.serviceAccount.name`| The name of the service account of the NGINX Gateway Fabric control plane pods. Used for RBAC. | string | Autogenerated if not set or set to "" |
292
292
|`nginxGateway.snippetsFilters.enable`| Enable SnippetsFilters feature. SnippetsFilters allow inserting NGINX configuration into the generated NGINX config for HTTPRoute and GRPCRoute resources. | bool |`false`|
293
+
|`nginxGateway.snippetsPolicies.enable`| Enable SnippetsPolicies feature. SnippetsPolicies allow inserting NGINX configuration into the generated NGINX config for Gateway, HTTPRoute and GRPCRoute resources. | bool |`false`|
293
294
|`nginxGateway.terminationGracePeriodSeconds`| The termination grace period of the NGINX Gateway Fabric control plane pod. | int |`30`|
294
295
|`nginxGateway.tolerations`| Tolerations for the NGINX Gateway Fabric control plane pod. | list |`[]`|
295
296
|`nginxGateway.topologySpreadConstraints`| The topology spread constraints for the NGINX Gateway Fabric control plane pod. | list |`[]`|
Copy file name to clipboardExpand all lines: charts/nginx-gateway-fabric/values.schema.json
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1148,6 +1148,20 @@
1148
1148
"title": "snippetsFilters",
1149
1149
"type": "object"
1150
1150
},
1151
+
"snippetsPolicies": {
1152
+
"properties": {
1153
+
"enable": {
1154
+
"default": false,
1155
+
"description": "Enable SnippetsPolicies feature. SnippetsPolicies allow inserting NGINX configuration into the generated NGINX\nconfig for Gateway, HTTPRoute and GRPCRoute resources.",
1156
+
"required": [],
1157
+
"title": "enable",
1158
+
"type": "boolean"
1159
+
}
1160
+
},
1161
+
"required": [],
1162
+
"title": "snippetsPolicies",
1163
+
"type": "object"
1164
+
},
1151
1165
"terminationGracePeriodSeconds": {
1152
1166
"default": 30,
1153
1167
"description": "The termination grace period of the NGINX Gateway Fabric control plane pod.",
The `SnippetsPolicy` Custom Resource Definition (CRD) allows you to inject NGINX snippets into the configuration generated by NGINX Gateway Fabric. This is useful for advanced use cases where you need to configure NGINX directives that are not exposed through the Gateway API or other NGINX Gateway Fabric policies.
4
+
5
+
## Overview
6
+
7
+
`SnippetsPolicy` is an Attached Policy that targets a `Gateway` resource. It allows you to define snippets for specific NGINX contexts: `main`, `http`, and `http.server`.
8
+
9
+
> **Warning**: Using snippets can be dangerous. Incorrect snippets can cause NGINX to fail to reload or behave unexpectedly. Use with caution.
10
+
11
+
## Configuration
12
+
13
+
### SnippetsPolicy Spec
14
+
15
+
The `SnippetsPolicy` spec consists of a `targetRef` and a list of `snippets`.
16
+
17
+
-`targetRef`: Specifies the `Gateway` resource to attach the policy to.
18
+
-`snippets`: A list of snippets to inject. Each snippet consists of:
19
+
-`context`: The NGINX context to inject the snippet into. Supported values: `main`, `http`, `http.server`.
20
+
-`value`: The NGINX configuration snippet string.
21
+
22
+
### Validation
23
+
24
+
NGINX Gateway Fabric validates the `SnippetsPolicy` to ensure:
25
+
- Only one snippet is defined per context.
26
+
- The context is one of the supported values.
27
+
- The snippet size does not exceed the limit (4KB).
28
+
29
+
If a snippet is invalid (e.g., contains syntax errors), NGINX might fail to reload. NGINX Gateway Fabric attempts to validate the configuration using `nginx -t` before applying it. If validation fails, the configuration is not applied, and the `SnippetsPolicy` status is updated.
30
+
31
+
## Examples
32
+
33
+
### Basic Usage
34
+
35
+
The following example injects snippets into the `main`, `http`, and `http.server` contexts.
36
+
37
+
```yaml
38
+
apiVersion: gateway.nginx.org/v1alpha1
39
+
kind: SnippetsPolicy
40
+
metadata:
41
+
name: example-snippets-policy
42
+
spec:
43
+
targetRef:
44
+
group: gateway.networking.k8s.io
45
+
kind: Gateway
46
+
name: my-gateway
47
+
snippets:
48
+
- context: main
49
+
value: |
50
+
worker_priority -5;
51
+
- context: http
52
+
value: |
53
+
keepalive_timeout 65;
54
+
- context: http.server
55
+
value: |
56
+
gzip on;
57
+
gzip_types text/plain application/xml;
58
+
```
59
+
60
+
### Enabling the Feature
61
+
62
+
To use `SnippetsPolicy`, you must enable the `snippetsPolicies` feature flag in the NGINX Gateway Fabric configuration.
0 commit comments