From e35efd3ca97e833e3bde1c1b6feca841cbf6f6ac Mon Sep 17 00:00:00 2001 From: Aaron Shiels Date: Wed, 30 Nov 2022 12:48:04 -0800 Subject: [PATCH] Add support for custom environment variables on the Nginx Controller container --- deployments/helm-chart/README.md | 1 + .../helm-chart/templates/controller-daemonset.yaml | 3 +++ .../helm-chart/templates/controller-deployment.yaml | 3 +++ deployments/helm-chart/values.schema.json | 11 +++++++++++ deployments/helm-chart/values.yaml | 5 +++++ docs/content/installation/installation-with-helm.md | 1 + 6 files changed, 24 insertions(+) diff --git a/deployments/helm-chart/README.md b/deployments/helm-chart/README.md index e1bb7ee7e2..4eba228fc0 100644 --- a/deployments/helm-chart/README.md +++ b/deployments/helm-chart/README.md @@ -178,6 +178,7 @@ Parameter | Description | Default `controller.tolerations` | The tolerations of the Ingress Controller pods. | [] `controller.affinity` | The affinity of the Ingress Controller pods. | {} `controller.topologySpreadConstraints` | The topology spread constraints of the Ingress controller pods. | {} +`controller.env` | The additional environment variables to be set on the Ingress Controller pods. | [] `controller.volumes` | The volumes of the Ingress Controller pods. | [] `controller.volumeMounts` | The volumeMounts of the Ingress Controller pods. | [] `controller.initContainers` | InitContainers for the Ingress Controller pods. | [] diff --git a/deployments/helm-chart/templates/controller-daemonset.yaml b/deployments/helm-chart/templates/controller-daemonset.yaml index 30a864d878..a1e4492cf2 100644 --- a/deployments/helm-chart/templates/controller-daemonset.yaml +++ b/deployments/helm-chart/templates/controller-daemonset.yaml @@ -136,6 +136,9 @@ spec: valueFrom: fieldRef: fieldPath: metadata.name +{{- if .Values.controller.env }} +{{ toYaml .Values.controller.env | indent 8 }} +{{- end }} {{- if .Values.nginxServiceMesh.enable }} - name: POD_SERVICEACCOUNT valueFrom: diff --git a/deployments/helm-chart/templates/controller-deployment.yaml b/deployments/helm-chart/templates/controller-deployment.yaml index 282e25583d..cb096e2694 100644 --- a/deployments/helm-chart/templates/controller-deployment.yaml +++ b/deployments/helm-chart/templates/controller-deployment.yaml @@ -141,6 +141,9 @@ spec: valueFrom: fieldRef: fieldPath: metadata.name +{{- if .Values.controller.env }} +{{ toYaml .Values.controller.env | indent 8 }} +{{- end }} {{- if .Values.nginxServiceMesh.enable }} - name: POD_SERVICEACCOUNT valueFrom: diff --git a/deployments/helm-chart/values.schema.json b/deployments/helm-chart/values.schema.json index b37baec07b..3323b874d2 100644 --- a/deployments/helm-chart/values.schema.json +++ b/deployments/helm-chart/values.schema.json @@ -460,6 +460,15 @@ "title": "The topologySpreadConstraints Schema", "$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.25.4/_definitions.json#/definitions/io.k8s.api.core.v1.TopologySpreadConstraint" }, + "env": { + "type": "array", + "default": [], + "title": "The env Schema", + "items": { + "type": "object", + "$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.25.4/_definitions.json#/definitions/io.k8s.api.core.v1.EnvVar" + } + }, "volumes": { "type": "array", "default": [], @@ -1276,6 +1285,7 @@ "tolerations": [], "affinity": {}, "topologySpreadConstraints": {}, + "env": [], "volumes": [], "volumeMounts": [], "initContainers": [], @@ -1576,6 +1586,7 @@ "tolerations": [], "affinity": {}, "topologySpreadConstraints": {}, + "env": [], "volumes": [], "volumeMounts": [], "initContainers": [], diff --git a/deployments/helm-chart/values.yaml b/deployments/helm-chart/values.yaml index ea94d6d11a..ee2fbf5090 100644 --- a/deployments/helm-chart/values.yaml +++ b/deployments/helm-chart/values.yaml @@ -153,6 +153,11 @@ controller: ## The topology spread constraints of the Ingress controller pods. # topologySpreadConstraints: {} + ## The additional environment variables to be set on the Ingress Controller pods. + env: [] + # - name: MY_VAR + # value: myvalue + ## The volumes of the Ingress Controller pods. volumes: [] # - name: extra-conf diff --git a/docs/content/installation/installation-with-helm.md b/docs/content/installation/installation-with-helm.md index 1215045427..538fdcaab6 100644 --- a/docs/content/installation/installation-with-helm.md +++ b/docs/content/installation/installation-with-helm.md @@ -177,6 +177,7 @@ The following tables lists the configurable parameters of the NGINX Ingress Cont |``controller.terminationGracePeriodSeconds`` | The termination grace period of the Ingress Controller pod. | 30 | |``controller.tolerations`` | The tolerations of the Ingress Controller pods. | [] | |``controller.affinity`` | The affinity of the Ingress Controller pods. | {} | +|``controller.env`` | The additional environment variables to be set on the Ingress Controller pods. | [] |``controller.volumes`` | The volumes of the Ingress Controller pods. | [] | |``controller.volumeMounts`` | The volumeMounts of the Ingress Controller pods. | [] | |``controller.initContainers`` | InitContainers for the Ingress Controller pods. | []