Skip to content

Commit f8f5fb7

Browse files
authored
Add nginxGateway.name usage in case of its presence instead of nameOverride (#3528)
1 parent 3e261f3 commit f8f5fb7

File tree

6 files changed

+22
-7
lines changed

6 files changed

+22
-7
lines changed

charts/nginx-gateway-fabric/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
288288
| `nginx.usage.resolver` | The nameserver used to resolve the NGINX Plus usage reporting endpoint. Used with NGINX Instance Manager. | string | `""` |
289289
| `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"` |
290290
| `nginx.usage.skipVerify` | Disable client verification of the NGINX Plus usage reporting server certificate. | bool | `false` |
291-
| `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":[]}` |
291+
| `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},"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":[]}` |
292292
| `nginxGateway.affinity` | The affinity of the NGINX Gateway Fabric control plane pod. | object | `{}` |
293293
| `nginxGateway.config.logging.level` | Log level. | string | `"info"` |
294294
| `nginxGateway.configAnnotations` | Set of custom annotations for NginxGateway objects. | object | `{}` |
@@ -308,6 +308,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
308308
| `nginxGateway.metrics.enable` | Enable exposing metrics in the Prometheus format. | bool | `true` |
309309
| `nginxGateway.metrics.port` | Set the port where the Prometheus metrics are exposed. | int | `9113` |
310310
| `nginxGateway.metrics.secure` | Enable serving metrics via https. By default metrics are served via http. Please note that this endpoint will be secured with a self-signed certificate. | bool | `false` |
311+
| `nginxGateway.name` | The name of the NGINX Gateway Fabric deployment - if not present, then by default uses release name given during installation. | string | `""` |
311312
| `nginxGateway.nodeSelector` | The nodeSelector of the NGINX Gateway Fabric control plane pod. | object | `{}` |
312313
| `nginxGateway.podAnnotations` | Set of custom annotations for the NGINX Gateway Fabric pods. | object | `{}` |
313314
| `nginxGateway.productTelemetry.enable` | Enable the collection of product telemetry. | bool | `true` |

charts/nginx-gateway-fabric/templates/_helpers.tpl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
Expand the name of the chart.
33
*/}}
44
{{- define "nginx-gateway.name" -}}
5+
{{- if .Values.nginxGateway.name }}
6+
{{- .Values.nginxGateway.name | trunc 63 | trimSuffix "-" }}
7+
{{- else }}
58
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
69
{{- end }}
10+
{{- end }}
711

812
{{/*
913
Create a default fully qualified app name.
@@ -14,7 +18,7 @@ If release name contains chart name it will be used as a full name.
1418
{{- if .Values.fullnameOverride }}
1519
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
1620
{{- else }}
17-
{{- $name := default .Chart.Name .Values.nameOverride }}
21+
{{- $name := default (include "nginx-gateway.name" .) }}
1822
{{- if contains $name .Release.Name }}
1923
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
2024
{{- else }}
@@ -27,23 +31,23 @@ If release name contains chart name it will be used as a full name.
2731
Create control plane config name.
2832
*/}}
2933
{{- define "nginx-gateway.config-name" -}}
30-
{{- $name := default .Release.Name .Values.nameOverride }}
34+
{{- $name := .Values.nginxGateway.name | default .Values.nameOverride | default .Release.Name }}
3135
{{- printf "%s-config" $name | trunc 63 | trimSuffix "-" }}
3236
{{- end }}
3337

3438
{{/*
3539
Create data plane config name.
3640
*/}}
3741
{{- define "nginx-gateway.proxy-config-name" -}}
38-
{{- $name := default .Release.Name .Values.nameOverride }}
42+
{{- $name := .Values.nginxGateway.name | default .Values.nameOverride | default .Release.Name }}
3943
{{- printf "%s-proxy-config" $name | trunc 63 | trimSuffix "-" }}
4044
{{- end }}
4145

4246
{{/*
4347
Create security context constraints name.
4448
*/}}
4549
{{- define "nginx-gateway.scc-name" -}}
46-
{{- $name := default .Release.Name .Values.nameOverride }}
50+
{{- $name := .Values.nginxGateway.name | default .Values.nameOverride | default .Release.Name }}
4751
{{- printf "%s-scc" $name | trunc 63 | trimSuffix "-" }}
4852
{{- end }}
4953

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,13 @@
726726
"title": "metrics",
727727
"type": "object"
728728
},
729+
"name": {
730+
"default": "",
731+
"description": "The name of the NGINX Gateway Fabric deployment - if not present, then by default uses release name given during installation.",
732+
"required": [],
733+
"title": "name",
734+
"type": "string"
735+
},
729736
"nodeSelector": {
730737
"description": "The nodeSelector of the NGINX Gateway Fabric control plane pod.",
731738
"required": [],

charts/nginx-gateway-fabric/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ nginxGateway:
1313
# -- The kind of the NGINX Gateway Fabric installation - currently, only deployment is supported.
1414
kind: deployment
1515

16+
# -- The name of the NGINX Gateway Fabric deployment - if not present, then by default uses release name given during installation.
17+
name: ""
18+
1619
# @schema
1720
# required: true
1821
# type: string

scripts/generate-manifests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ generate_manifests() {
99
manifest=deploy/${chart}/deploy.yaml
1010
mkdir -p deploy/${chart}
1111

12-
helm_parameters="--namespace nginx-gateway --set nameOverride=nginx-gateway --skip-crds"
12+
helm_parameters="--namespace nginx-gateway --set nginxGateway.name=nginx-gateway --skip-crds"
1313
if [ "${chart}" == "openshift" ]; then
1414
chart="default"
1515
helm_parameters="${helm_parameters} --api-versions security.openshift.io/v1/SecurityContextConstraints"

tests/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ delete-gke-cluster: ## Delete the GKE cluster
165165
add-local-ip-to-cluster: ## Add local IP to the GKE cluster master-authorized-networks
166166
./scripts/add-local-ip-auth-networks.sh
167167

168-
HELM_PARAMETERS += --set nameOverride=nginx-gateway --set nginx.service.type=ClusterIP --skip-schema-validation
168+
HELM_PARAMETERS += --set nginxGateway.name=nginx-gateway --set nginx.service.type=ClusterIP --skip-schema-validation
169169

170170
# this target is used to install the gateway-api CRDs from the main branch (only used in the nightly CI job)
171171
# it overrides the target in the main Makefile when the GW_API_VERSION is set to main

0 commit comments

Comments
 (0)