Fix Liveness / Readiness / Startup probe path for Airflow 3.x #58129 (#58734)

* Fix Liveness / Readiness / Startup probe path for Airflow 3.x #58129

* Update docker-tests/tests/docker_tests/test_docker_compose_quick_start.py

Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>

* Fix ruff formatting

* Update docker-tests/tests/docker_tests/test_docker_compose_quick_start.py

* Update docker-tests/tests/docker_tests/test_docker_compose_quick_start.py

Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>

---------

Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-12-02 23:38:11 +01:00
1 parent 28e08fc997
commit 8ab288a4d5
7 files changed
+20 -7

No files matched your search

@@ -123,7 +123,7 @@ services:
ports:
- "8080:8080"
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/api/v2/version"]
test: ["CMD", "curl", "--fail", "http://localhost:8080/api/v2/monitor/health"]
interval: 30s
timeout: 10s
retries: 5
@@ -69,7 +69,7 @@ Alter the API Server health check to trust the certificate:
- "8080:8080"
healthcheck:
# Add --cacert to trust certificate
test: ["CMD", "curl", "--fail", "--cacert", "${AIRFLOW_PROJ_DIR:-.}/config/cert.pem", "https://localhost:8080/api/v2/version"]
test: ["CMD", "curl", "--fail", "--cacert", "${AIRFLOW_PROJ_DIR:-.}/config/cert.pem", "https://localhost:8080/api/v2/monitor/health"]
Running Airflow
===============
@@ -112,7 +112,7 @@ def spin_up_airflow_environment(tmp_path_factory):
compose_instance.start()
compose_instance.wait_for(f"http://{DOCKER_COMPOSE_HOST_PORT}/api/v2/version")
compose_instance.wait_for(f"http://{DOCKER_COMPOSE_HOST_PORT}/api/v2/monitor/health")
compose_instance.exec_in_container(
command=["airflow", "dags", "reserialize"], service_name="airflow-dag-processor"
)
@@ -188,7 +188,7 @@ spec:
containerPort: {{ .Values.ports.apiServer }}
livenessProbe:
httpGet:
path: /api/v2/version
path: /api/v2/monitor/health
port: {{ .Values.ports.apiServer }}
scheme: {{ .Values.apiServer.livenessProbe.scheme | default "http" }}
initialDelaySeconds: {{ .Values.apiServer.livenessProbe.initialDelaySeconds }}
@@ -197,7 +197,7 @@ spec:
periodSeconds: {{ .Values.apiServer.livenessProbe.periodSeconds }}
readinessProbe:
httpGet:
path: /api/v2/version
path: /api/v2/monitor/health
port: {{ .Values.ports.apiServer }}
scheme: {{ .Values.apiServer.readinessProbe.scheme | default "http" }}
initialDelaySeconds: {{ .Values.apiServer.readinessProbe.initialDelaySeconds }}
@@ -206,7 +206,7 @@ spec:
periodSeconds: {{ .Values.apiServer.readinessProbe.periodSeconds }}
startupProbe:
httpGet:
path: /api/v2/version
path: /api/v2/monitor/health
port: {{ .Values.ports.apiServer }}
scheme: {{ .Values.apiServer.startupProbe.scheme | default "http" }}
initialDelaySeconds: {{ .Values.apiServer.startupProbe.initialDelaySeconds }}
@@ -115,6 +115,10 @@ def test_trigger_dag_and_wait_for_result(default_docker_image, tmp_path_factory,
# Before we proceed, let's make sure our DAG has been parsed
compose.execute(service="airflow-dag-processor", command=["airflow", "dags", "reserialize"])
# Verify API server health endpoint is accessible and returns valid response
health_status = api_request("GET", path="monitor/health").get("metadatabase").get("status")
assert health_status == "healthy"
api_request("PATCH", path=f"dags/{DAG_ID}", json={"is_paused": False})
api_request(
"POST",
@@ -72,6 +72,15 @@ class TestAPIServerDeployment:
"spec.template.spec.containers[0].startupProbe.httpGet.scheme", docs[0]
)
def test_should_use_monitor_health_for_http_probes(self):
docs = render_chart(show_only=["templates/api-server/api-server-deployment.yaml"])
for probe in ("livenessProbe", "readinessProbe", "startupProbe"):
assert (
jmespath.search(f"spec.template.spec.containers[0].{probe}.httpGet.path", docs[0])
== "/api/v2/monitor/health"
)
def test_should_add_extra_containers(self):
docs = render_chart(
values={
@@ -95,7 +95,7 @@ services:
ports:
- "8080:8080"
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/api/v2/version"]
test: ["CMD", "curl", "--fail", "http://localhost:8080/api/v2/monitor/health"]
interval: 30s
timeout: 10s
retries: 5