Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chart/newsfragments/PR_NUMBER_PLACEHOLDER.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix PgBouncer connection routing in the auto-generated result backend secret to use the ``airflow.fullname`` naming convention, matching the metadata connection secret. Previously it pointed at a non-existent PgBouncer host whenever ``useStandardNaming`` or ``fullnameOverride`` changed the release naming.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,23 @@ def test_should_set_pgbouncer_overrides_with_non_chart_database_when_enabled(sel

# 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:somepass@release-name-pgbouncer.default:6543"
"/release-name-result-backend?sslmode=allow"
)

def test_should_set_pgbouncer_overrides_with_use_standard_naming(self):
# The pgbouncer host must be derived from the "airflow.fullname" template (like the metadata
# connection secret does), not from `.Release.Name` directly, so that it still resolves once
# `useStandardNaming`/`fullnameOverride` change the pgbouncer Service name.
values = {
"useStandardNaming": True,
"pgbouncer": {"enabled": True},
"data": {"resultBackendConnection": {**self.non_chart_database_values}},
}
connection = self._get_connection(values)

assert (
connection == "db+postgresql://someuser:somepass@release-name-airflow-pgbouncer.default:6543"
"/release-name-result-backend?sslmode=allow"
)

Expand Down