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

potiuk 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 004dcb7e34 Flower K8s Probe config (#37528)
004dcb7e34 is described below

commit 004dcb7e34c2877acdc848d9636b3641e85acef6
Author: seokyun.ha <[email protected]>
AuthorDate: Wed Feb 21 06:06:17 2024 +0900

    Flower K8s Probe config (#37528)
---
 chart/templates/flower/flower-deployment.yaml | 14 ++++---
 chart/values.schema.json                      | 54 +++++++++++++++++++++++++++
 chart/values.yaml                             | 13 +++++++
 helm_tests/other/test_flower.py               | 24 ++++++++++++
 4 files changed, 99 insertions(+), 6 deletions(-)

diff --git a/chart/templates/flower/flower-deployment.yaml 
b/chart/templates/flower/flower-deployment.yaml
index 00f8f4a9af..83737c6d0c 100644
--- a/chart/templates/flower/flower-deployment.yaml
+++ b/chart/templates/flower/flower-deployment.yaml
@@ -116,7 +116,7 @@ spec:
             - name: flower-ui
               containerPort: {{ .Values.ports.flowerUI }}
           livenessProbe:
-            failureThreshold: 10
+            failureThreshold: {{ .Values.flower.livenessProbe.failureThreshold 
}}
             exec:
               command:
                 - curl
@@ -125,10 +125,11 @@ spec:
                 - $AIRFLOW__CELERY__FLOWER_BASIC_AUTH
                 {{- end }}
                 - {{ printf "localhost:%s" (.Values.ports.flowerUI | toString) 
}}
-            initialDelaySeconds: 10
-            periodSeconds: 5
+            initialDelaySeconds: {{ 
.Values.flower.livenessProbe.initialDelaySeconds }}
+            periodSeconds: {{ .Values.flower.livenessProbe.periodSeconds }}
+            timeoutSeconds: {{ .Values.flower.livenessProbe.timeoutSeconds }}
           readinessProbe:
-            failureThreshold: 10
+            failureThreshold: {{ 
.Values.flower.readinessProbe.failureThreshold }}
             exec:
               command:
                 - curl
@@ -137,8 +138,9 @@ spec:
                 - $AIRFLOW__CELERY__FLOWER_BASIC_AUTH
                 {{- end }}
                 - {{ printf "localhost:%s" (.Values.ports.flowerUI | toString) 
}}
-            initialDelaySeconds: 10
-            periodSeconds: 5
+            initialDelaySeconds: {{ 
.Values.flower.readinessProbe.initialDelaySeconds }}
+            periodSeconds: {{ .Values.flower.readinessProbe.periodSeconds }}
+            timeoutSeconds: {{ .Values.flower.readinessProbe.timeoutSeconds }}
           envFrom:
           {{- include "custom_airflow_environment_from" . | default "\n  []" | 
indent 10 }}
           env:
diff --git a/chart/values.schema.json b/chart/values.schema.json
index 7df2adf3fd..fa7accbbf3 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -4955,6 +4955,60 @@
                     "type": "boolean",
                     "default": false
                 },
+                "livenessProbe": {
+                    "description": "Liveness probe configuration.",
+                    "type": "object",
+                    "additionalProperties": false,
+                    "properties": {
+                        "initialDelaySeconds": {
+                            "description": "Flower Liveness probe initial 
delay.",
+                            "type": "integer",
+                            "default": 10
+                        },
+                        "timeoutSeconds": {
+                            "description": "Flower Liveness probe timeout 
seconds.",
+                            "type": "integer",
+                            "default": 5
+                        },
+                        "failureThreshold": {
+                            "description": "Flower Liveness probe failure 
threshold.",
+                            "type": "integer",
+                            "default": 10
+                        },
+                        "periodSeconds": {
+                            "description": "Flower Liveness probe period 
seconds.",
+                            "type": "integer",
+                            "default": 5
+                        }
+                    }
+                },
+                "readinessProbe": {
+                    "description": "Readiness probe configuration.",
+                    "type": "object",
+                    "additionalProperties": false,
+                    "properties": {
+                        "initialDelaySeconds": {
+                            "description": "Flower Readiness probe initial 
delay.",
+                            "type": "integer",
+                            "default": 10
+                        },
+                        "timeoutSeconds": {
+                            "description": "Flower Readiness probe timeout 
seconds.",
+                            "type": "integer",
+                            "default": 5
+                        },
+                        "failureThreshold": {
+                            "description": "Flower Readiness probe failure 
threshold.",
+                            "type": "integer",
+                            "default": 10
+                        },
+                        "periodSeconds": {
+                            "description": "Flower Readiness probe period 
seconds.",
+                            "type": "integer",
+                            "default": 5
+                        }
+                    }
+                },
                 "revisionHistoryLimit": {
                     "description": "Number of old replicasets to retain.",
                     "type": [
diff --git a/chart/values.yaml b/chart/values.yaml
index 9e8b333acb..c16f5088ce 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -1708,6 +1708,19 @@ flower:
   # Enable flower.
   # If True, and using CeleryExecutor/CeleryKubernetesExecutor, will deploy 
flower app.
   enabled: false
+
+  livenessProbe:
+    initialDelaySeconds: 10
+    timeoutSeconds: 5
+    failureThreshold: 10
+    periodSeconds: 5
+
+  readinessProbe:
+    initialDelaySeconds: 10
+    timeoutSeconds: 5
+    failureThreshold: 10
+    periodSeconds: 5
+
   # Max number of old replicasets to retain
   revisionHistoryLimit: ~
 
diff --git a/helm_tests/other/test_flower.py b/helm_tests/other/test_flower.py
index 48512776a9..93a40ac38a 100644
--- a/helm_tests/other/test_flower.py
+++ b/helm_tests/other/test_flower.py
@@ -363,6 +363,30 @@ class TestFlowerDeployment:
         assert "annotations" in jmespath.search("metadata", docs[0])
         assert jmespath.search("metadata.annotations", 
docs[0])["test_annotation"] == "test_annotation_value"
 
+    @pytest.mark.parametrize("probe", ["livenessProbe", "readinessProbe"])
+    def test_probe_values_are_configurable(self, probe):
+        docs = render_chart(
+            values={
+                "flower": {
+                    "enabled": True,
+                    probe: {
+                        "initialDelaySeconds": 111,
+                        "timeoutSeconds": 222,
+                        "failureThreshold": 333,
+                        "periodSeconds": 444,
+                    },
+                },
+            },
+            show_only=["templates/flower/flower-deployment.yaml"],
+        )
+
+        assert 111 == jmespath.search(
+            f"spec.template.spec.containers[0].{probe}.initialDelaySeconds", 
docs[0]
+        )
+        assert 222 == 
jmespath.search(f"spec.template.spec.containers[0].{probe}.timeoutSeconds", 
docs[0])
+        assert 333 == 
jmespath.search(f"spec.template.spec.containers[0].{probe}.failureThreshold", 
docs[0])
+        assert 444 == 
jmespath.search(f"spec.template.spec.containers[0].{probe}.periodSeconds", 
docs[0])
+
 
 class TestFlowerService:
     """Tests flower service."""

Reply via email to