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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
### Removed

- Removed airflow `3.1.6` ([#865]).
- Removed airflow `2.9.3` ([#900]).

[#814]: https://github.com/stackabletech/airflow-operator/pull/814
[#821]: https://github.com/stackabletech/airflow-operator/pull/821
Expand Down Expand Up @@ -117,6 +118,7 @@
[#887]: https://github.com/stackabletech/airflow-operator/pull/887
[#888]: https://github.com/stackabletech/airflow-operator/pull/888
[#892]: https://github.com/stackabletech/airflow-operator/pull/892
[#900]: https://github.com/stackabletech/airflow-operator/pull/900

## [26.7.0] - 2026-07-21

Expand Down
3 changes: 2 additions & 1 deletion docs/modules/airflow/pages/getting_started/first_steps.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ An Airflow cluster is made up of several components, two of which are optional:
* `executors`: the CeleryExecutor or KubernetesExecutor nodes over which the job workload is distributed by the scheduler
* `scheduler`: responsible for triggering jobs and persisting their metadata to the backend database
* `dagProcessors`: (Optional) responsible for monitoring, parsing and preparing DAGs for processing.
If this role is not specified then the process will be started as a scheduler subprocess (Airflow 2.x), or as a standalone process in the same container as the scheduler (Airflow 3.x+). We recommend specifying this role for production settings as running multiple processes in the same container complicates proper supervision.
If this role is not specified then the process will be started as a standalone process in the same container as the scheduler.
We recommend specifying this role for production settings as running multiple processes in the same container complicates proper supervision.
* `triggerers`: (Optional) DAGs making use of deferrable operators can be used together with one or more triggerer processes to free up worker slots.
This deferral process is also useful for providing a measure of high availability

Expand Down
5 changes: 2 additions & 3 deletions docs/modules/airflow/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ kubernetesExecutors:

=== DAG-Processors

In Airflow 2.x, a DAG-Processor can be started either as a standalone process or a subprocess within the scheduler component.
For Airflow 3.x+ it _must_ be started as a standalone process, either in a separate container or in the scheduler container.
In each case the default will be applied (subprocess or combined in the scheduler container) if the role is not specified.
A DAG-Processor _must_ be started as a standalone process, either in a separate container or in the scheduler container.
If the role is not specified, it is combined into the scheduler container.

=== Triggerers

Expand Down
1 change: 0 additions & 1 deletion docs/modules/airflow/pages/usage-guide/mounting-dags.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ Use DAG bundles when:

=== Prerequisites

* Airflow 3.x (the `dag_bundle_config_list` setting does not exist in Airflow 2.x).
* Each `GitDagBundle` requires an https://airflow.apache.org/docs/apache-airflow-providers-git/stable/connections/git.html[Airflow Git connection] - even for public repositories.
For public repos, the connection only needs a `host` (the repository URL) and no credentials.
Connections can be created via the Airflow UI, CLI, a https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/secrets-backend/index.html[secrets backend], or - as shown in the example below - via `AIRFLOW_CONN_*` environment variables.
Expand Down
25 changes: 4 additions & 21 deletions docs/modules/airflow/pages/usage-guide/reverse-proxy.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ spec:
the only entry in the list: combining it with other entries is rejected, since it would silently
degrade to trusting only those other entries.

On Airflow 3.x the operator starts the api-server with `--proxy-headers` and restricts the headers
to the listed peers. Airflow 2.x has no equivalent restriction: see
<<airflow-2-x-has-no-peer-restriction>>.
The operator starts the api-server with `--proxy-headers` and restricts the headers to the listed peers.

== Choosing the value

Expand Down Expand Up @@ -56,23 +54,8 @@ themselves.
WARNING: A peer that is trusted can set the client address that ends up in the webserver's access
log. Do not list ranges wider than the proxies you operate.

[#airflow-2-x-has-no-peer-restriction]
== Airflow 2.x has no peer restriction

Airflow 2.x's webserver has no analogue support for trusted network addresses. Once enabled, it
unconditionally trusts `X-Forwarded-*` from *any* peer, the same as `trustedProxies: ["*"]` on 3.x.

This means that for Airflow 2.x, `trustedProxies: ["*"]` is the only valid configuration. Using
any other value than `*` will lead the operator to reject reconciliation.

== Interaction with overrides

On Airflow 3.x, the operator sets `FORWARDED_ALLOW_IPS` from this field, before `envOverrides` are
applied -- so an `envOverrides` entry for that variable wins over the value derived from
`trustedProxies`. This override only takes effect while `trustedProxies` is non-empty: an empty
list means the api-server is not started with `--proxy-headers` at all, so uvicorn never installs
the middleware that reads `FORWARDED_ALLOW_IPS`, and the override has no effect regardless of its
value.

On Airflow 2.x, the same applies to `AIRFLOW__WEBSERVER__ENABLE_PROXY_FIX` and
`AIRFLOW__WEBSERVER__PROXY_FIX_X_FOR`.
The operator sets `FORWARDED_ALLOW_IPS` from this field, before `envOverrides` are applied -- so an `envOverrides` entry for that variable wins over the value derived from `trustedProxies`.
This override only takes effect while `trustedProxies` is non-empty:
an empty list means the api-server is not started with `--proxy-headers` at all, so uvicorn never installs the middleware that reads `FORWARDED_ALLOW_IPS`, and the override has no effect regardless of its value.
1 change: 0 additions & 1 deletion docs/modules/airflow/partials/supported-versions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
- 3.3.2
- 3.2.2 (deprecated)
- 3.0.6 (LTS)
- 2.9.3 (deprecated)
26 changes: 10 additions & 16 deletions tests/templates/kuttl/commons/health.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
#!/usr/bin/env python
import argparse
import logging
import requests
import sys
import time
import argparse

import requests

# Every component of the health endpoint reports its heartbeat under a key named
# after itself, e.g. `latest_scheduler_heartbeat` for the `scheduler`. The
# exception is `metadatabase`, which reports a status only.
HEARTBEAT_KEY = "latest_{}_heartbeat".format


def health_url(airflow_version):
"""Return the health endpoint of the given Airflow version."""
if airflow_version and airflow_version.startswith("3"):
return "http://airflow-webserver:8080/api/v2/monitor/health"
else:
return "http://airflow-webserver:8080/api/v1/health"
HEALTH_URL = "http://airflow-webserver:8080/api/v2/monitor/health"


def component_states(health, components):
Expand Down Expand Up @@ -73,7 +68,7 @@ def all_healthy(states, baseline):
)
opts = parser.parse_args()

url = health_url(opts.airflow_version)
url = HEALTH_URL
deadline = time.monotonic() + opts.timeout if opts.timeout else None
baseline = None

Expand Down Expand Up @@ -103,13 +98,12 @@ def all_healthy(states, baseline):
except requests.exceptions.Timeout:
print(f"Connection timed out, retrying attempt no [{count}] ....")
except requests.ConnectionError as e:
print(f"Connection Error: {str(e)}")
print(f"Connection Error: {e!s}")
except requests.RequestException as e:
print(f"General Error: {str(e)}")
except Exception as e:
print(
f"General error occurred {str(e)}, retrying attempt no [{count}] ...."
)
print(f"General Error: {e!s}")
# Retry on anything: this loop polls until the endpoint reports healthy.
except Exception as e: # noqa: BLE001
print(f"General error occurred {e!s}, retrying attempt no [{count}] ....")

if deadline and time.monotonic() > deadline:
sys.exit(
Expand Down
68 changes: 7 additions & 61 deletions tests/templates/kuttl/commons/metrics.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python

import requests
import time
import sys
from datetime import datetime, timezone
import argparse
import logging
import sys
import time
from datetime import UTC, datetime

import requests


def exception_handler(exception_type, exception, traceback):
Expand Down Expand Up @@ -42,7 +43,7 @@ def assert_dag_started(rest_url, headers, dag_id, dag_run_id):


def metrics_v3(role_group: str) -> None:
now = datetime.now(timezone.utc)
now = datetime.now(UTC)
ts = now.strftime("%Y-%m-%dT%H:%M:%S.%f") + now.strftime("%z")

# Trigger a DAG run to create metrics
Expand Down Expand Up @@ -114,58 +115,6 @@ def metrics_v3(role_group: str) -> None:
sys.exit(1)


def metrics_v2(role_group: str) -> None:
# Trigger a DAG run to create metrics
dag_id = "example_trigger_target_dag"
dag_conf = {"message": "Hello World"}

rest_url = f"http://airflow-webserver-{role_group}-headless:8080/api/v1"
auth = ("airflow", "airflow")

# allow a few moments for the DAGs to be registered to all roles
time.sleep(10)

response = requests.patch(
f"{rest_url}/dags/{dag_id}", auth=auth, json={"is_paused": False}
)
response = requests.post(
f"{rest_url}/dags/{dag_id}/dagRuns", auth=auth, json={"conf": dag_conf}
)

# Test the DAG in a loop. Each time we call the script a new job will be started: we can avoid
# or minimize this by looping over the check instead.
iterations = 4
loop = 0
while True:
assert response.status_code == 200, "DAG run could not be triggered."
# Wait for the metrics to be consumed by the statsd-exporter
time.sleep(5)
# (disable line-break flake checks)
if (
(assert_metric("scheduler", role_group, "airflow_scheduler_heartbeat"))
and (
assert_metric(
"webserver",
role_group,
"airflow_task_instance_created_BashOperator",
)
) # noqa: W503, W504
and (
assert_metric(
"scheduler",
role_group,
"airflow_dagrun_duration_success_example_trigger_target_dag_count",
)
)
): # noqa: W503, W504
break
time.sleep(10)
loop += 1
if loop == iterations:
# force re-try of script
sys.exit(1)


if __name__ == "__main__":
log_level = "DEBUG"
logging.basicConfig(
Expand All @@ -181,7 +130,4 @@ def metrics_v2(role_group: str) -> None:
parser.add_argument("--airflow-version", type=str, help="Airflow version")
opts = parser.parse_args()

if opts.airflow_version and opts.airflow_version.startswith("3"):
metrics_v3(opts.role_group)
else:
metrics_v2(opts.role_group)
metrics_v3(opts.role_group)
13 changes: 0 additions & 13 deletions tests/templates/kuttl/external-access/45-assert.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 600
{% if test_scenario['values']['airflow'].startswith("2") %}
commands:
# ProxyFix must be enabled on Airflow 2
- script: |
kubectl -n $NAMESPACE get statefulset airflow-webserver-default \
-o jsonpath='{.spec.template.spec.containers[?(@.name=="airflow")].env[?(@.name=="AIRFLOW__WEBSERVER__ENABLE_PROXY_FIX")].value}' \
| grep -qx 'True'
- script: |
kubectl -n $NAMESPACE get statefulset airflow-webserver-default \
-o jsonpath='{.spec.template.spec.containers[?(@.name=="airflow")].env[?(@.name=="AIRFLOW__WEBSERVER__PROXY_FIX_X_FOR")].value}' \
| grep -qx '1'
{% else %}
commands:
# The api-server must be started with --proxy-headers ...
- script: |
Expand All @@ -25,4 +13,3 @@ commands:
kubectl -n $NAMESPACE get statefulset airflow-webserver-default \
-o jsonpath='{.spec.template.spec.containers[?(@.name=="airflow")].env[?(@.name=="FORWARDED_ALLOW_IPS")].value}' \
| grep -qx '\*'
{% endif %}
7 changes: 2 additions & 5 deletions tests/templates/kuttl/logging/51-assert.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ timeout: 480
{% else %}
{% set airflow_version = test_scenario['values']['airflow'] %}
{% endif %}
{% set components = "--component scheduler" %}
{% if airflow_version.startswith("3") %}
{# With 3.x the scheduler container also runs the dag-processor. #}
{% set components = components ~ " --component dag_processor" %}
{% endif %}
{# The scheduler container also runs the dag-processor. #}
{% set components = "--component scheduler --component dag_processor" %}
commands:
# Called twice so that the webserver logs more than one request, which the
# log aggregation is asserted on further down.
Expand Down
1 change: 1 addition & 0 deletions tests/templates/kuttl/logging/test_log_aggregation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
import json
import subprocess

Expand Down
20 changes: 13 additions & 7 deletions tests/templates/kuttl/mount-dags-gitsync/dag_metrics.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#!/usr/bin/env python

import requests
import time
import sys
import logging
from datetime import datetime, timezone
import sys
import time
from datetime import UTC, datetime

import requests

logging.basicConfig(
level="DEBUG", format="%(asctime)s %(levelname)s: %(message)s", stream=sys.stdout
)

log = logging.getLogger(__name__)


def assert_metric(role, metric):
Expand All @@ -17,7 +24,7 @@ def assert_metric(role, metric):
return metric in metric_response.text


now = datetime.now(timezone.utc)
now = datetime.now(UTC)
ts = now.strftime("%Y-%m-%dT%H:%M:%S.%f") + now.strftime("%z")

# Trigger a DAG run to create metrics
Expand Down Expand Up @@ -63,9 +70,8 @@ def assert_metric(role, metric):
# Wait for the metrics to be consumed by the statsd-exporter
time.sleep(5)

logging.info(f"Response code: {response.status_code}")
log.info(f"Response code: {response.status_code}")
assert response.status_code == 200, "DAG run could not be triggered."
# Worker is not deployed with the kubernetes executor so retrieve success metric from scheduler
# (disable line-break flake checks)
assert_metric("scheduler", "airflow_scheduler_heartbeat")
assert_metric("scheduler", "airflow_dagrun_duration_success_sparkapp_dag_count")
6 changes: 0 additions & 6 deletions tests/templates/kuttl/oidc/50-install-test-container.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: AIRFLOW_VERSION
{% if test_scenario['values']['airflow-latest'].find(",") > 0 %}
value: "{{ test_scenario['values']['airflow-latest'].split(',')[0] }}"
{% else %}
value: "{{ test_scenario['values']['airflow-latest'] }}"
{% endif %}

volumes:
- name: tls
Expand Down
Loading