This is an automated email from the ASF dual-hosted git repository.
Miretpl pushed a commit to branch chart/v1-2x-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/chart/v1-2x-test by this push:
new 9214ce699c0 [chart/v1-2x-test] Use airflowHome for logs mount in
wait-for-migrations init container (#75060) (#76881)
9214ce699c0 is described below
commit 9214ce699c017fa3d0f9b3440a120330233e6378
Author: W. H. Wang <[email protected]>
AuthorDate: Wed Nov 25 06:29:09 2026 +0800
[chart/v1-2x-test] Use airflowHome for logs mount in wait-for-migrations
init container (#75060) (#76881)
(cherry picked from commit 81b487227dc69a6dacf192217809fa80e062cd36)
---
.../templates/scheduler/scheduler-deployment.yaml | 2 +-
.../templates/triggerer/triggerer-deployment.yaml | 2 +-
chart/templates/workers/worker-deployment.yaml | 2 +-
.../helm_tests/airflow_core/test_scheduler.py | 27 ++++++++++++++-----
.../helm_tests/airflow_core/test_triggerer.py | 31 +++++++++++++++++-----
.../tests/helm_tests/airflow_core/test_worker.py | 31 +++++++++++++++++-----
6 files changed, 72 insertions(+), 23 deletions(-)
diff --git a/chart/templates/scheduler/scheduler-deployment.yaml
b/chart/templates/scheduler/scheduler-deployment.yaml
index bfb28dc5555..049e0cddfbf 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -159,7 +159,7 @@ spec:
{{- end }}
volumeMounts:
- name: logs
- mountPath: "/opt/airflow/logs"
+ mountPath: {{ template "airflow_logs" . }}
{{- if .Values.logs.persistence.subPath }}
subPath: {{ .Values.logs.persistence.subPath }}
{{- end }}
diff --git a/chart/templates/triggerer/triggerer-deployment.yaml
b/chart/templates/triggerer/triggerer-deployment.yaml
index 80f510f834a..c02e595ec48 100644
--- a/chart/templates/triggerer/triggerer-deployment.yaml
+++ b/chart/templates/triggerer/triggerer-deployment.yaml
@@ -144,7 +144,7 @@ spec:
{{- end }}
volumeMounts:
- name: logs
- mountPath: "/opt/airflow/logs"
+ mountPath: {{ template "airflow_logs" . }}
{{- if .Values.logs.persistence.subPath }}
subPath: {{ .Values.logs.persistence.subPath }}
{{- end }}
diff --git a/chart/templates/workers/worker-deployment.yaml
b/chart/templates/workers/worker-deployment.yaml
index cdbf9f8b0a6..372b244ccad 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -244,7 +244,7 @@ spec:
{{- end }}
volumeMounts:
- name: logs
- mountPath: "/opt/airflow/logs"
+ mountPath: {{ template "airflow_logs" . }}
{{- if .Values.logs.persistence.subPath }}
subPath: {{ .Values.logs.persistence.subPath }}
{{- end }}
diff --git a/helm-tests/tests/helm_tests/airflow_core/test_scheduler.py
b/helm-tests/tests/helm_tests/airflow_core/test_scheduler.py
index 1fb01e25d0e..6d17b4f8ab5 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_scheduler.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_scheduler.py
@@ -128,11 +128,21 @@ class TestScheduler:
({"persistence": {"enabled": True, "subPath": "test/logs"}},
"test/logs"),
],
)
- def test_logs_mount_on_wait_for_migrations_initcontainer(self,
logs_values, expect_sub_path):
+ @pytest.mark.parametrize(
+ ("airflow_home", "expected_logs_mount_path"),
+ [
+ (None, "/opt/airflow/logs"),
+ ("/usr/local/airflow", "/usr/local/airflow/logs"),
+ ],
+ )
+ def test_logs_mount_on_wait_for_migrations_initcontainer(
+ self, logs_values, expect_sub_path, airflow_home,
expected_logs_mount_path
+ ):
+ values = {"logs": logs_values}
+ if airflow_home is not None:
+ values["airflowHome"] = airflow_home
docs = render_chart(
- values={
- "logs": logs_values,
- },
+ values=values,
show_only=["templates/scheduler/scheduler-deployment.yaml"],
)
@@ -143,11 +153,16 @@ class TestScheduler:
assert mounts is not None, (
"wait-for-airflow-migrations initContainer not found or has no
volumeMounts"
)
- assert any(m.get("name") == "logs" and m.get("mountPath") ==
"/opt/airflow/logs" for m in mounts)
+ main_container_logs_mount_path = jmespath.search(
+ "spec.template.spec.containers[?name=='scheduler'] |
[0].volumeMounts[?name=='logs'] | [0].mountPath",
+ docs[0],
+ )
+ assert main_container_logs_mount_path == expected_logs_mount_path
+ assert any(m.get("name") == "logs" and m.get("mountPath") ==
expected_logs_mount_path for m in mounts)
if expect_sub_path is not None:
assert any(
m.get("name") == "logs"
- and m.get("mountPath") == "/opt/airflow/logs"
+ and m.get("mountPath") == expected_logs_mount_path
and m.get("subPath") == expect_sub_path
for m in mounts
)
diff --git a/helm-tests/tests/helm_tests/airflow_core/test_triggerer.py
b/helm-tests/tests/helm_tests/airflow_core/test_triggerer.py
index 81f5d9e282c..561c461c2d8 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_triggerer.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_triggerer.py
@@ -110,12 +110,24 @@ class TestTriggerer:
({"persistence": {"enabled": True, "subPath": "test/logs"}},
"test/logs"),
],
)
- def test_logs_mount_on_wait_for_migrations_initcontainer(self,
logs_values, expect_sub_path):
+ @pytest.mark.parametrize(
+ ("airflow_home", "expected_logs_mount_path"),
+ [
+ (None, "/opt/airflow/logs"),
+ ("/usr/local/airflow", "/usr/local/airflow/logs"),
+ ],
+ )
+ def test_logs_mount_on_wait_for_migrations_initcontainer(
+ self, logs_values, expect_sub_path, airflow_home,
expected_logs_mount_path
+ ):
+ values = {
+ "logs": logs_values,
+ "triggerer": {"enabled": True},
+ }
+ if airflow_home is not None:
+ values["airflowHome"] = airflow_home
docs = render_chart(
- values={
- "logs": logs_values,
- "triggerer": {"enabled": True},
- },
+ values=values,
show_only=["templates/triggerer/triggerer-deployment.yaml"],
)
@@ -126,11 +138,16 @@ class TestTriggerer:
assert mounts is not None, (
"wait-for-airflow-migrations initContainer not found or has no
volumeMounts"
)
- assert any(m.get("name") == "logs" and m.get("mountPath") ==
"/opt/airflow/logs" for m in mounts)
+ main_container_logs_mount_path = jmespath.search(
+ "spec.template.spec.containers[?name=='triggerer'] |
[0].volumeMounts[?name=='logs'] | [0].mountPath",
+ docs[0],
+ )
+ assert main_container_logs_mount_path == expected_logs_mount_path
+ assert any(m.get("name") == "logs" and m.get("mountPath") ==
expected_logs_mount_path for m in mounts)
if expect_sub_path is not None:
assert any(
m.get("name") == "logs"
- and m.get("mountPath") == "/opt/airflow/logs"
+ and m.get("mountPath") == expected_logs_mount_path
and m.get("subPath") == expect_sub_path
for m in mounts
)
diff --git a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
index df3dfb79085..a242e375b0c 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
@@ -254,12 +254,24 @@ class TestWorker:
({"persistence": {"enabled": True, "subPath": "test/logs"}},
"test/logs"),
],
)
- def test_logs_mount_on_wait_for_migrations_initcontainer(self,
logs_values, expect_sub_path):
+ @pytest.mark.parametrize(
+ ("airflow_home", "expected_logs_mount_path"),
+ [
+ (None, "/opt/airflow/logs"),
+ ("/usr/local/airflow", "/usr/local/airflow/logs"),
+ ],
+ )
+ def test_logs_mount_on_wait_for_migrations_initcontainer(
+ self, logs_values, expect_sub_path, airflow_home,
expected_logs_mount_path
+ ):
+ values = {
+ "executor": "CeleryExecutor",
+ "logs": logs_values,
+ }
+ if airflow_home is not None:
+ values["airflowHome"] = airflow_home
docs = render_chart(
- values={
- "executor": "CeleryExecutor",
- "logs": logs_values,
- },
+ values=values,
show_only=["templates/workers/worker-deployment.yaml"],
)
@@ -270,11 +282,16 @@ class TestWorker:
assert mounts is not None, (
"wait-for-airflow-migrations initContainer not found or has no
volumeMounts"
)
- assert any(m.get("name") == "logs" and m.get("mountPath") ==
"/opt/airflow/logs" for m in mounts)
+ main_container_logs_mount_path = jmespath.search(
+ "spec.template.spec.containers[?name=='worker'] |
[0].volumeMounts[?name=='logs'] | [0].mountPath",
+ docs[0],
+ )
+ assert main_container_logs_mount_path == expected_logs_mount_path
+ assert any(m.get("name") == "logs" and m.get("mountPath") ==
expected_logs_mount_path for m in mounts)
if expect_sub_path is not None:
assert any(
m.get("name") == "logs"
- and m.get("mountPath") == "/opt/airflow/logs"
+ and m.get("mountPath") == expected_logs_mount_path
and m.get("subPath") == expect_sub_path
for m in mounts
)