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 39b277cce24 Add workers.celery.args field (#60163)
39b277cce24 is described below
commit 39b277cce2437dfbf500d0a4e1ddbd5713433db9
Author: Przemysław Mirowski <[email protected]>
AuthorDate: Tue Jan 6 18:46:08 2026 +0100
Add workers.celery.args field (#60163)
* Remove duplicated test case for workers command
* Add workers.celery.args field
* Add newsfragment
---
chart/newsfragments/60163.significant.rst | 3 ++
chart/templates/NOTES.txt | 8 ++++++
chart/templates/workers/worker-deployment.yaml | 4 +--
chart/values.schema.json | 17 ++++++++++-
chart/values.yaml | 9 ++++++
.../tests/helm_tests/airflow_core/test_worker.py | 33 ++++++++++------------
6 files changed, 53 insertions(+), 21 deletions(-)
diff --git a/chart/newsfragments/60163.significant.rst
b/chart/newsfragments/60163.significant.rst
new file mode 100644
index 00000000000..e095884e142
--- /dev/null
+++ b/chart/newsfragments/60163.significant.rst
@@ -0,0 +1,3 @@
+``workers.args`` command is now deprecated in favor of ``workers.celery.args``.
+
+Along the upgrade of Helm Chart version, change the configuration of
``workers.args`` to ``workers.celery.args`` or unset ``workers.celery.args`` to
preserve previous behaviour of the Helm Chart.
diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt
index 6c0e30009c8..a3f42177d7a 100644
--- a/chart/templates/NOTES.txt
+++ b/chart/templates/NOTES.txt
@@ -204,6 +204,14 @@ DEPRECATION WARNING:
{{- end }}
+{{- if ne (.Values.workers.args | toJson) (list "bash" "-c" "exec \\\nairflow
{{ semverCompare \">=2.0.0\" .Values.airflowVersion | ternary \"celery worker\"
\"worker\" }}" | toJson) }}
+
+ DEPRECATION WARNING:
+ `workers.args` has been renamed to `workers.celery.args`.
+ 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 d0cbfadf8fd..b1084aaf95f 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -252,8 +252,8 @@ spec:
{{- if or .Values.workers.celery.command .Values.workers.command }}
command: {{ tpl (toYaml (.Values.workers.celery.command | default
.Values.workers.command)) . | nindent 12 }}
{{- end }}
- {{- if .Values.workers.args }}
- args: {{ tpl (toYaml .Values.workers.args) . | nindent 12 }}
+ {{- if or .Values.workers.celery.args .Values.workers.args }}
+ args: {{ tpl (toYaml (.Values.workers.celery.args | default
.Values.workers.args)) . | nindent 12 }}
{{- end }}
resources: {{- toYaml .Values.workers.resources | nindent 12 }}
{{- if .Values.workers.livenessProbe.enabled }}
diff --git a/chart/values.schema.json b/chart/values.schema.json
index 452810075cb..b9f161d71c0 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -1660,7 +1660,7 @@
"default": null
},
"args": {
- "description": "Args to use when running Airflow Celery
workers (templated).",
+ "description": "Args to use when running Airflow Celery
workers (templated) (deprecated, use `workers.celery.args` instead).",
"type": [
"array",
"null"
@@ -2633,6 +2633,21 @@
},
"default": null
},
+ "args": {
+ "description": "Args to use when running Airflow
Celery workers (templated).",
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "type": "string"
+ },
+ "default": [
+ "bash",
+ "-c",
+ "exec \\\nairflow {{ semverCompare \">=2.0.0\"
.Values.airflowVersion | ternary \"celery worker\" \"worker\" }}"
+ ]
+ },
"serviceAccount": {
"description": "Create ServiceAccount.",
"type": "object",
diff --git a/chart/values.yaml b/chart/values.yaml
index 66746b47ee2..2f0f4dd97c6 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -650,6 +650,7 @@ workers:
command: ~
# Args to use when running Airflow Celery workers (templated)
+ # (deprecated, use `workers.celery.args` instead)
args:
- "bash"
- "-c"
@@ -1024,6 +1025,14 @@ workers:
# Command to use when running Airflow Celery workers (templated)
command: ~
+ # Args to use when running Airflow Celery workers (templated)
+ args:
+ - "bash"
+ - "-c"
+ - |-
+ exec \
+ airflow {{ semverCompare ">=2.0.0" .Values.airflowVersion | ternary
"celery worker" "worker" }}
+
# Create ServiceAccount for Airflow Celery workers
serviceAccount:
# default value is true
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 27c4a44e839..472ad3f2066 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
@@ -817,10 +817,6 @@ class TestWorker:
({"celery": {"command": ["custom", "command"]}}, ["custom",
"command"]),
({"celery": {"command": ["custom", "{{ .Release.Name }}"]}},
["custom", "release-name"]),
({"command": ["test"], "celery": {"command": ["custom",
"command"]}}, ["custom", "command"]),
- (
- {"command": ["test"], "celery": {"command": ["custom", "{{
.Release.Name }}"]}},
- ["custom", "release-name"],
- ),
],
)
def test_should_add_command(self, workers_values, expected):
@@ -849,29 +845,30 @@ class TestWorker:
assert jmespath.search("spec.template.spec.containers[0].command",
docs[0]) is None
@pytest.mark.parametrize(
- ("args", "expected"),
+ ("workers_values", "expected"),
[
- (["custom", "args"], ["custom", "args"]),
- (["custom", "{{ .Release.Service }}"], ["custom", "Helm"]),
+ ({"args": None}, ["bash", "-c", "exec \\\nairflow celery worker"]),
+ ({"args": []}, ["bash", "-c", "exec \\\nairflow celery worker"]),
+ ({"celery": {"args": None}}, ["bash", "-c", "exec \\\nairflow
celery worker"]),
+ ({"celery": {"args": []}}, ["bash", "-c", "exec \\\nairflow celery
worker"]),
+ ({"args": ["custom", "args"]}, ["bash", "-c", "exec \\\nairflow
celery worker"]),
+ (
+ {"args": ["custom", "{{ .Release.Service }}"]},
+ ["bash", "-c", "exec \\\nairflow celery worker"],
+ ),
+ ({"celery": {"args": ["custom", "args"]}}, ["custom", "args"]),
+ ({"celery": {"args": ["custom", "{{ .Release.Service }}"]}},
["custom", "Helm"]),
+ ({"args": ["test"], "celery": {"args": ["custom", "args"]}},
["custom", "args"]),
],
)
- def test_should_add_args(self, args, expected):
+ def test_should_add_args(self, workers_values, expected):
docs = render_chart(
- values={"workers": {"args": args}},
+ values={"workers": workers_values},
show_only=["templates/workers/worker-deployment.yaml"],
)
assert expected ==
jmespath.search("spec.template.spec.containers[0].args", docs[0])
- @pytest.mark.parametrize("args", [None, []])
- def test_should_not_add_args(self, args):
- docs = render_chart(
- values={"workers": {"args": args}},
- show_only=["templates/workers/worker-deployment.yaml"],
- )
-
- assert jmespath.search("spec.template.spec.containers[0].args",
docs[0]) is None
-
def test_dags_gitsync_sidecar_and_init_container(self):
docs = render_chart(
values={"dags": {"gitSync": {"enabled": True}}},