This is an automated email from the ASF dual-hosted git repository.
husseinawala pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new bbdf43b01b Allowing ability to add custom env into pgbouncer container
(#33438)
bbdf43b01b is described below
commit bbdf43b01b65527558272419579da98876c32ab3
Author: Amogh Desai <[email protected]>
AuthorDate: Sat Aug 19 00:33:29 2023 +0530
Allowing ability to add custom env into pgbouncer container (#33438)
* Allowing ability to add custom env into pgbouncer container
* fixing docs
* Update chart/templates/pgbouncer/pgbouncer-deployment.yaml
---------
Co-authored-by: Hussein Awala <[email protected]>
---
chart/templates/pgbouncer/pgbouncer-deployment.yaml | 3 +++
chart/values.schema.json | 21 +++++++++++++++++++++
chart/values.yaml | 3 +++
helm_tests/other/test_pgbouncer.py | 15 +++++++++++++++
4 files changed, 42 insertions(+)
diff --git a/chart/templates/pgbouncer/pgbouncer-deployment.yaml
b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
index 5af4a2f0a2..2ca0711380 100644
--- a/chart/templates/pgbouncer/pgbouncer-deployment.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
@@ -101,6 +101,9 @@ spec:
args: {{ tpl (toYaml .Values.pgbouncer.args) . | nindent 12 }}
{{- end }}
resources: {{- toYaml .Values.pgbouncer.resources | nindent 12 }}
+ {{- with .Values.pgbouncer.env }}
+ env: {{- toYaml . | nindent 12 }}
+ {{- end }}
ports:
- name: pgbouncer
containerPort: {{ .Values.ports.pgbouncer }}
diff --git a/chart/values.schema.json b/chart/values.schema.json
index 462907d9ec..7b208136ed 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -5081,6 +5081,27 @@
"x-docsSection": "PgBouncer",
"additionalProperties": false,
"properties": {
+ "env": {
+ "description": "Add additional env vars to `pgbouncer`
container.",
+ "type": "array",
+ "default": [],
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "name",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
"enabled": {
"description": "Enable PgBouncer.",
"type": "boolean",
diff --git a/chart/values.yaml b/chart/values.yaml
index 7c5356c5cb..f51f5d73f4 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -1944,6 +1944,9 @@ pgbouncer:
periodSeconds: 10
timeoutSeconds: 1
+ # Environment variables to add to pgbouncer container
+ env: []
+
# Configuration for the redis provisioned by the chart
redis:
enabled: true
diff --git a/helm_tests/other/test_pgbouncer.py
b/helm_tests/other/test_pgbouncer.py
index f90be0251e..3c630f8f7b 100644
--- a/helm_tests/other/test_pgbouncer.py
+++ b/helm_tests/other/test_pgbouncer.py
@@ -525,6 +525,21 @@ class TestPgbouncerConfig:
assert "server_round_robin = 1" in ini
assert "stats_period = 30" in ini
+ def test_should_add_custom_env_variables(self):
+ env1 = {"name": "TEST_ENV_1", "value": "test_env_1"}
+
+ docs = render_chart(
+ values={
+ "pgbouncer": {
+ "enabled": True,
+ "env": [env1],
+ },
+ },
+ show_only=["templates/pgbouncer/pgbouncer-deployment.yaml"],
+ )[0]
+
+ assert jmespath.search("spec.template.spec.containers[0].env", docs)
== [env1]
+
class TestPgbouncerExporter:
"""Tests PgBouncer exporter."""