diff --git a/charts/nginx-gateway-fabric/README.md b/charts/nginx-gateway-fabric/README.md index c5149900f9..3fb3f6230b 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":{},"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":[]}` | | `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 | `{}` | @@ -308,6 +308,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri | `nginxGateway.metrics.enable` | Enable exposing metrics in the Prometheus format. | bool | `true` | | `nginxGateway.metrics.port` | Set the port where the Prometheus metrics are exposed. | int | `9113` | | `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` | +| `nginxGateway.name` | The name of the NGINX Gateway Fabric deployment - if not present, then by default uses release name given during installation. | string | `""` | | `nginxGateway.nodeSelector` | The nodeSelector of the NGINX Gateway Fabric control plane pod. | object | `{}` | | `nginxGateway.podAnnotations` | Set of custom annotations for the NGINX Gateway Fabric pods. | object | `{}` | | `nginxGateway.productTelemetry.enable` | Enable the collection of product telemetry. | bool | `true` | diff --git a/charts/nginx-gateway-fabric/templates/_helpers.tpl b/charts/nginx-gateway-fabric/templates/_helpers.tpl index 01155eb707..d0c7c50d84 100644 --- a/charts/nginx-gateway-fabric/templates/_helpers.tpl +++ b/charts/nginx-gateway-fabric/templates/_helpers.tpl @@ -2,8 +2,12 @@ Expand the name of the chart. */}} {{- define "nginx-gateway.name" -}} +{{- if .Values.nginxGateway.name }} +{{- .Values.nginxGateway.name | trunc 63 | trimSuffix "-" }} +{{- else }} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} +{{- end }} {{/* 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. {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} +{{- $name := default (include "nginx-gateway.name" .) }} {{- if contains $name .Release.Name }} {{- .Release.Name | trunc 63 | trimSuffix "-" }} {{- else }} @@ -27,7 +31,7 @@ If release name contains chart name it will be used as a full name. Create control plane config name. */}} {{- define "nginx-gateway.config-name" -}} -{{- $name := default .Release.Name .Values.nameOverride }} +{{- $name := .Values.nginxGateway.name | default .Values.nameOverride | default .Release.Name }} {{- printf "%s-config" $name | trunc 63 | trimSuffix "-" }} {{- end }} @@ -35,7 +39,7 @@ Create control plane config name. Create data plane config name. */}} {{- define "nginx-gateway.proxy-config-name" -}} -{{- $name := default .Release.Name .Values.nameOverride }} +{{- $name := .Values.nginxGateway.name | default .Values.nameOverride | default .Release.Name }} {{- printf "%s-proxy-config" $name | trunc 63 | trimSuffix "-" }} {{- end }} @@ -43,7 +47,7 @@ Create data plane config name. Create security context constraints name. */}} {{- define "nginx-gateway.scc-name" -}} -{{- $name := default .Release.Name .Values.nameOverride }} +{{- $name := .Values.nginxGateway.name | default .Values.nameOverride | default .Release.Name }} {{- printf "%s-scc" $name | trunc 63 | trimSuffix "-" }} {{- end }} diff --git a/charts/nginx-gateway-fabric/values.schema.json b/charts/nginx-gateway-fabric/values.schema.json index 5dbb8c0e37..15582052e5 100644 --- a/charts/nginx-gateway-fabric/values.schema.json +++ b/charts/nginx-gateway-fabric/values.schema.json @@ -726,6 +726,13 @@ "title": "metrics", "type": "object" }, + "name": { + "default": "", + "description": "The name of the NGINX Gateway Fabric deployment - if not present, then by default uses release name given during installation.", + "required": [], + "title": "name", + "type": "string" + }, "nodeSelector": { "description": "The nodeSelector of the NGINX Gateway Fabric control plane pod.", "required": [], diff --git a/charts/nginx-gateway-fabric/values.yaml b/charts/nginx-gateway-fabric/values.yaml index 39bdc19ace..82c427fd6b 100644 --- a/charts/nginx-gateway-fabric/values.yaml +++ b/charts/nginx-gateway-fabric/values.yaml @@ -13,6 +13,9 @@ nginxGateway: # -- The kind of the NGINX Gateway Fabric installation - currently, only deployment is supported. kind: deployment + # -- The name of the NGINX Gateway Fabric deployment - if not present, then by default uses release name given during installation. + name: "" + # @schema # required: true # type: string diff --git a/scripts/generate-manifests.sh b/scripts/generate-manifests.sh index ca3e9c2041..c6f0c75442 100755 --- a/scripts/generate-manifests.sh +++ b/scripts/generate-manifests.sh @@ -9,7 +9,7 @@ generate_manifests() { manifest=deploy/${chart}/deploy.yaml mkdir -p deploy/${chart} - helm_parameters="--namespace nginx-gateway --set nameOverride=nginx-gateway --skip-crds" + helm_parameters="--namespace nginx-gateway --set nginxGateway.name=nginx-gateway --skip-crds" if [ "${chart}" == "openshift" ]; then chart="default" helm_parameters="${helm_parameters} --api-versions security.openshift.io/v1/SecurityContextConstraints" diff --git a/tests/Makefile b/tests/Makefile index 89cb350ad5..6db161b3b2 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -165,7 +165,7 @@ delete-gke-cluster: ## Delete the GKE cluster add-local-ip-to-cluster: ## Add local IP to the GKE cluster master-authorized-networks ./scripts/add-local-ip-auth-networks.sh -HELM_PARAMETERS += --set nameOverride=nginx-gateway --set nginx.service.type=ClusterIP --skip-schema-validation +HELM_PARAMETERS += --set nginxGateway.name=nginx-gateway --set nginx.service.type=ClusterIP --skip-schema-validation # this target is used to install the gateway-api CRDs from the main branch (only used in the nightly CI job) # it overrides the target in the main Makefile when the GW_API_VERSION is set to main