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
8 changes: 8 additions & 0 deletions chart/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,14 @@ DEPRECATION WARNING:

{{- end }}

{{- if not (empty .Values.workers.updateStrategy) }}

DEPRECATION WARNING:
`workers.updateStrategy` has been renamed to `workers.celery.updateStrategy`.
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 #
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/workers/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ spec:
{{- if and $persistence .Values.workers.podManagementPolicy }}
podManagementPolicy: {{ .Values.workers.podManagementPolicy }}
{{- end }}
{{- if and $persistence .Values.workers.updateStrategy }}
updateStrategy: {{- toYaml .Values.workers.updateStrategy | nindent 4 }}
{{- 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 }}
Expand Down
10 changes: 9 additions & 1 deletion chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,7 @@
}
},
"updateStrategy": {
"description": "Specifies the strategy used to replace old Airflow Celery worker pods by new ones when deployed as a StatefulSet.",
"description": "Specifies the strategy used to replace old Airflow Celery worker pods by new ones when deployed as a StatefulSet (deprecated, use `workers.celery.updateStrategy` instead).",
"type": [
"null",
"object"
Expand Down Expand Up @@ -2661,6 +2661,14 @@
}
}
},
"updateStrategy": {
"description": "Specifies the strategy used to replace old Airflow Celery worker pods by new ones when deployed as a StatefulSet.",
"type": [
"null",
"object"
],
"default": null
},
"serviceAccount": {
"description": "Create ServiceAccount.",
"type": "object",
Expand Down
4 changes: 4 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ workers:
command: ~

# Update Strategy when Airflow Celery worker is deployed as a StatefulSet
# (deprecated, use `workers.celery.updateStrategy` instead)
updateStrategy: ~
# Update Strategy when Airflow Celery worker is deployed as a Deployment
strategy:
Expand Down Expand Up @@ -1055,6 +1056,9 @@ workers:
periodSeconds: 60
command: ~

# Update Strategy when Airflow Celery worker is deployed as a StatefulSet
updateStrategy: ~

# Create ServiceAccount for Airflow Celery workers
serviceAccount:
# default value is true
Expand Down
43 changes: 34 additions & 9 deletions helm-tests/tests/helm_tests/airflow_core/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,21 +391,46 @@ def test_workers_host_aliases(self):
assert jmespath.search("spec.template.spec.hostAliases[0].hostnames[0]", docs[0]) == "test.hostname"

@pytest.mark.parametrize(
("persistence", "update_strategy", "expected_update_strategy"),
("workers_values", "expected_update_strategy"),
[
(False, None, None),
(True, {"rollingUpdate": {"partition": 0}}, {"rollingUpdate": {"partition": 0}}),
(True, None, None),
({"celery": {"persistence": {"enabled": False}}}, None),
({"updateStrategy": None, "celery": {"persistence": {"enabled": False}}}, None),
(
{
"updateStrategy": {"rollingUpdate": {"partition": 0}},
"celery": {"persistence": {"enabled": True}},
},
{"rollingUpdate": {"partition": 0}},
),
({"updateStrategy": None, "celery": {"persistence": {"enabled": True}}}, None),
({"celery": {"updateStrategy": None, "persistence": {"enabled": False}}}, None),
(
{
"celery": {
"updateStrategy": {"rollingUpdate": {"partition": 0}},
"persistence": {"enabled": True},
}
},
{"rollingUpdate": {"partition": 0}},
),
({"celery": {"updateStrategy": None, "persistence": {"enabled": True}}}, None),
(
{
"updateStrategy": {"rollingUpdate": {"partition": 1}},
"celery": {
"updateStrategy": {"rollingUpdate": {"partition": 0}},
"persistence": {"enabled": True},
},
},
{"rollingUpdate": {"partition": 0}},
),
],
)
def test_workers_update_strategy(self, persistence, update_strategy, expected_update_strategy):
def test_workers_update_strategy(self, workers_values, expected_update_strategy):
docs = render_chart(
values={
"executor": "CeleryExecutor",
"workers": {
"celery": {"persistence": {"enabled": persistence}},
"updateStrategy": update_strategy,
},
"workers": workers_values,
},
show_only=["templates/workers/worker-deployment.yaml"],
)
Expand Down