You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/04/12 22:47:21 UTC
[airflow] branch master updated: Add Configurable LivenessProbe
Values to Scheduler (#15333)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new 8b56629 Add Configurable LivenessProbe Values to Scheduler (#15333)
8b56629 is described below
commit 8b56629ecd44d346e35c146779e2bb5422af1b5d
Author: Ian Stanton <ia...@astronomer.io>
AuthorDate: Mon Apr 12 18:46:59 2021 -0400
Add Configurable LivenessProbe Values to Scheduler (#15333)
- Add configurable livenessProbe values to scheduler component in helm chart
- Increase default values to avoid livenessProbe failure
- Closes: #15259
---
.../templates/scheduler/scheduler-deployment.yaml | 8 +++----
chart/tests/test_scheduler.py | 26 ++++++++++++++++++++++
chart/values.schema.json | 23 +++++++++++++++++++
chart/values.yaml | 7 ++++++
4 files changed, 60 insertions(+), 4 deletions(-)
diff --git a/chart/templates/scheduler/scheduler-deployment.yaml b/chart/templates/scheduler/scheduler-deployment.yaml
index 702e514..7e90442 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -116,11 +116,11 @@ spec:
env:
{{- include "custom_airflow_environment" . | indent 10 }}
{{- include "standard_airflow_environment" . | indent 10 }}
- # If the scheduler stops heartbeating for 5 minutes (10*30s) kill the
- # scheduler and let Kubernetes restart it
livenessProbe:
- failureThreshold: 10
- periodSeconds: 30
+ initialDelaySeconds: {{ .Values.scheduler.livenessProbe.initialDelaySeconds }}
+ timeoutSeconds: {{ .Values.scheduler.livenessProbe.timeoutSeconds }}
+ failureThreshold: {{ .Values.scheduler.livenessProbe.failureThreshold }}
+ periodSeconds: {{ .Values.scheduler.livenessProbe.periodSeconds }}
exec:
command:
- python
diff --git a/chart/tests/test_scheduler.py b/chart/tests/test_scheduler.py
index 57173fb..c65a81d 100644
--- a/chart/tests/test_scheduler.py
+++ b/chart/tests/test_scheduler.py
@@ -128,3 +128,29 @@ class SchedulerTest(unittest.TestCase):
"spec.template.spec.tolerations[0].key",
docs[0],
)
+
+ def test_livenessprobe_values_are_configurable(self):
+ docs = render_chart(
+ values={
+ "scheduler": {
+ "livenessProbe": {
+ "initialDelaySeconds": 111,
+ "timeoutSeconds": 222,
+ "failureThreshold": 333,
+ "periodSeconds": 444,
+ }
+ },
+ },
+ show_only=["templates/scheduler/scheduler-deployment.yaml"],
+ )
+
+ assert 111 == jmespath.search(
+ "spec.template.spec.containers[0].livenessProbe.initialDelaySeconds", docs[0]
+ )
+ assert 222 == jmespath.search(
+ "spec.template.spec.containers[0].livenessProbe.timeoutSeconds", docs[0]
+ )
+ assert 333 == jmespath.search(
+ "spec.template.spec.containers[0].livenessProbe.failureThreshold", docs[0]
+ )
+ assert 444 == jmespath.search("spec.template.spec.containers[0].livenessProbe.periodSeconds", docs[0])
diff --git a/chart/values.schema.json b/chart/values.schema.json
index c09bef2..b1060fd 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -682,6 +682,29 @@
"type": "object",
"additionalProperties": false,
"properties": {
+ "livenessProbe": {
+ "description": "Liveness probe configuration.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "initialDelaySeconds": {
+ "description": "Scheduler Liveness probe initial delay.",
+ "type": "integer"
+ },
+ "timeoutSeconds": {
+ "description": "Scheduler Liveness probe timeout seconds.",
+ "type": "integer"
+ },
+ "failureThreshold": {
+ "description": "Scheduler Liveness probe failure threshold.",
+ "type": "integer"
+ },
+ "periodSeconds": {
+ "description": "Webserver Liveness probe period seconds.",
+ "type": "integer"
+ }
+ }
+ },
"replicas": {
"description": "Airflow 2.0 allows users to run multiple schedulers. This feature is only recommended for Mysql 8+ and postgres",
"type": "integer"
diff --git a/chart/values.yaml b/chart/values.yaml
index a38b234..ef23d40 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -385,6 +385,13 @@ workers:
# Airflow scheduler settings
scheduler:
+ # If the scheduler stops heartbeating for 5 minutes (10*30s) kill the
+ # scheduler and let Kubernetes restart it
+ livenessProbe:
+ initialDelaySeconds: 10
+ timeoutSeconds: 5
+ failureThreshold: 10
+ periodSeconds: 30
# Airflow 2.0 allows users to run multiple schedulers,
# However this feature is only recommended for MySQL 8+ and Postgres
replicas: 1