This is an automated email from the ASF dual-hosted git repository.
jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 94fa8ced6fb Add workers.celery.strategy field (#60354)
94fa8ced6fb is described below
commit 94fa8ced6fbc96dc3979ef872dcb32f9d937fe0b
Author: Przemysław Mirowski <[email protected]>
AuthorDate: Sat Jan 10 15:56:02 2026 +0100
Add workers.celery.strategy field (#60354)
* Add workers.celery.strategy field
* Add newsfragment
---
chart/newsfragments/60354.significant.rst | 3 ++
chart/templates/NOTES.txt | 8 ++++++
chart/templates/workers/worker-deployment.yaml | 4 +--
chart/values.schema.json | 15 +++++++++-
chart/values.yaml | 6 ++++
.../tests/helm_tests/airflow_core/test_worker.py | 32 ++++++++++++++++++----
6 files changed, 59 insertions(+), 9 deletions(-)
diff --git a/chart/newsfragments/60354.significant.rst
b/chart/newsfragments/60354.significant.rst
new file mode 100644
index 00000000000..ed0aa53e8b2
--- /dev/null
+++ b/chart/newsfragments/60354.significant.rst
@@ -0,0 +1,3 @@
+``workers.strategy`` section is now deprecated in favor of
``workers.celery.strategy``.
+
+Along the upgrade of Helm Chart version, change the configuration of values in
section ``workers.strategy`` to ``workers.celery.strategy`` section or unset
all values under ``workers.celery.strategy`` to preserve previous behaviour of
the Helm Chart.
diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt
index 174df85336d..fc79327ddf1 100644
--- a/chart/templates/NOTES.txt
+++ b/chart/templates/NOTES.txt
@@ -324,6 +324,14 @@ DEPRECATION WARNING:
{{- end }}
+{{- if ne (toJson .Values.workers.strategy | quote) (toJson
"{\"rollingUpdate\":{\"maxSurge\":\"100%\",\"maxUnavailable\":\"50%\"}}") }}
+
+ DEPRECATION WARNING:
+ `workers.strategy` has been renamed to `workers.celery.strategy`.
+ Please change your values as support for the old name will be dropped in a
future release.
+
+{{- end }}
+
{{ if (semverCompare ">=3.0.0" .Values.airflowVersion) }}
#####################################################
# WARNING: You should set a static API secret key #
diff --git a/chart/templates/workers/worker-deployment.yaml
b/chart/templates/workers/worker-deployment.yaml
index a43aab7f55c..1a1fde0cac3 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -82,8 +82,8 @@ spec:
{{- if and $persistence (or .Values.workers.celery.updateStrategy
.Values.workers.updateStrategy) }}
updateStrategy: {{- toYaml (.Values.workers.celery.updateStrategy | default
.Values.workers.updateStrategy) | nindent 4 }}
{{- end }}
- {{- if and (not $persistence) (.Values.workers.strategy) }}
- strategy: {{- toYaml .Values.workers.strategy | nindent 4 }}
+ {{- if and (not $persistence) (or .Values.workers.celery.strategy
.Values.workers.strategy) }}
+ strategy: {{- toYaml (.Values.workers.celery.strategy | default
.Values.workers.strategy) | nindent 4 }}
{{- end }}
template:
metadata:
diff --git a/chart/values.schema.json b/chart/values.schema.json
index 02f826020b1..f3132d6a006 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -1737,7 +1737,7 @@
]
},
"strategy": {
- "description": "Specifies the strategy used to replace old
Airflow Celery worker pods by new ones when deployed as a Deployment.",
+ "description": "Specifies the strategy used to replace old
Airflow Celery worker pods by new ones when deployed as a Deployment
(deprecated, use `workers.celery.strategy` instead).",
"type": [
"null",
"object"
@@ -2669,6 +2669,19 @@
],
"default": null
},
+ "strategy": {
+ "description": "Specifies the strategy used to
replace old Airflow Celery worker pods by new ones when deployed as a
Deployment.",
+ "type": [
+ "null",
+ "object"
+ ],
+ "default": {
+ "rollingUpdate": {
+ "maxSurge": "100%",
+ "maxUnavailable": "50%"
+ }
+ }
+ },
"serviceAccount": {
"description": "Create ServiceAccount.",
"type": "object",
diff --git a/chart/values.yaml b/chart/values.yaml
index afa29fd9c5b..be3bb953beb 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -680,6 +680,7 @@ workers:
# (deprecated, use `workers.celery.updateStrategy` instead)
updateStrategy: ~
# Update Strategy when Airflow Celery worker is deployed as a Deployment
+ # (deprecated, use `workers.celery.strategy` instead)
strategy:
rollingUpdate:
maxSurge: "100%"
@@ -1058,6 +1059,11 @@ workers:
# Update Strategy when Airflow Celery worker is deployed as a StatefulSet
updateStrategy: ~
+ # Update Strategy when Airflow Celery worker is deployed as a Deployment
+ strategy:
+ rollingUpdate:
+ maxSurge: "100%"
+ maxUnavailable: "50%"
# Create ServiceAccount for Airflow Celery workers
serviceAccount:
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 93687bd04b6..d8a07c3b00f 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
@@ -438,22 +438,42 @@ class TestWorker:
assert expected_update_strategy ==
jmespath.search("spec.updateStrategy", docs[0])
@pytest.mark.parametrize(
- ("persistence", "strategy", "expected_strategy"),
+ ("workers_values", "expected_strategy"),
[
- (True, None, None),
+ ({"celery": {"persistence": {"enabled": True}}}, None),
(
- False,
+ {"celery": {"persistence": {"enabled": False}}},
+ {"rollingUpdate": {"maxSurge": "100%", "maxUnavailable":
"50%"}},
+ ),
+ (
+ {"strategy": None, "celery": {"persistence": {"enabled":
False}}},
+ {"rollingUpdate": {"maxSurge": "100%", "maxUnavailable":
"50%"}},
+ ),
+ (
+ {
+ "strategy": {"rollingUpdate": {"maxSurge": "50%",
"maxUnavailable": "100%"}},
+ "celery": {"persistence": {"enabled": False}},
+ },
{"rollingUpdate": {"maxSurge": "100%", "maxUnavailable":
"50%"}},
+ ),
+ (
+ {"celery": {"strategy": None, "persistence": {"enabled":
False}}},
{"rollingUpdate": {"maxSurge": "100%", "maxUnavailable":
"50%"}},
),
- (False, None, None),
+ (
+ {
+ "strategy": {"rollingUpdate": {"maxSurge": "50%",
"maxUnavailable": "100%"}},
+ "celery": {"strategy": None, "persistence": {"enabled":
False}},
+ },
+ {"rollingUpdate": {"maxSurge": "50%", "maxUnavailable":
"100%"}},
+ ),
],
)
- def test_workers_strategy(self, persistence, strategy, expected_strategy):
+ def test_workers_strategy(self, workers_values, expected_strategy):
docs = render_chart(
values={
"executor": "CeleryExecutor",
- "workers": {"celery": {"persistence": {"enabled":
persistence}}, "strategy": strategy},
+ "workers": workers_values,
},
show_only=["templates/workers/worker-deployment.yaml"],
)