From 307db64a457c0944ca681ca50ae38109757fc5aa Mon Sep 17 00:00:00 2001 From: Jerome Brown Date: Thu, 2 Nov 2023 08:37:34 +1300 Subject: [PATCH] Helm Chart: Support extra volume mounts (#1193) Problem: No support in the helm chart for mounting additional volumes onto the NGF and NGINX containers. Solution: Add the ability to specify additional volumes and volume mounts to the helm chart. --- deploy/helm-chart/README.md | 3 +++ deploy/helm-chart/templates/deployment.yaml | 9 +++++++++ deploy/helm-chart/values.yaml | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/deploy/helm-chart/README.md b/deploy/helm-chart/README.md index 04a4949086..cfc13c4294 100644 --- a/deploy/helm-chart/README.md +++ b/deploy/helm-chart/README.md @@ -211,6 +211,7 @@ The following tables lists the configurable parameters of the NGINX Gateway Fabr | `nginxGateway.image.tag` | The tag for the NGINX Gateway Fabric image. | edge | | `nginxGateway.image.pullPolicy` | The `imagePullPolicy` for the NGINX Gateway Fabric image. | Always | | `nginxGateway.lifecycle` | The `lifecycle` of the nginx-gateway container. | {} | +| `nginxGateway.extraVolumeMounts` | Extra `volumeMounts` for the nginxGateway container. | {} | | `nginxGateway.gatewayClassName` | The name of the GatewayClass for the NGINX Gateway Fabric deployment. | nginx | | `nginxGateway.gatewayControllerName` | The name of the Gateway controller. The controller name must be of the form: DOMAIN/PATH. The controller's domain is gateway.nginx.org. | gateway.nginx.org/nginx-gateway-controller | | `nginxGateway.kind` | The kind of the NGINX Gateway Fabric installation - currently, only Deployment is supported. | deployment | @@ -225,6 +226,7 @@ The following tables lists the configurable parameters of the NGINX Gateway Fabr | `nginx.image.tag` | The tag for the NGINX image. | edge | | `nginx.image.pullPolicy` | The `imagePullPolicy` for the NGINX image. | Always | | `nginx.lifecycle` | The `lifecycle` of the nginx container. | {} | +| `nginx.extraVolumeMounts` | Extra `volumeMounts` for the nginx container. | {} | | `terminationGracePeriodSeconds` | The termination grace period of the NGINX Gateway Fabric pod. | 30 | | `tolerations` | The `tolerations` of the NGINX Gateway Fabric pod. | [] | | `affinity` | The `affinity` of the NGINX Gateway Fabric pod. | {} | @@ -238,3 +240,4 @@ The following tables lists the configurable parameters of the NGINX Gateway Fabr | `metrics.disable` | Disable exposing metrics in the Prometheus format. | false | | `metrics.port` | Set the port where the Prometheus metrics are exposed. Format: [1024 - 65535] | 9113 | | `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. | false | +| `extraVolumes` | Extra `volumes` for the NGINX Gateway Fabric pod. | [] | diff --git a/deploy/helm-chart/templates/deployment.yaml b/deploy/helm-chart/templates/deployment.yaml index a6a6c50121..44bf1e9b41 100644 --- a/deploy/helm-chart/templates/deployment.yaml +++ b/deploy/helm-chart/templates/deployment.yaml @@ -101,6 +101,9 @@ spec: mountPath: /etc/nginx/secrets - name: nginx-run mountPath: /var/run/nginx + {{- with .Values.nginxGateway.extraVolumeMounts -}} + {{ toYaml . | nindent 8 }} + {{- end }} - image: {{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag | default .Chart.AppVersion }} imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} name: nginx @@ -133,6 +136,9 @@ spec: mountPath: /var/cache/nginx - name: nginx-lib mountPath: /var/lib/nginx + {{- with .Values.nginx.extraVolumeMounts -}} + {{ toYaml . | nindent 8 }} + {{- end }} terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} {{- if .Values.affinity }} affinity: @@ -158,4 +164,7 @@ spec: emptyDir: {} - name: nginx-lib emptyDir: {} + {{- with .Values.extraVolumes -}} + {{ toYaml . | nindent 6 }} + {{- end }} {{- end }} diff --git a/deploy/helm-chart/values.yaml b/deploy/helm-chart/values.yaml index b611a55104..32fdb5db68 100644 --- a/deploy/helm-chart/values.yaml +++ b/deploy/helm-chart/values.yaml @@ -48,6 +48,9 @@ nginxGateway: ## The lifecycle of the nginx-gateway container. lifecycle: {} + ## extraVolumeMounts are the additional volume mounts for the nginx-gateway container. + extraVolumeMounts: [] + nginx: ## The NGINX image to use image: @@ -58,6 +61,9 @@ nginx: ## The lifecycle of the nginx container. lifecycle: {} + ## extraVolumeMounts are the additional volume mounts for the nginx container. + extraVolumeMounts: [] + ## The termination grace period of the NGINX Gateway Fabric pod. terminationGracePeriodSeconds: 30 @@ -103,3 +109,7 @@ metrics: ## 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. secure: false + +## extraVolumes for the NGINX Gateway Fabric pod. Use in conjunction with +## nginxGateway.extraVolumeMounts and nginx.extraVolumeMounts to mount additional volumes to the containers. +extraVolumes: []