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 @@ -12,6 +12,7 @@
### Changed

- Use internal secrets for secret- and jwt-keys ([#686]).
- Update uvicorn version and revert to default number of API workers ([#690]).

### Fixed

Expand All @@ -31,6 +32,7 @@
[#685]: https://github.com/stackabletech/airflow-operator/pull/685
[#686]: https://github.com/stackabletech/airflow-operator/pull/686
[#687]: https://github.com/stackabletech/airflow-operator/pull/687
[#690]: https://github.com/stackabletech/airflow-operator/pull/690

## [25.7.0] - 2025-07-23

Expand Down
9 changes: 4 additions & 5 deletions docs/modules/airflow/pages/troubleshooting/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ See e.g. https://github.com/minio/minio/issues/20845[this MinIO issue] for detai
== Setting API Workers

In Airflow the webserver (called the API Server in Airflow 3.x+) can use multiple workers.
This is determined by the environment variable `+AIRFLOW__API__WORKERS+` and is set by default to `4` in Airflow 2.x and `1` in Airflow 3.x+.
The reason for this difference is that Airflow uses a backend library to manage child processes and in 3.x+ this library can cause child processes to be killed if a hard-coded startup timeout is exceeded.
For most cases with Airflow 3.x+ a default of `1` should be sufficient, but if you run into performance issues and would like to add more workers, you can either modulate multiple worker processes at the level of webserver, keeping the default of a single worker per webserver:
This is determined by the environment variable `+AIRFLOW__API__WORKERS+` and is set by default to `4`.
For most cases the default should work without problem, but if you run into performance issues and would like to add more workers, you can either modulate multiple worker processes at the level of webserver, keeping the default value for each one:

[source,yaml]
----
webservers:
roleGroups:
default:
replicas: 2 # add a replica (with a single worker)
replicas: 2 # add a replica (with the default number of workers)
----

or change the environment variable using `envOverrides`:
Expand All @@ -47,7 +46,7 @@ or change the environment variable using `envOverrides`:
----
webservers:
envOverrides:
AIRFLOW__API__WORKERS: 2 # something other than the default of 1
AIRFLOW__API__WORKERS: 6 # something other than the default
----

TIP: Our strong recommendation is to increase the webserver replicas, with each webserver running a single worker, as this removes the risk of running into timeouts or memory issues.
11 changes: 0 additions & 11 deletions rust/operator-binary/src/env_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,17 +507,6 @@ fn add_version_specific_env_vars(
..Default::default()
},
);
// Airflow 3.x uses fast-api as a backend: newer versions of uvicorn can
// cause issues with child processes. See discussion here: <https://github.com/apache/airflow/discussions/50170#discussioncomment-13265000>.
// This will be considered as part of this issue: <https://github.com/stackabletech/airflow-operator/issues/641>.
env.insert(
"AIRFLOW__API__WORKERS".into(),
EnvVar {
name: "AIRFLOW__API__WORKERS".into(),
value: Some("1".into()),
..Default::default()
},
);
}
} else {
env.insert(
Expand Down
2 changes: 1 addition & 1 deletion tests/templates/kuttl/overrides/10-install-airflow.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ spec:
min: 400m
max: 800m
memory:
limit: 2Gi
limit: 3Gi
podOverrides:
spec:
containers:
Expand Down
4 changes: 4 additions & 0 deletions tests/templates/kuttl/overrides/11-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ commands:
# Test envOverrides
#
- script: |
set -eu

kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "COMMON_VAR" and .value == "group-value")'
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "GROUP_VAR" and .value == "group-value")'
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "ROLE_VAR" and .value == "role-value")'
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "credentialsSecret" and .value == "test-override")'


- script: |
set -eu

kubectl -n $NAMESPACE get sts airflow-celery-worker-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "COMMON_VAR" and .value == "group-value")'
kubectl -n $NAMESPACE get sts airflow-celery-worker-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "GROUP_VAR" and .value == "group-value")'
kubectl -n $NAMESPACE get sts airflow-celery-worker-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "ROLE_VAR" and .value == "role-value")'
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
- name: airflow
resources:
limits:
cpu: 810m
cpu: 2000m
config:
resources:
cpu:
Expand Down
2 changes: 2 additions & 0 deletions tests/templates/kuttl/overrides/21-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ kind: TestAssert
timeout: 30
commands:
- script: |
set -eu

kubectl -n $NAMESPACE get cm airflow-kubernetes-executor-pod-template -o json | jq -r '.data."airflow_executor_pod_template.yaml"' | yq -e '.spec.containers.[0].resources.limits | select (.cpu == "750m")'
kubectl -n $NAMESPACE get cm airflow-kubernetes-executor-pod-template -o json | jq -r '.data."airflow_executor_pod_template.yaml"' | yq -e '.spec.containers[] | select (.name == "base") | .env[] | select (.name == "AIRFLOW__METRICS__STATSD_ON" and .value == "False")'