Skip to content

Commit 27ba55e

Browse files
committed
Clean up and fix templates
1 parent 3574a4c commit 27ba55e

File tree

19 files changed

+616
-516
lines changed

19 files changed

+616
-516
lines changed

apis/v1alpha2/nginxproxy_types.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,7 @@ type DaemonSetSpec struct {
477477

478478
// HPASpec is the configuration for the Horizontal Pod Autoscaling.
479479
//
480-
// +kubebuilder:validation:XValidation:message="at least one metric must be specified when autoscaling is enabled",rule="!self.enable || (has(self.targetCPUUtilizationPercentage) || has(self.targetMemoryUtilizationPercentage) || (has(self.autoscalingTemplate) && size(self.autoscalingTemplate) > 0))"
481-
// +kubebuilder:validation:XValidation:message="minReplicas must be less than or equal to maxReplicas",rule="self.minReplicas <= self.maxReplicas"
480+
// +kubebuilder:validation:XValidation:message="minReplicas must be less than or equal to maxReplicas",rule="(!has(self.minReplicas)) || (self.minReplicas <= self.maxReplicas)"
482481
//
483482
//nolint:lll
484483
type HPASpec struct {
@@ -509,10 +508,10 @@ type HPASpec struct {
509508
// +kubebuilder:validation:Minimum=1
510509
MinReplicas *int32 `json:"minReplicas,omitempty"`
511510

512-
// AutoscalingTemplate configures the additional scaling option.
511+
// Templates configures additional metrics options.
513512
//
514513
// +optional
515-
AutoscalingTemplate []autoscalingv2.MetricSpec `json:"autoscalingTemplate,omitempty"`
514+
Templates []autoscalingv2.MetricSpec `json:"templates,omitempty"`
516515

517516
// Maximum number of replicas.
518517
//

apis/v1alpha2/zz_generated.deepcopy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/nginx-gateway-fabric/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ 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":"Always","repository":"ghcr.io/nginx/nginx-gateway-fabric/nginx","tag":"edge"},"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}}` |
268-
| `nginx.autoscaling` | Autoscaling configuration for the NGINX data plane. | object | `{"enable":false}` |
269-
| `nginx.autoscaling.enable` | Enable or disable Horizontal Pod Autoscaler for the NGINX data plane. | bool | `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":true,"maxReplicas":11},"config":{},"container":{"hostPorts":[],"lifecycle":{},"readinessProbe":{},"resources":{},"volumeMounts":[]},"debug":false,"image":{"pullPolicy":"Always","repository":"ghcr.io/nginx/nginx-gateway-fabric/nginx","tag":"edge"},"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}}` |
268+
| `nginx.autoscaling` | Autoscaling configuration for the NGINX data plane. | object | `{"enable":true,"maxReplicas":11}` |
269+
| `nginx.autoscaling.enable` | Enable or disable Horizontal Pod Autoscaler for the NGINX data plane. | bool | `true` |
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 | `{}` |
271271
| `nginx.container` | The container configuration for the NGINX container. This is applied globally to all Gateways managed by this instance of NGINX Gateway Fabric. | object | `{"hostPorts":[],"lifecycle":{},"readinessProbe":{},"resources":{},"volumeMounts":[]}` |
272272
| `nginx.container.hostPorts` | A list of HostPorts to expose on the host. This configuration allows containers to bind to a specific port on the host node, enabling external network traffic to reach the container directly through the host's IP address and port. Use this option when you need to expose container ports on the host for direct access, such as for debugging, legacy integrations, or when NodePort/LoadBalancer services are not suitable. Note: Using hostPort may have security and scheduling implications, as it ties pods to specific nodes and ports. | list | `[]` |
@@ -299,10 +299,10 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
299299
| `nginx.usage.resolver` | The nameserver used to resolve the NGINX Plus usage reporting endpoint. Used with NGINX Instance Manager. | string | `""` |
300300
| `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"` |
301301
| `nginx.usage.skipVerify` | Disable client verification of the NGINX Plus usage reporting server certificate. | bool | `false` |
302-
| `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},"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":[]}` |
302+
| `nginxGateway` | The nginxGateway section contains configuration for the NGINX Gateway Fabric control plane deployment. | object | `{"affinity":{},"autoscaling":{"enable":true,"maxReplicas":11},"config":{"logging":{"level":"info"}},"configAnnotations":{},"extraVolumeMounts":[],"extraVolumes":[],"gatewayClassAnnotations":{},"gatewayClassName":"nginx","gatewayControllerName":"gateway.nginx.org/nginx-gateway-controller","gwAPIExperimentalFeatures":{"enable":false},"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":[]}` |
303303
| `nginxGateway.affinity` | The affinity of the NGINX Gateway Fabric control plane pod. | object | `{}` |
304-
| `nginxGateway.autoscaling` | Autoscaling configuration for the NGINX Gateway Fabric control plane. | object | `{"enable":false}` |
305-
| `nginxGateway.autoscaling.enable` | Enable or disable Horizontal Pod Autoscaler for the control plane. | bool | `false` |
304+
| `nginxGateway.autoscaling` | Autoscaling configuration for the NGINX Gateway Fabric control plane. | object | `{"enable":true,"maxReplicas":11}` |
305+
| `nginxGateway.autoscaling.enable` | Enable or disable Horizontal Pod Autoscaler for the control plane. | bool | `true` |
306306
| `nginxGateway.config.logging.level` | Log level. | string | `"info"` |
307307
| `nginxGateway.configAnnotations` | Set of custom annotations for NginxGateway objects. | object | `{}` |
308308
| `nginxGateway.extraVolumeMounts` | extraVolumeMounts are the additional volume mounts for the nginx-gateway container. | list | `[]` |

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ spec:
3838
type: Utilization
3939
averageUtilization: {{ . }}
4040
{{- end }}
41-
{{- with .Values.nginxGateway.autoscalingTemplate }}
41+
{{- with .Values.nginxGateway.autoscaling.templates }}
4242
{{- toYaml . | nindent 2 }}
4343
{{- end }}
4444
{{- with .Values.nginxGateway.autoscaling.behavior }}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ spec:
3232
behavior:
3333
{{- toYaml .Values.nginx.autoscaling.behavior | nindent 10 }}
3434
{{- end }}
35-
{{- if .Values.nginx.autoscalingTemplate }}
36-
autoscalingTemplate:
37-
{{- toYaml .Values.nginx.autoscalingTemplate | nindent 8 }}
35+
{{- if .Values.nginx.autoscaling.templates }}
36+
templates:
37+
{{- toYaml .Values.nginx.autoscaling.templates | nindent 8 }}
3838
{{- end }}
3939
{{- end }}
4040
{{- if .Values.nginx.pod }}

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,18 @@
102102
"description": "Autoscaling configuration for the NGINX data plane.",
103103
"properties": {
104104
"enable": {
105-
"default": false,
105+
"default": true,
106106
"description": "Enable or disable Horizontal Pod Autoscaler for the NGINX data plane.",
107107
"required": [],
108108
"title": "enable",
109109
"type": "boolean"
110+
},
111+
"maxReplicas": {
112+
"default": 11,
113+
"description": "minReplicas: 1",
114+
"required": [],
115+
"title": "maxReplicas",
116+
"type": "integer"
110117
}
111118
},
112119
"required": [],
@@ -662,11 +669,18 @@
662669
"description": "Autoscaling configuration for the NGINX Gateway Fabric control plane.",
663670
"properties": {
664671
"enable": {
665-
"default": false,
672+
"default": true,
666673
"description": "Enable or disable Horizontal Pod Autoscaler for the control plane.",
667674
"required": [],
668675
"title": "enable",
669676
"type": "boolean"
677+
},
678+
"maxReplicas": {
679+
"default": 11,
680+
"description": "annotations: {}\nminReplicas: 1",
681+
"required": [],
682+
"title": "maxReplicas",
683+
"type": "integer"
670684
}
671685
},
672686
"required": [],

