Skip to content

Commit

Permalink
Fix redis broker URL with useStandardNaming (apache#34825)
Browse files Browse the repository at this point in the history
  • Loading branch information
seelmann authored Oct 9, 2023
1 parent 6213d56 commit 9a29738
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chart/templates/secrets/redis-secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ metadata:
type: Opaque
data:
{{- if .Values.redis.enabled }}
connection: {{ urlJoin (dict "scheme" "redis" "userinfo" (printf ":%s" ((default $random_redis_password .Values.redis.password) | urlquery)) "host" (printf "%s-redis:6379" .Release.Name ) "path" "/0") | b64enc | quote }}
connection: {{ urlJoin (dict "scheme" "redis" "userinfo" (printf ":%s" ((default $random_redis_password .Values.redis.password) | urlquery)) "host" (printf "%s-redis:6379" (include "airflow.fullname" .) ) "path" "/0") | b64enc | quote }}
{{- else }}
connection: {{ (printf "%s" .Values.data.brokerUrl) | b64enc | quote }}
{{- end }}
Expand Down
22 changes: 22 additions & 0 deletions helm_tests/airflow_aux/test_basic_helm_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,28 @@ def test_priority_classes_default_preemption(self):

assert obj["preemptionPolicy"] == "PreemptLowerPriority"

def test_redis_broker_connection_url(self):
# no nameoverride, redis
doc = render_chart(
"my-release",
show_only=["templates/secrets/redis-secrets.yaml"],
values={"redis": {"enabled": True, "password": "test1234"}},
)[1]
assert "redis://:test1234@my-release-redis:6379/0" == base64.b64decode(
doc["data"]["connection"]
).decode("utf-8")

def test_redis_broker_connection_url_use_standard_naming(self):
# no nameoverride, redis and useStandardNaming
doc = render_chart(
"my-release",
show_only=["templates/secrets/redis-secrets.yaml"],
values={"useStandardNaming": True, "redis": {"enabled": True, "password": "test1234"}},
)[1]
assert "redis://:test1234@my-release-airflow-redis:6379/0" == base64.b64decode(
doc["data"]["connection"]
).decode("utf-8")

@staticmethod
def default_trigger_obj(version):
if version == "default":
Expand Down

0 comments on commit 9a29738

Please sign in to comment.