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
13 changes: 11 additions & 2 deletions chart/templates/_helpers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -690,16 +690,25 @@ server_tls_key_file = /etc/pgbouncer/server.key
- -c
- |
CONNECTION_CHECK_MAX_COUNT=0 AIRFLOW__LOGGING__LOGGING_LEVEL=ERROR exec /entrypoint \
airflow jobs check --job-type TriggererJob --hostname $(hostname)
airflow jobs check --job-type TriggererJob --hostname $(hostname)
{{- end }}
{{- end }}

{{- define "dag_processor_liveness_check_command" }}
{{- $commandArgs := (list) -}}
{{- if semverCompare ">=2.5.0" .Values.airflowVersion }}
{{- $commandArgs = append $commandArgs "--local" -}}
{{- if semverCompare ">=2.5.2" .Values.airflowVersion }}
{{- $commandArgs = concat $commandArgs (list "--job-type" "DagProcessorJob") -}}
{{- end }}
{{- else }}
{{- $commandArgs = concat $commandArgs (list "--hostname" "$(hostname)") -}}
{{- end }}
- sh
- -c
- |
CONNECTION_CHECK_MAX_COUNT=0 AIRFLOW__LOGGING__LOGGING_LEVEL=ERROR exec /entrypoint \
airflow jobs check --hostname $(hostname)
airflow jobs check {{ join " " $commandArgs }}
{{- end }}

{{- define "registry_docker_config" }}
Expand Down
18 changes: 18 additions & 0 deletions helm_tests/airflow_core/test_dag_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,24 @@ def test_livenessprobe_values_are_configurable(self):
"spec.template.spec.containers[0].livenessProbe.exec.command", docs[0]
)

@pytest.mark.parametrize(
"airflow_version, probe_command",
[
("2.4.9", "airflow jobs check --hostname $(hostname)"),
("2.5.0", "airflow jobs check --local"),
("2.5.2", "airflow jobs check --local --job-type DagProcessorJob"),
],
)
def test_livenessprobe_command_depends_on_airflow_version(self, airflow_version, probe_command):
docs = render_chart(
values={"airflowVersion": f"{airflow_version}", "dagProcessor": {"enabled": True}},
show_only=["templates/dag-processor/dag-processor-deployment.yaml"],
)
assert (
probe_command
in jmespath.search("spec.template.spec.containers[0].livenessProbe.exec.command", docs[0])[-1]
)

@pytest.mark.parametrize(
"log_persistence_values, expected_volume",
[
Expand Down
18 changes: 18 additions & 0 deletions helm_tests/airflow_core/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,24 @@ def test_livenessprobe_values_are_configurable(self):
"spec.template.spec.containers[0].livenessProbe.exec.command", docs[0]
)

@pytest.mark.parametrize(
"airflow_version, probe_command",
[
("1.9.0", "from airflow.jobs.scheduler_job import SchedulerJob"),
("2.1.0", "airflow jobs check --job-type SchedulerJob --hostname $(hostname)"),
("2.5.0", "airflow jobs check --job-type SchedulerJob --local"),
],
)
def test_livenessprobe_command_depends_on_airflow_version(self, airflow_version, probe_command):
docs = render_chart(
values={"airflowVersion": f"{airflow_version}"},
show_only=["templates/scheduler/scheduler-deployment.yaml"],
)
assert (
probe_command
in jmespath.search("spec.template.spec.containers[0].livenessProbe.exec.command", docs[0])[-1]
)

@pytest.mark.parametrize(
"log_persistence_values, expected_volume",
[
Expand Down
17 changes: 17 additions & 0 deletions helm_tests/airflow_core/test_triggerer.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,23 @@ def test_livenessprobe_values_are_configurable(self):
"spec.template.spec.containers[0].livenessProbe.exec.command", docs[0]
)

@pytest.mark.parametrize(
"airflow_version, probe_command",
[
("2.4.9", "airflow jobs check --job-type TriggererJob --hostname $(hostname)"),
("2.5.0", "airflow jobs check --job-type TriggererJob --local"),
],
)
def test_livenessprobe_command_depends_on_airflow_version(self, airflow_version, probe_command):
docs = render_chart(
values={"airflowVersion": f"{airflow_version}"},
show_only=["templates/triggerer/triggerer-deployment.yaml"],
)
assert (
probe_command
in jmespath.search("spec.template.spec.containers[0].livenessProbe.exec.command", docs[0])[-1]
)

@pytest.mark.parametrize(
"log_persistence_values, expected_volume",
[
Expand Down