charts/nginx-gateway-fabric/values.yaml

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ nginxGateway:
160160
# -- Autoscaling configuration for the NGINX Gateway Fabric control plane.
161161
autoscaling:
162162
# -- Enable or disable Horizontal Pod Autoscaler for the control plane.
163-
enable: false
163+
enable: true
164164
# annotations: {}
165165
# minReplicas: 1
166-
# maxReplicas: 11
166+
maxReplicas: 11
167167
# targetCPUUtilizationPercentage: 50
168168
# targetMemoryUtilizationPercentage: 50
169169
# behavior: {}
@@ -179,16 +179,15 @@ nginxGateway:
179179
# - type: Pods
180180
# value: 2
181181
# periodSeconds: 60
182-
# Custom or additional autoscaling metrics
183-
# autoscalingTemplate: []
184-
# ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics
185-
# - type: Pods
186-
# pods:
187-
# metric:
188-
# name: container_memory_usage_bytes
189-
# target:
190-
# type: AverageValue
191-
# averageValue: "400Mi"
182+
# Custom or additional autoscaling metrics. https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics
183+
# templates: []
184+
# - type: Pods
185+
# pods:
186+
# metric:
187+
# name: container_memory_usage_bytes
188+
# target:
189+
# type: AverageValue
190+
# averageValue: "400Mi"
192191

193192
metrics:
194193
# -- Enable exposing metrics in the Prometheus format.
@@ -233,9 +232,9 @@ nginx:
233232
# -- Autoscaling configuration for the NGINX data plane.
234233
autoscaling:
235234
# -- Enable or disable Horizontal Pod Autoscaler for the NGINX data plane.
236-
enable: false
235+
enable: true
237236
# minReplicas: 1
238-
# maxReplicas: 11
237+
maxReplicas: 11
239238
# targetCPUUtilizationPercentage: 50
240239
# targetMemoryUtilizationPercentage: 50
241240
# behavior: {}
@@ -251,16 +250,15 @@ nginx:
251250
# - type: Pods
252251
# value: 2
253252
# periodSeconds: 60
254-
# Custom or additional autoscaling metrics
255-
# autoscalingTemplate: []
256-
# ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics
257-
# - type: Pods
258-
# pods:
259-
# metric:
260-
# name: nginx_gateway_fabric_nginx_process_requests_total
261-
# target:
262-
# type: nginx_http_requests_total
263-
# averageValue: 400
253+
# Custom or additional autoscaling metrics. https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics
254+
# templates: []
255+
# - type: Pods
256+
# pods:
257+
# metric:
258+
# name: nginx_gateway_fabric_nginx_process_requests_total
259+
# target:
260+
# type: AverageValue
261+
# averageValue: 400
264262
image:
265263
# -- The NGINX image to use.
266264
repository: ghcr.io/nginx/nginx-gateway-fabric/nginx

0 commit comments

Comments
 (0)