From 6dea2c9038fc59cdc7dd1923fd893f964c714f86 Mon Sep 17 00:00:00 2001 From: Filippo Pinton Date: Wed, 5 Mar 2025 00:39:47 +0100 Subject: [PATCH 1/2] Add support for deployment labels to helm chart --- charts/nginx-gateway-fabric/README.md | 1 + charts/nginx-gateway-fabric/templates/deployment.yaml | 6 ++++++ charts/nginx-gateway-fabric/values.schema.json | 6 ++++++ charts/nginx-gateway-fabric/values.yaml | 3 +++ 4 files changed, 16 insertions(+) diff --git a/charts/nginx-gateway-fabric/README.md b/charts/nginx-gateway-fabric/README.md index 94ebb0d247..eb4c9980d1 100644 --- a/charts/nginx-gateway-fabric/README.md +++ b/charts/nginx-gateway-fabric/README.md @@ -285,6 +285,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri | `nginxGateway.image.repository` | The NGINX Gateway Fabric image to use | string | `"ghcr.io/nginx/nginx-gateway-fabric"` | | `nginxGateway.image.tag` | | string | `"edge"` | | `nginxGateway.kind` | The kind of the NGINX Gateway Fabric installation - currently, only deployment is supported. | string | `"deployment"` | +| `nginxGateway.labels` | Labels to be added to the controller Deployment | object | `{}` | | `nginxGateway.leaderElection.enable` | Enable leader election. Leader election is used to avoid multiple replicas of the NGINX Gateway Fabric reporting the status of the Gateway API resources. If not enabled, all replicas of NGINX Gateway Fabric will update the statuses of the Gateway API resources. | bool | `true` | | `nginxGateway.leaderElection.lockName` | The name of the leader election lock. A Lease object with this name will be created in the same Namespace as the controller. | string | Autogenerated if not set or set to "". | | `nginxGateway.lifecycle` | The lifecycle of the nginx-gateway container. | object | `{}` | diff --git a/charts/nginx-gateway-fabric/templates/deployment.yaml b/charts/nginx-gateway-fabric/templates/deployment.yaml index ce727ac027..25d0547f3a 100644 --- a/charts/nginx-gateway-fabric/templates/deployment.yaml +++ b/charts/nginx-gateway-fabric/templates/deployment.yaml @@ -6,6 +6,9 @@ metadata: namespace: {{ .Release.Namespace }} labels: {{- include "nginx-gateway.labels" . | nindent 4 }} + {{- with .Values.nginxGateway.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.nginxGateway.replicaCount }} selector: @@ -15,6 +18,9 @@ spec: metadata: labels: {{- include "nginx-gateway.selectorLabels" . | nindent 8 }} + {{- with .Values.nginxGateway.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- if or .Values.nginxGateway.podAnnotations .Values.metrics.enable }} annotations: {{- if .Values.nginxGateway.podAnnotations }} diff --git a/charts/nginx-gateway-fabric/values.schema.json b/charts/nginx-gateway-fabric/values.schema.json index 73a02d292d..88d412eed5 100644 --- a/charts/nginx-gateway-fabric/values.schema.json +++ b/charts/nginx-gateway-fabric/values.schema.json @@ -456,6 +456,12 @@ "required": [], "title": "kind" }, + "labels": { + "description": "Labels to be added to the controller Deployment", + "required": [], + "title": "labels", + "type": "object" + }, "leaderElection": { "description": "The configuration for leader election.", "properties": { diff --git a/charts/nginx-gateway-fabric/values.yaml b/charts/nginx-gateway-fabric/values.yaml index 2fe06c966c..ecad8444e7 100644 --- a/charts/nginx-gateway-fabric/values.yaml +++ b/charts/nginx-gateway-fabric/values.yaml @@ -21,6 +21,9 @@ nginxGateway: # -- Set of custom annotations for the NGINX Gateway Fabric pods. podAnnotations: {} + # -- Labels to be added to the controller Deployment + labels: {} + # -- Set of custom annotations for GatewayClass objects. gatewayClassAnnotations: {} From 65cd20156d384d24f8c2c1aa1a3eeb838e730bc6 Mon Sep 17 00:00:00 2001 From: Filippo Pinton Date: Thu, 6 Mar 2025 00:53:55 +0100 Subject: [PATCH 2/2] Update nginxGateway.labels field description --- charts/nginx-gateway-fabric/README.md | 2 +- charts/nginx-gateway-fabric/values.schema.json | 2 +- charts/nginx-gateway-fabric/values.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/nginx-gateway-fabric/README.md b/charts/nginx-gateway-fabric/README.md index eb4c9980d1..78aff15c81 100644 --- a/charts/nginx-gateway-fabric/README.md +++ b/charts/nginx-gateway-fabric/README.md @@ -285,7 +285,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri | `nginxGateway.image.repository` | The NGINX Gateway Fabric image to use | string | `"ghcr.io/nginx/nginx-gateway-fabric"` | | `nginxGateway.image.tag` | | string | `"edge"` | | `nginxGateway.kind` | The kind of the NGINX Gateway Fabric installation - currently, only deployment is supported. | string | `"deployment"` | -| `nginxGateway.labels` | Labels to be added to the controller Deployment | object | `{}` | +| `nginxGateway.labels` | Set of labels to be added for NGINX Gateway Fabric deployment. | object | `{}` | | `nginxGateway.leaderElection.enable` | Enable leader election. Leader election is used to avoid multiple replicas of the NGINX Gateway Fabric reporting the status of the Gateway API resources. If not enabled, all replicas of NGINX Gateway Fabric will update the statuses of the Gateway API resources. | bool | `true` | | `nginxGateway.leaderElection.lockName` | The name of the leader election lock. A Lease object with this name will be created in the same Namespace as the controller. | string | Autogenerated if not set or set to "". | | `nginxGateway.lifecycle` | The lifecycle of the nginx-gateway container. | object | `{}` | diff --git a/charts/nginx-gateway-fabric/values.schema.json b/charts/nginx-gateway-fabric/values.schema.json index 88d412eed5..5ef6236304 100644 --- a/charts/nginx-gateway-fabric/values.schema.json +++ b/charts/nginx-gateway-fabric/values.schema.json @@ -457,7 +457,7 @@ "title": "kind" }, "labels": { - "description": "Labels to be added to the controller Deployment", + "description": "Set of labels to be added for NGINX Gateway Fabric deployment.", "required": [], "title": "labels", "type": "object" diff --git a/charts/nginx-gateway-fabric/values.yaml b/charts/nginx-gateway-fabric/values.yaml index ecad8444e7..c817fb76b7 100644 --- a/charts/nginx-gateway-fabric/values.yaml +++ b/charts/nginx-gateway-fabric/values.yaml @@ -21,7 +21,7 @@ nginxGateway: # -- Set of custom annotations for the NGINX Gateway Fabric pods. podAnnotations: {} - # -- Labels to be added to the controller Deployment + # -- Set of labels to be added for NGINX Gateway Fabric deployment. labels: {} # -- Set of custom annotations for GatewayClass objects.