From 886430dd4274733f93defe511ba87d9735ef6407 Mon Sep 17 00:00:00 2001 From: nowjean Date: Sat, 14 Jun 2025 10:12:13 +0900 Subject: [PATCH 1/2] add: nginxGateway HPA --- charts/nginx-gateway-fabric/templates/hpa.yaml | 12 ++++++------ charts/nginx-gateway-fabric/values.yaml | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/charts/nginx-gateway-fabric/templates/hpa.yaml b/charts/nginx-gateway-fabric/templates/hpa.yaml index eec64e3d8a..2835eeff9f 100644 --- a/charts/nginx-gateway-fabric/templates/hpa.yaml +++ b/charts/nginx-gateway-fabric/templates/hpa.yaml @@ -2,7 +2,7 @@ apiVersion: {{ ternary "autoscaling/v2" "autoscaling/v2beta2" (.Capabilities.APIVersions.Has "autoscaling/v2") }} kind: HorizontalPodAutoscaler metadata: - {{- with .Values.autoscaling.annotations }} + {{- with .Values.nginxGateway.autoscaling.annotations }} annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: @@ -17,10 +17,10 @@ spec: apiVersion: apps/v1 kind: Deployment name: {{ include "nginx-gateway.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} + minReplicas: {{ .Values.nginxGateway.autoscaling.minReplicas }} + maxReplicas: {{ .Values.nginxGateway.autoscaling.maxReplicas }} metrics: - {{- with .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- with .Values.nginxGateway.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory @@ -28,7 +28,7 @@ spec: type: Utilization averageUtilization: {{ . }} {{- end }} - {{- with .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- with .Values.nginxGateway.autoscaling.targetCPUUtilizationPercentage }} - type: Resource resource: name: cpu @@ -39,7 +39,7 @@ spec: {{- with .Values.autoscalingTemplate }} {{- toYaml . | nindent 2 }} {{- end }} - {{- with .Values.autoscaling.behavior }} + {{- with .Values.nginxGateway.autoscaling.behavior }} behavior: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/nginx-gateway-fabric/values.yaml b/charts/nginx-gateway-fabric/values.yaml index 3d6337241c..9b1d59cc6d 100644 --- a/charts/nginx-gateway-fabric/values.yaml +++ b/charts/nginx-gateway-fabric/values.yaml @@ -157,6 +157,7 @@ nginxGateway: topologySpreadConstraints: [] autoscaling: + # Enable or disable Horizontal Pod Autoscaler enabled: false annotations: {} minReplicas: 1 @@ -252,8 +253,6 @@ nginx: # plane will copy these secrets into any namespace where NGINX is deployed. imagePullSecrets: [] - resources: {} - # Configuration for NGINX Plus usage reporting. usage: # -- The name of the Secret containing the JWT for NGINX Plus usage reporting. Must exist in the same namespace From d081d685137024611bef2192dd619e58b14e95c2 Mon Sep 17 00:00:00 2001 From: nowjean Date: Sat, 14 Jun 2025 10:16:28 +0900 Subject: [PATCH 2/2] add: nginxGateway HPA --- charts/nginx-gateway-fabric/README.md | 2 +- .../nginx-gateway-fabric/values.schema.json | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/charts/nginx-gateway-fabric/README.md b/charts/nginx-gateway-fabric/README.md index c5149900f9..00c2183198 100644 --- a/charts/nginx-gateway-fabric/README.md +++ b/charts/nginx-gateway-fabric/README.md @@ -288,7 +288,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri | `nginx.usage.resolver` | The nameserver used to resolve the NGINX Plus usage reporting endpoint. Used with NGINX Instance Manager. | string | `""` | | `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"` | | `nginx.usage.skipVerify` | Disable client verification of the NGINX Plus usage reporting server certificate. | bool | `false` | -| `nginxGateway` | The nginxGateway section contains configuration for the NGINX Gateway Fabric control plane deployment. | object | `{"affinity":{},"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},"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":[]}` | +| `nginxGateway` | The nginxGateway section contains configuration for the NGINX Gateway Fabric control plane deployment. | object | `{"affinity":{},"autoscaling":{"annotations":{},"behavior":{},"enabled":false,"maxReplicas":11,"minReplicas":1,"targetCPUUtilizationPercentage":50,"targetMemoryUtilizationPercentage":50},"autoscalingTemplate":[],"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},"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":[]}` | | `nginxGateway.affinity` | The affinity of the NGINX Gateway Fabric control plane pod. | object | `{}` | | `nginxGateway.config.logging.level` | Log level. | string | `"info"` | | `nginxGateway.configAnnotations` | Set of custom annotations for NginxGateway objects. | object | `{}` | diff --git a/charts/nginx-gateway-fabric/values.schema.json b/charts/nginx-gateway-fabric/values.schema.json index 5dbb8c0e37..20ae6aaa3d 100644 --- a/charts/nginx-gateway-fabric/values.schema.json +++ b/charts/nginx-gateway-fabric/values.schema.json @@ -540,6 +540,62 @@ "title": "affinity", "type": "object" }, + "autoscaling": { + "properties": { + "annotations": { + "required": [], + "title": "annotations", + "type": "object" + }, + "behavior": { + "required": [], + "title": "behavior", + "type": "object" + }, + "enabled": { + "default": false, + "description": "Enable or disable Horizontal Pod Autoscaler", + "required": [], + "title": "enabled", + "type": "boolean" + }, + "maxReplicas": { + "default": 11, + "required": [], + "title": "maxReplicas", + "type": "integer" + }, + "minReplicas": { + "default": 1, + "required": [], + "title": "minReplicas", + "type": "integer" + }, + "targetCPUUtilizationPercentage": { + "default": 50, + "required": [], + "title": "targetCPUUtilizationPercentage", + "type": "integer" + }, + "targetMemoryUtilizationPercentage": { + "default": 50, + "required": [], + "title": "targetMemoryUtilizationPercentage", + "type": "integer" + } + }, + "required": [], + "title": "autoscaling", + "type": "object" + }, + "autoscalingTemplate": { + "items": { + "required": [] + }, + "required": [], + "title": "autoscalingTemplate", + "type": "array" + }, "config": { "description": "The dynamic configuration for the control plane that is contained in the NginxGateway resource.", "properties": {