Skip to content

Commit 550c8f6

Browse files
authored
Add possibility to provide custom pod annotations (#2250)
Problem: Currently the helm chart does not provide an option to configure custom annotations for the nginx-gateway-fabric pod(s). In our scenario, this is inconvenient because the pre-configured annotations Prometheus specific, but we are using Grafana Alloy to scrape metrics and Alloy is expecting different annotations. Of course there are also other scenarios where custom annotations can be useful, for instance to configure exceptions for Gatekeeper policies. Solution: This Pull Request adds the possibility to configure your own custom annotations which will be added to the nginx-gateway-fabric pods.
1 parent 365a683 commit 550c8f6

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

charts/nginx-gateway-fabric/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
285285
| `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` |
286286
| `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 "". |
287287
| `nginxGateway.lifecycle` | The lifecycle of the nginx-gateway container. | object | `{}` |
288+
| `nginxGateway.podAnnotations` | Set of custom annotations for the NGINX Gateway Fabric pods. | object | `{}` |
288289
| `nginxGateway.productTelemetry.enable` | Enable the collection of product telemetry. | bool | `true` |
289290
| `nginxGateway.readinessProbe.enable` | Enable the /readyz endpoint on the control plane. | bool | `true` |
290291
| `nginxGateway.readinessProbe.initialDelaySeconds` | The number of seconds after the Pod has started before the readiness probes are initiated. | int | `3` |

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ spec:
1515
metadata:
1616
labels:
1717
{{- include "nginx-gateway.selectorLabels" . | nindent 8 }}
18-
{{- if .Values.metrics.enable }}
18+
{{- if or .Values.nginxGateway.podAnnotations .Values.metrics.enable }}
1919
annotations:
20+
{{- if .Values.nginxGateway.podAnnotations }}
21+
{{- toYaml .Values.nginxGateway.podAnnotations | nindent 8 }}
22+
{{- end }}
23+
{{- if .Values.metrics.enable }}
2024
prometheus.io/scrape: "true"
2125
prometheus.io/port: "{{ .Values.metrics.port }}"
2226
{{- if .Values.metrics.secure }}
2327
prometheus.io/scheme: "https"
2428
{{- end }}
29+
{{- end }}
2530
{{- end }}
2631
spec:
2732
containers:

charts/nginx-gateway-fabric/values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ nginxGateway:
77
# belong to its class - i.e. have the "gatewayClassName" field resource equal to the class.
88
gatewayClassName: nginx
99

10+
# -- Set of custom annotations for the NGINX Gateway Fabric pods.
11+
podAnnotations: {}
12+
1013
# -- Set of custom annotations for GatewayClass objects.
1114
gatewayClassAnnotations: {}
1215

0 commit comments

Comments
 (0)