Skip to content
Merged
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
4 changes: 2 additions & 2 deletions chart/templates/configmaps/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ metadata:
{{- end }}
{{- $Global := . }}
data:
{{- $config := deepCopy .Values.config | merge (dict "core" dict) }}
{{/*- Set a default for core.execution_api_server_url pointing to the api-server service if it's not set -*/}}
{{- if semverCompare ">=3.0.0" .Values.airflowVersion -}}
{{- $basePath := "" -}}
{{- $config := merge .Values.config ( dict "core" dict )}}
{{- if not (hasKey $config.core "execution_api_server_url") -}}
{{- if (and $config.api $config.api.base_url) -}}
{{- with urlParse $config.api.base_url }}{{ $basePath = (trimSuffix "/" .path) }}{{ end }}
Expand All @@ -51,7 +51,7 @@ data:
{{- end -}}
# These are system-specified config overrides.
airflow.cfg: |-
{{- range $section, $settings := .Values.config }}
{{- range $section, $settings := $config }}
[{{ $section }}]
{{- range $key, $val := $settings }}
{{ $key }} = {{ tpl ($val | toString) $Global }}
Expand Down
13 changes: 6 additions & 7 deletions helm-tests/tests/helm_tests/airflow_aux/test_configmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def test_standalone_dag_processor_explicit(self, airflow_version, enabled):
"3.0.0",
None,
None,
"http://release-name-api-server:8080/execution",
"http://release-name-api-server:8080/execution/",
),
(
"2.9.0",
Expand All @@ -260,13 +260,13 @@ def test_standalone_dag_processor_explicit(self, airflow_version, enabled):
"3.0.0",
"http://example.com",
None,
"http://release-name-api-server:8080/execution",
"http://release-name-api-server:8080/execution/",
),
(
"3.0.0",
"http://example.com/airflow",
None,
"http://release-name-api-server:8080/airflow/execution",
"http://release-name-api-server:8080/airflow/execution/",
),
(
"3.0.0",
Expand All @@ -291,14 +291,13 @@ def test_execution_api_server_url(
show_only=["templates/configmaps/configmap.yaml"],
)

# config is the jmespath search for the data["airflow.cfg"] in the configmap
config = jmespath.search('data.["airflow.cfg"]', configmap[0])
config = jmespath.search('data."airflow.cfg"', configmap[0])
assert config is not None, "Configmap data for airflow.cfg should not be None"
assert len(config) > 0, "Configmap data for airflow.cfg should not be empty"

if expected_execution_url is not None:
assert f"\nexecution_api_server_url = {expected_execution_url}" in config[0]
assert f"\nexecution_api_server_url = {expected_execution_url}\n" in config
else:
assert "execution_api_server_url" not in config[0], (
assert "execution_api_server_url" not in config, (
"execution_api_server_url should not be set for Airflow 2.x versions"
)