This is an automated email from the ASF dual-hosted git repository.

Miretpl pushed a commit to branch chart/v1-2x-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/chart/v1-2x-test by this push:
     new 937b638f0c5 [chart/v1-2x-test] Add terminationGracePeriodSeconds to 
the Celery worker liveness probe (#76749) (#77121)
937b638f0c5 is described below

commit 937b638f0c55c9c6569d0ca947644b1200915c8a
Author: Sebastian Daberdaku <[email protected]>
AuthorDate: Sun Nov 15 22:07:35 2026 +0100

    [chart/v1-2x-test] Add terminationGracePeriodSeconds to the Celery worker 
liveness probe (#76749) (#77121)
    
    (cherry picked from commit 1195d1b11ccd7178d09960a9ea47ab005983c540)
    
    Co-authored-by: Przemysław Mirowski 
<[email protected]>
---
 chart/templates/workers/worker-deployment.yaml     |  3 +++
 chart/values.schema.json                           |  9 +++++++
 chart/values.yaml                                  |  1 +
 .../tests/helm_tests/airflow_core/test_worker.py   | 30 ++++++++++++++++++++++
 4 files changed, 43 insertions(+)

diff --git a/chart/templates/workers/worker-deployment.yaml 
b/chart/templates/workers/worker-deployment.yaml
index 223398993e8..cdbf9f8b0a6 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -296,6 +296,9 @@ spec:
             timeoutSeconds: {{ .Values.workers.livenessProbe.timeoutSeconds }}
             failureThreshold: {{ 
.Values.workers.livenessProbe.failureThreshold }}
             periodSeconds: {{ .Values.workers.livenessProbe.periodSeconds }}
+            {{- if .Values.workers.livenessProbe.terminationGracePeriodSeconds 
}}
+            terminationGracePeriodSeconds: {{ 
.Values.workers.livenessProbe.terminationGracePeriodSeconds }}
+            {{- end }}
             exec:
               command:
                 {{- if .Values.workers.livenessProbe.command }}
diff --git a/chart/values.schema.json b/chart/values.schema.json
index d850333b1be..8a192e48625 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -3005,6 +3005,15 @@
                                     "items": {
                                         "type": "string"
                                     }
+                                },
+                                "terminationGracePeriodSeconds": {
+                                    "description": "Grace period, in seconds, 
for a kill triggered by this probe. Overrides the pod's 
`terminationGracePeriodSeconds` for liveness kills only. If set, minimum value 
is 1.",
+                                    "type": [
+                                        "integer",
+                                        "null"
+                                    ],
+                                    "default": null,
+                                    "minimum": 1
                                 }
                             }
                         },
diff --git a/chart/values.yaml b/chart/values.yaml
index f1bbcd33b55..31486fa8be1 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -1306,6 +1306,7 @@ workers:
       failureThreshold: ~
       periodSeconds: ~
       command: ~
+      terminationGracePeriodSeconds: ~
 
     # Enable the default workers defined by the root `workers` and 
`workers.celery`
     # configurations to be created.
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 0bf168912bc..df3dfb79085 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
@@ -1128,6 +1128,36 @@ class TestWorker:
         livenessprobe = 
jmespath.search("spec.template.spec.containers[0].livenessProbe", docs[0])
         assert livenessprobe is None
 
+    def test_livenessprobe_termination_grace_period_unset_by_default(self):
+        docs = 
render_chart(show_only=["templates/workers/worker-deployment.yaml"])
+
+        assert (
+            jmespath.search(
+                
"spec.template.spec.containers[0].livenessProbe.terminationGracePeriodSeconds", 
docs[0]
+            )
+            is None
+        )
+
+    def test_livenessprobe_termination_grace_period(self):
+        docs = render_chart(
+            values={"workers": {"celery": {"livenessProbe": 
{"terminationGracePeriodSeconds": 120}}}},
+            show_only=["templates/workers/worker-deployment.yaml"],
+        )
+
+        assert (
+            jmespath.search(
+                
"spec.template.spec.containers[0].livenessProbe.terminationGracePeriodSeconds", 
docs[0]
+            )
+            == 120
+        )
+
+    def test_livenessprobe_termination_grace_period_rejects_zero(self):
+        with pytest.raises(HelmFailedError):
+            render_chart(
+                values={"workers": {"celery": {"livenessProbe": 
{"terminationGracePeriodSeconds": 0}}}},
+                show_only=["templates/workers/worker-deployment.yaml"],
+            )
+
     def test_extra_init_container_restart_policy_is_configurable(self):
         docs = render_chart(
             values={

Reply via email to