You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ro...@apache.org on 2024/08/10 14:13:22 UTC

(airflow) branch main updated: Chart: add a specific internal IP address for the ClusterIP service (#40912)

This is an automated email from the ASF dual-hosted git repository.

rom 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 40dcc9b97a Chart: add a specific internal IP address for the ClusterIP service (#40912)
40dcc9b97a is described below

commit 40dcc9b97a66764d65c2f48942abc906500ffe62
Author: mahdi alizadeh <79...@users.noreply.github.com>
AuthorDate: Sat Aug 10 17:43:14 2024 +0330

    Chart: add a specific internal IP address for the ClusterIP service (#40912)
    
    * Chart: add a specific internal IP address for the ClusterIP service
    
    * Chart: Fix values schema for clusterIP in PgBouncer Service
    
    * Add unit-test for static ip in pgbouncer service
    
    * Fix typo in pgbouncer template
    
    * Fix static checks
    
    * Change name of ip to clusterIp in pgbouncer service
    
    * Fix helm tests for pgbouncer
---
 chart/templates/pgbouncer/pgbouncer-service.yaml |  3 +++
 chart/values.schema.json                         |  8 ++++++++
 chart/values.yaml                                |  1 +
 helm_tests/other/test_pgbouncer.py               | 10 ++++++++++
 4 files changed, 22 insertions(+)

diff --git a/chart/templates/pgbouncer/pgbouncer-service.yaml b/chart/templates/pgbouncer/pgbouncer-service.yaml
index c93dce8aee..f7abcde689 100644
--- a/chart/templates/pgbouncer/pgbouncer-service.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-service.yaml
@@ -42,6 +42,9 @@ metadata:
     {{- end }}
 spec:
   type: ClusterIP
+  {{- if .Values.pgbouncer.service.clusterIp }}
+  clusterIP: {{ .Values.pgbouncer.service.clusterIp }}
+  {{- end }}
   selector:
     tier: airflow
     component: pgbouncer
diff --git a/chart/values.schema.json b/chart/values.schema.json
index 5f6a3b55d8..bec09a84bf 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -7029,6 +7029,14 @@
                             "additionalProperties": {
                                 "type": "string"
                             }
+                        },
+                        "clusterIp": {
+                            "description": "Specific ClusterIP for the PgBouncer Service.",
+                            "type": [
+                                "string",
+                                "null"
+                            ],
+                            "default": null
                         }
                     }
                 },
diff --git a/chart/values.yaml b/chart/values.yaml
index 76130e55bb..9d8794f3db 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -2144,6 +2144,7 @@ pgbouncer:
 
   service:
     extraAnnotations: {}
+    clusterIp: ~
 
   # https://www.pgbouncer.org/config.html
   verbose: 0
diff --git a/helm_tests/other/test_pgbouncer.py b/helm_tests/other/test_pgbouncer.py
index 3ad25280bc..b52dd236bb 100644
--- a/helm_tests/other/test_pgbouncer.py
+++ b/helm_tests/other/test_pgbouncer.py
@@ -98,6 +98,16 @@ class TestPgbouncer:
             "foo": "bar",
         } == jmespath.search("metadata.annotations", docs[0])
 
+    def test_pgbouncer_service_static_cluster_ip(self):
+        docs = render_chart(
+            values={
+                "pgbouncer": {"enabled": True, "service": {"clusterIp": "10.10.10.10"}},
+            },
+            show_only=["templates/pgbouncer/pgbouncer-service.yaml"],
+        )
+
+        assert "10.10.10.10" == jmespath.search("spec.clusterIP", docs[0])
+
     @pytest.mark.parametrize(
         "revision_history_limit, global_revision_history_limit",
         [(8, 10), (10, 8), (8, None), (None, 10), (None, None)],