Skip to content

Commit

Permalink
Flower K8s Probe config (apache#37528)
Browse files Browse the repository at this point in the history
  • Loading branch information
Seokyun-Ha authored and abhishekbhakat committed Mar 5, 2024
1 parent d25364b commit a312629
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 6 deletions.
14 changes: 8 additions & 6 deletions chart/templates/flower/flower-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ spec:
- name: flower-ui
containerPort: {{ .Values.ports.flowerUI }}
livenessProbe:
failureThreshold: 10
failureThreshold: {{ .Values.flower.livenessProbe.failureThreshold }}
exec:
command:
- curl
Expand All @@ -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
Expand All @@ -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:
Expand Down
54 changes: 54 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
13 changes: 13 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ~

Expand Down
24 changes: 24 additions & 0 deletions helm_tests/other/test_flower.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,30 @@ def test_should_add_component_specific_annotations(self):
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."""
Expand Down

0 comments on commit a312629

Please sign in to comment.