diff --git a/chart/templates/configmaps/configmap.yaml b/chart/templates/configmaps/configmap.yaml index e904e7e579fff..49240f442cb21 100644 --- a/chart/templates/configmaps/configmap.yaml +++ b/chart/templates/configmaps/configmap.yaml @@ -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 }} @@ -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 }} diff --git a/helm-tests/tests/helm_tests/airflow_aux/test_configmap.py b/helm-tests/tests/helm_tests/airflow_aux/test_configmap.py index e1bad9e3a72c7..e5fde40acb642 100644 --- a/helm-tests/tests/helm_tests/airflow_aux/test_configmap.py +++ b/helm-tests/tests/helm_tests/airflow_aux/test_configmap.py @@ -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", @@ -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", @@ -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" )