Skip to content

Commit 79ccb86

Browse files
committed
Add support for additional service labels to the helm chart
Problem: It's not possible to add extra lables to the nginx gateway service (to select a particular CiliumLoadBalancerIPPool, for example) Solution: Add support for adding extra labels to the nginx gateway service Testing: `helm template ngf charts/nginx-gateway-fabric/ --set service.labels.lb-ip-pool=private -s templates/service.yaml` rendered a service manifest with an extra label `lb-ip-pool=private` as expected
1 parent 5dbbb45 commit 79ccb86

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

charts/nginx-gateway-fabric/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
300300
| `nginxGateway.snippetsFilters.enable` | Enable SnippetsFilters feature. SnippetsFilters allow inserting NGINX configuration into the generated NGINX config for HTTPRoute and GRPCRoute resources. | bool | `false` |
301301
| `nodeSelector` | The nodeSelector of the NGINX Gateway Fabric pod. | object | `{}` |
302302
| `service.annotations` | The annotations of the NGINX Gateway Fabric service. | object | `{}` |
303+
| `service.labels` | The additional labels of the NGINX Gateway Fabric service. | object | `{}` |
303304
| `service.create` | Creates a service to expose the NGINX Gateway Fabric pods. | bool | `true` |
304305
| `service.externalTrafficPolicy` | The externalTrafficPolicy of the service. The value Local preserves the client source IP. | string | `"Local"` |
305306
| `service.loadBalancerIP` | The static IP address for the load balancer. Requires service.type set to LoadBalancer. | string | `""` |

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ metadata:
66
namespace: {{ .Release.Namespace }}
77
labels:
88
{{- include "nginx-gateway.labels" . | nindent 4 }}
9+
{{- with .Values.service.labels }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
912
{{- if .Values.service.annotations }}
1013
annotations:
1114
{{ toYaml .Values.service.annotations | indent 4 }}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,12 @@
604604
"title": "annotations",
605605
"type": "object"
606606
},
607+
"labels": {
608+
"description": "The additional labels of the NGINX Gateway Fabric service.",
609+
"required": [],
610+
"title": "labels",
611+
"type": "object"
612+
},
607613
"create": {
608614
"default": true,
609615
"description": "Creates a service to expose the NGINX Gateway Fabric pods.",

charts/nginx-gateway-fabric/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ service:
330330
# -- The annotations of the NGINX Gateway Fabric service.
331331
annotations: {}
332332

333+
# -- The additional labels of the NGINX Gateway Fabric service.
334+
labels: {}
335+
333336
# -- The static IP address for the load balancer. Requires service.type set to LoadBalancer.
334337
loadBalancerIP: ""
335338

0 commit comments

Comments
 (0)