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

Miretpl 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 853cafd2137 Fix PgBouncer hostname for result backend under standard 
naming (#71830)
853cafd2137 is described below

commit 853cafd2137092f1ab66b80998bef93fc449b948
Author: Dheeren Mohta <[email protected]>
AuthorDate: Thu Sep 10 21:53:52 2026 +0530

    Fix PgBouncer hostname for result backend under standard naming (#71830)
    
    * Helm: Fix PgBouncer host for result backend when using standard naming
    
    The result backend connection secret built the PgBouncer hostname from
    `.Release.Name` directly and omitted the namespace, unlike the metadata
    connection secret's equivalent logic. Once `useStandardNaming` is enabled
    (the chart's own recommended setting for new installs) or a
    `fullnameOverride` is set, the computed hostname no longer matches the
    actual PgBouncer Service name, so Celery result-backend traffic silently
    fails to route through PgBouncer. Derive the host the same way the
    metadata secret already does, via the `airflow.fullname` template plus
    namespace, so both secrets stay consistent and resolve correctly
    regardless of naming configuration.
    
    * Helm: Fix PgBouncer host for result backend when using standard naming
    
    The result backend connection secret built the PgBouncer hostname from
    `.Release.Name` directly and omitted the namespace, unlike the metadata
    connection secret's equivalent logic. Once `useStandardNaming` is enabled
    (the chart's own recommended setting for new installs) or a
    `fullnameOverride` is set, the computed hostname no longer matches the
    actual PgBouncer Service name, so Celery result-backend traffic silently
    fails to route through PgBouncer. Derive the host the same way the
    metadata secret already does, via the `airflow.fullname` template plus
    namespace, so both secrets stay consistent and resolve correctly
    regardless of naming configuration.
    
    * Address review feedback on the PgBouncer hostname fix
    
    The newsfragment was left with a placeholder filename because the PR
    number was not known when the branch was created, and the test comment
    restated how fullname templating works -- the test name already carries
    that intent.
    
    * Remove the placeholder newsfragment after merge
    
    ---------
    
    Co-authored-by: Przemysław Mirowski 
<[email protected]>
---
 .../secrets/result-backend-connection-secret.yaml         |  2 +-
 .../security/test_result_backend_connection_secret.py     | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/chart/templates/secrets/result-backend-connection-secret.yaml 
b/chart/templates/secrets/result-backend-connection-secret.yaml
index 2b3218f02de..558813629dd 100644
--- a/chart/templates/secrets/result-backend-connection-secret.yaml
+++ b/chart/templates/secrets/result-backend-connection-secret.yaml
@@ -23,7 +23,7 @@
 {{- if and .Values.data.resultBackendConnection (not 
.Values.data.resultBackendSecretName) (contains "CeleryExecutor" 
.Values.executor) }}
 {{- $connection := .Values.data.resultBackendConnection | default 
.Values.data.metadataConnection }}
 {{- $resultBackendHost := $connection.host | default (printf "%s-%s" 
.Release.Name "postgresql") }}
-{{- $pgbouncerHost := printf "%s-%s" .Release.Name "pgbouncer" }}
+{{- $pgbouncerHost := (printf "%s-%s.%s" ( include "airflow.fullname" . ) 
"pgbouncer" .Release.Namespace) }}
 {{- $host := ternary $pgbouncerHost $resultBackendHost 
.Values.pgbouncer.enabled }}
 {{- $port := (ternary .Values.ports.pgbouncer $connection.port 
.Values.pgbouncer.enabled) | toString }}
 {{- $database := ternary (printf "%s-%s" .Release.Name "result-backend") 
$connection.db .Values.pgbouncer.enabled }}
diff --git 
a/chart/tests/helm_tests/security/test_result_backend_connection_secret.py 
b/chart/tests/helm_tests/security/test_result_backend_connection_secret.py
index 94e166e28d5..48f02946e25 100644
--- a/chart/tests/helm_tests/security/test_result_backend_connection_secret.py
+++ b/chart/tests/helm_tests/security/test_result_backend_connection_secret.py
@@ -127,7 +127,20 @@ class TestResultBackendConnectionSecret:
 
         # host, port, dbname still get overridden even with an non-chart db
         assert (
-            connection == 
"db+postgresql://someuser:somepass@release-name-pgbouncer:6543"
+            connection == 
"db+postgresql://someuser:[email protected]:6543"
+            "/release-name-result-backend?sslmode=allow"
+        )
+
+    def test_should_set_pgbouncer_overrides_with_use_standard_naming(self):
+        values = {
+            "useStandardNaming": True,
+            "pgbouncer": {"enabled": True},
+            "data": {"resultBackendConnection": 
{**self.non_chart_database_values}},
+        }
+        connection = self._get_connection(values)
+
+        assert (
+            connection == 
"db+postgresql://someuser:[email protected]:6543"
             "/release-name-result-backend?sslmode=allow"
         )
 

Reply via email to