Skip to content

Commit 0925904

Browse files
authored
Add patches to helm chart spec (#3773) (#3777)
Problem: Users want a way to specify patches for service , deployment and daemonSet in the helm chart spec Solution: Added patches field in helm chart spec
1 parent f72ddc9 commit 0925904

File tree

4 files changed

+48
-2
lines changed

4 files changed

+48
-2
lines changed

charts/nginx-gateway-fabric/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
264264
| `certGenerator.ttlSecondsAfterFinished` | How long to wait after the cert generator job has finished before it is removed by the job controller. | int | `30` |
265265
| `clusterDomain` | The DNS cluster domain of your Kubernetes cluster. | string | `"cluster.local"` |
266266
| `gateways` | A list of Gateway objects. View https://gateway-api.sigs.k8s.io/reference/spec/#gateway for full Gateway reference. | list | `[]` |
267-
| `nginx` | The nginx section contains the configuration for all NGINX data plane deployments installed by the NGINX Gateway Fabric control plane. | object | `{"autoscaling":{"enable":false},"config":{},"container":{"hostPorts":[],"lifecycle":{},"readinessProbe":{},"resources":{},"volumeMounts":[]},"debug":false,"image":{"pullPolicy":"IfNotPresent","repository":"ghcr.io/nginx/nginx-gateway-fabric/nginx","tag":"2.1.0"},"imagePullSecret":"","imagePullSecrets":[],"kind":"deployment","nginxOneConsole":{"dataplaneKeySecretName":"","endpointHost":"agent.connect.nginx.com","endpointPort":443,"skipVerify":false},"plus":false,"pod":{},"replicas":1,"service":{"externalTrafficPolicy":"Local","loadBalancerClass":"","loadBalancerIP":"","loadBalancerSourceRanges":[],"nodePorts":[],"type":"LoadBalancer"},"usage":{"caSecretName":"","clientSSLSecretName":"","endpoint":"","resolver":"","secretName":"nplus-license","skipVerify":false}}` |
267+
| `nginx` | The nginx section contains the configuration for all NGINX data plane deployments installed by the NGINX Gateway Fabric control plane. | object | `{"autoscaling":{"enable":false},"config":{},"container":{"hostPorts":[],"lifecycle":{},"readinessProbe":{},"resources":{},"volumeMounts":[]},"debug":false,"image":{"pullPolicy":"IfNotPresent","repository":"ghcr.io/nginx/nginx-gateway-fabric/nginx","tag":"2.1.0"},"imagePullSecret":"","imagePullSecrets":[],"kind":"deployment","nginxOneConsole":{"dataplaneKeySecretName":"","endpointHost":"agent.connect.nginx.com","endpointPort":443,"skipVerify":false},"patches":[],"plus":false,"pod":{},"replicas":1,"service":{"externalTrafficPolicy":"Local","loadBalancerClass":"","loadBalancerIP":"","loadBalancerSourceRanges":[],"nodePorts":[],"patches":[],"type":"LoadBalancer"},"usage":{"caSecretName":"","clientSSLSecretName":"","endpoint":"","resolver":"","secretName":"nplus-license","skipVerify":false}}` |
268268
| `nginx.autoscaling` | Autoscaling configuration for the NGINX data plane. | object | `{"enable":false}` |
269269
| `nginx.autoscaling.enable` | Enable or disable Horizontal Pod Autoscaler for the NGINX data plane. | bool | `false` |
270270
| `nginx.config` | The configuration for the data plane that is contained in the NginxProxy resource. This is applied globally to all Gateways managed by this instance of NGINX Gateway Fabric. | object | `{}` |
@@ -283,15 +283,17 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
283283
| `nginx.nginxOneConsole.endpointHost` | The Endpoint host that the NGINX One Console telemetry metrics will be sent to. | string | `"agent.connect.nginx.com"` |
284284
| `nginx.nginxOneConsole.endpointPort` | The endpoint port that the NGINX One Console telemetry metrics will be sent to. | int | `443` |
285285
| `nginx.nginxOneConsole.skipVerify` | Skip TLS verification for NGINX One Console connections. | bool | `false` |
286+
| `nginx.patches` | Custom patches to apply to the NGINX Deployment/DaemonSet. | list | `[]` |
286287
| `nginx.plus` | Is NGINX Plus image being used. | bool | `false` |
287288
| `nginx.pod` | The pod configuration for the NGINX data plane pod. This is applied globally to all Gateways managed by this instance of NGINX Gateway Fabric. | object | `{}` |
288289
| `nginx.replicas` | The number of replicas of the NGINX Deployment. This value is ignored if autoscaling.enable is true. | int | `1` |
289-
| `nginx.service` | The service configuration for the NGINX data plane. This is applied globally to all Gateways managed by this instance of NGINX Gateway Fabric. | object | `{"externalTrafficPolicy":"Local","loadBalancerClass":"","loadBalancerIP":"","loadBalancerSourceRanges":[],"nodePorts":[],"type":"LoadBalancer"}` |
290+
| `nginx.service` | The service configuration for the NGINX data plane. This is applied globally to all Gateways managed by this instance of NGINX Gateway Fabric. | object | `{"externalTrafficPolicy":"Local","loadBalancerClass":"","loadBalancerIP":"","loadBalancerSourceRanges":[],"nodePorts":[],"patches":[],"type":"LoadBalancer"}` |
290291
| `nginx.service.externalTrafficPolicy` | The externalTrafficPolicy of the service. The value Local preserves the client source IP. | string | `"Local"` |
291292
| `nginx.service.loadBalancerClass` | LoadBalancerClass is the class of the load balancer implementation this Service belongs to. Requires nginx.service.type set to LoadBalancer. | string | `""` |
292293
| `nginx.service.loadBalancerIP` | The static IP address for the load balancer. Requires nginx.service.type set to LoadBalancer. | string | `""` |
293294
| `nginx.service.loadBalancerSourceRanges` | The IP ranges (CIDR) that are allowed to access the load balancer. Requires nginx.service.type set to LoadBalancer. | list | `[]` |
294295
| `nginx.service.nodePorts` | A list of NodePorts to expose on the NGINX data plane service. Each NodePort MUST map to a Gateway listener port, otherwise it will be ignored. The default NodePort range enforced by Kubernetes is 30000-32767. | list | `[]` |
296+
| `nginx.service.patches` | Custom patches to apply to the NGINX Service. | list | `[]` |
295297
| `nginx.service.type` | The type of service to create for the NGINX data plane. | string | `"LoadBalancer"` |
296298
| `nginx.usage.caSecretName` | The name of the Secret containing the NGINX Instance Manager CA certificate. Must exist in the same namespace that the NGINX Gateway Fabric control plane is running in (default namespace: nginx-gateway). | string | `""` |
297299
| `nginx.usage.clientSSLSecretName` | The name of the Secret containing the client certificate and key for authenticating with NGINX Instance Manager. Must exist in the same namespace that the NGINX Gateway Fabric control plane is running in (default namespace: nginx-gateway). | string | `""` |

charts/nginx-gateway-fabric/templates/nginxproxy.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ spec:
5353
{{- if .Values.nginx.debug }}
5454
debug: {{ .Values.nginx.debug }}
5555
{{- end }}
56+
{{- if .Values.nginx.patches }}
57+
patches:
58+
{{- toYaml .Values.nginx.patches | nindent 8 }}
59+
{{- end }}
5660
{{- end }}
5761
{{- if eq .Values.nginx.kind "daemonSet" }}
5862
daemonSet:
@@ -72,6 +76,10 @@ spec:
7276
{{- if .Values.nginx.debug }}
7377
debug: {{ .Values.nginx.debug }}
7478
{{- end }}
79+
{{- if .Values.nginx.patches }}
80+
patches:
81+
{{- toYaml .Values.nginx.patches | nindent 8 }}
82+
{{- end }}
7583
{{- end }}
7684
{{- if .Values.nginx.service }}
7785
service:

charts/nginx-gateway-fabric/values.schema.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,15 @@
498498
"title": "nginxOneConsole",
499499
"type": "object"
500500
},
501+
"patches": {
502+
"description": "Custom patches to apply to the NGINX Deployment/DaemonSet.",
503+
"items": {
504+
"required": []
505+
},
506+
"required": [],
507+
"title": "patches",
508+
"type": "array"
509+
},
501510
"plus": {
502511
"default": false,
503512
"description": "Is NGINX Plus image being used.",
@@ -578,6 +587,15 @@
578587
"title": "nodePorts",
579588
"type": "array"
580589
},
590+
"patches": {
591+
"description": "Custom patches to apply to the NGINX Service.",
592+
"items": {
593+
"required": []
594+
},
595+
"required": [],
596+
"title": "patches",
597+
"type": "array"
598+
},
581599
"type": {
582600
"default": "LoadBalancer",
583601
"description": "The type of service to create for the NGINX data plane.",

charts/nginx-gateway-fabric/values.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,15 @@ nginx:
229229
# -- The number of replicas of the NGINX Deployment. This value is ignored if autoscaling.enable is true.
230230
replicas: 1
231231

232+
# -- Custom patches to apply to the NGINX Deployment/DaemonSet.
233+
patches: []
234+
# -- Example:
235+
# - type: StrategicMerge
236+
# value:
237+
# metadata:
238+
# labels:
239+
# team: "nginx-gateway-fabric"
240+
232241
# -- Autoscaling configuration for the NGINX data plane.
233242
autoscaling:
234243
# -- Enable or disable Horizontal Pod Autoscaler for the NGINX data plane.
@@ -592,6 +601,15 @@ nginx:
592601
# - port: 30025
593602
# listenerPort: 80
594603

604+
# -- Custom patches to apply to the NGINX Service.
605+
patches: []
606+
# -- Example:
607+
# - type: JSONPatch
608+
# value:
609+
# - op: replace
610+
# path: /spec/sessionAffinity
611+
# value: "ClientIP"
612+
595613
# -- Enable debugging for NGINX. Uses the nginx-debug binary. The NGINX error log level should be set to debug in the NginxProxy resource.
596614
debug: false
597615

0 commit comments

Comments
 (0)