This is an automated email from the ASF dual-hosted git repository.
jscheffl 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 e1632535f78 Refactor Git-Sync livenessProbe & deprecate readinessProbe
& add startupProbe (#62334)
e1632535f78 is described below
commit e1632535f785fe83715bcd39da998f459ad400c7
Author: Przemysław Mirowski <[email protected]>
AuthorDate: Mon Mar 9 21:09:59 2026 +0100
Refactor Git-Sync livenessProbe & deprecate readinessProbe & add
startupProbe (#62334)
* Deploy Git-Sync liveness service
* Add recommendedProbeSetting flag
* Refactor git-sync probes tests
* Remove usage of GitSync readinessProbe
* Refactor git-sync liveness probe
* Add git-sync startup probe
* Misc
* Fix spellcheck
---
chart/newsfragments/62334.significant.rst | 5 +
chart/templates/NOTES.txt | 16 ++
chart/templates/_helpers.yaml | 30 +++-
chart/values.schema.json | 73 ++++++++-
chart/values.yaml | 27 ++++
.../helm_tests/airflow_aux/test_airflow_common.py | 18 +++
.../helm_tests/other/test_git_sync_scheduler.py | 174 +++++++++++++++++++--
.../helm_tests/other/test_git_sync_triggerer.py | 155 ++++++++++++++++--
.../tests/helm_tests/other/test_git_sync_worker.py | 155 ++++++++++++++++--
9 files changed, 613 insertions(+), 40 deletions(-)
diff --git a/chart/newsfragments/62334.significant.rst
b/chart/newsfragments/62334.significant.rst
new file mode 100644
index 00000000000..924e77869e4
--- /dev/null
+++ b/chart/newsfragments/62334.significant.rst
@@ -0,0 +1,5 @@
+As Git-Sync is not service-type object, the readiness probe will be removed.
To enable feature behaviour set ``dags.gitSync.recommendedProbeSetting`` to
``true``. Section itself will be removed in future release as to not break
setups during upgrades.
+
+As Git-Sync has dedicated liveness service, the liveness probe behaviour will
be changed. To enable feature behaviour set
``dags.gitSync.recommendedProbeSetting`` to ``true``.
+
+Please update your configuration accordingly.
diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt
index 79d967919dd..ba0ec138db6 100644
--- a/chart/templates/NOTES.txt
+++ b/chart/templates/NOTES.txt
@@ -196,6 +196,14 @@
https://airflow.apache.org/docs/helm-chart/stable/production-guide.html#knownhos
{{- end }}
+{{- if and .Values.dags.gitSync.enabled .Values.dags.gitSync.readinessProbe }}
+
+ DEPRECATION WARNING:
+ `dags.gitSync.readinessProbe` section has been removed as Git-Sync is not
service-type object.
+ Please remove overwrite values of section, if defined, as support it will
be removed in a future release.
+
+{{- end }}
+
{{- if .Values.flower.extraNetworkPolicies }}
DEPRECATION WARNING:
@@ -501,6 +509,14 @@ DEPRECATION WARNING:
{{- end }}
+{{- if not .Values.dags.gitSync.recommendedProbeSetting }}
+
+ DEPRECATION WARNING:
+ Dags Git-Sync bevaiour with `dags.gitSync.recommendedProbeSetting` equal
`false` is deprecated and will be removed in future.
+ Please change your values as support for the old name will be dropped in a
future release.
+
+{{- end }}
+
{{- if not (or .Values.webserverSecretKey .Values.webserverSecretKeySecretName
.Values.apiSecretKey .Values.apiSecretKeySecretName) }}
{{ if (semverCompare ">=3.0.0" .Values.airflowVersion) }}
#####################################################
diff --git a/chart/templates/_helpers.yaml b/chart/templates/_helpers.yaml
index f3f92a87c42..42848a9e22e 100644
--- a/chart/templates/_helpers.yaml
+++ b/chart/templates/_helpers.yaml
@@ -299,17 +299,43 @@ If release name contains chart name it will be used as a
full name.
value: "true"
- name: GITSYNC_ONE_TIME
value: "true"
+ {{- else }}
+ - name: GIT_SYNC_HTTP_BIND
+ value: ":{{ .Values.dags.gitSync.httpPort }}"
+ - name: GITSYNC_HTTP_BIND
+ value: ":{{ .Values.dags.gitSync.httpPort }}"
{{- end }}
{{- with .Values.dags.gitSync.env }}
{{- toYaml . | nindent 4 }}
{{- end }}
resources: {{ toYaml .Values.dags.gitSync.resources | nindent 4 }}
- {{- if and .Values.dags.gitSync.livenessProbe (not .is_init) }}
+ {{- if not .is_init }}
+ {{- if .Values.dags.gitSync.startupProbe.enabled }}
+ startupProbe:
+ httpGet:
+ path: /
+ port: {{ .Values.dags.gitSync.httpPort }}
+ timeoutSeconds: {{ .Values.dags.gitSync.startupProbe.timeoutSeconds }}
+ initialDelaySeconds: {{
.Values.dags.gitSync.startupProbe.initialDelaySeconds }}
+ periodSeconds: {{ .Values.dags.gitSync.startupProbe.periodSeconds }}
+ failureThreshold: {{ .Values.dags.gitSync.startupProbe.failureThreshold }}
+ {{- end }}
+ {{- if and .Values.dags.gitSync.recommendedProbeSetting (hasKey
.Values.dags.gitSync.livenessProbe "enabled")
.Values.dags.gitSync.livenessProbe.enabled }}
+ livenessProbe:
+ httpGet:
+ path: /
+ port: {{ .Values.dags.gitSync.httpPort }}
+ timeoutSeconds: {{ .Values.dags.gitSync.livenessProbe.timeoutSeconds |
default 1 }}
+ initialDelaySeconds: {{
.Values.dags.gitSync.livenessProbe.initialDelaySeconds | default 0 }}
+ periodSeconds: {{ .Values.dags.gitSync.livenessProbe.periodSeconds |
default 5 }}
+ failureThreshold: {{ .Values.dags.gitSync.livenessProbe.failureThreshold |
default 10 }}
+ {{- else if .Values.dags.gitSync.livenessProbe }}
livenessProbe: {{ tpl (toYaml .Values.dags.gitSync.livenessProbe) . |
nindent 4 }}
{{- end }}
- {{- if and .Values.dags.gitSync.readinessProbe (not .is_init) }}
+ {{- if and .Values.dags.gitSync.readinessProbe (not
.Values.dags.gitSync.recommendedProbeSetting) }}
readinessProbe: {{ tpl (toYaml .Values.dags.gitSync.readinessProbe) . |
nindent 4 }}
{{- end }}
+ {{- end }}
volumeMounts:
- name: dags
mountPath: /git
diff --git a/chart/values.schema.json b/chart/values.schema.json
index 74d931666da..5a8dfcd9123 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -10649,13 +10649,82 @@
}
]
},
+ "httpPort": {
+ "description": "Git-Sync liveness service http
bind port.",
+ "type": "integer",
+ "default": 1234
+ },
+ "recommendedProbeSetting": {
+ "description": "Setting this to true, will remove
readiness probe usage and configure liveness probe to use a dedicated Git-Sync
liveness service.",
+ "type": "boolean",
+ "default": false
+ },
+ "startupProbe": {
+ "description": "Startup probe configuration for
git sync container.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "enabled": {
+ "description": "Enable GitSync Kubernetes
Startup Probe.",
+ "type": "boolean",
+ "default": true
+ },
+ "timeoutSeconds": {
+ "description": "Number of seconds after
which the probe times out. Minimum value is 1 seconds.",
+ "type": "integer",
+ "default": 1
+ },
+ "initialDelaySeconds": {
+ "description": "Number of seconds after
the container has started before startup probe is initiated.",
+ "type": "integer",
+ "default": 0
+ },
+ "periodSeconds": {
+ "description": "How often (in seconds) to
perform the probe. Minimum value is 1.",
+ "type": "integer",
+ "default": 5
+ },
+ "failureThreshold": {
+ "description": "Minimum consecutive
failures for the probe to be considered failed after having succeeded. Minimum
value is 1.",
+ "type": "integer",
+ "default": 10
+ }
+ }
+ },
"livenessProbe": {
"description": "Liveness probe configuration for
git sync container.",
"type": "object",
- "$ref": "#/definitions/io.k8s.api.core.v1.Probe"
+ "additionalProperties": true,
+ "properties": {
+ "enabled": {
+ "description": "Enable GitSync Kubernetes
Liveness Probe.",
+ "type": "boolean",
+ "default": true
+ },
+ "timeoutSeconds": {
+ "description": "Number of seconds after
which the probe times out. Minimum value is 1 seconds.",
+ "type": "integer",
+ "default": 1
+ },
+ "initialDelaySeconds": {
+ "description": "Number of seconds after
the container has started before startup probe is initiated.",
+ "type": "integer",
+ "default": 0
+ },
+ "periodSeconds": {
+ "description": "How often (in seconds) to
perform the probe. Minimum value is 1.",
+ "type": "integer",
+ "default": 5
+ },
+ "failureThreshold": {
+ "description": "Minimum consecutive
failures for the probe to be considered failed after having succeeded. Minimum
value is 1.",
+ "type": "integer",
+ "default": 10
+ }
+ }
},
"readinessProbe": {
- "description": "Readiness probe configuration for
git sync container.",
+ "description": "Readiness probe configuration for
git sync container. As Git-Sync is not service-type object, the usage of the
section was removed. Section itself will be removed in future release as to not
break setups during upgrades.",
"type": "object",
"$ref": "#/definitions/io.k8s.api.core.v1.Probe"
},
diff --git a/chart/values.yaml b/chart/values.yaml
index 255db1700bc..bab02bdef30 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -3605,8 +3605,35 @@ dags:
# container level lifecycle hooks
containerLifecycleHooks: {}
+ # Git-Sync liveness service http bind port
+ httpPort: 1234
+
+ # Setting this to true, will remove readinessProbe usage and configure
livenessProbe to
+ # use a dedicated Git-Sync liveness service. In future, behaviour with
value true will be
+ # default one and old one will be removed
+ recommendedProbeSetting: false
+
+ startupProbe:
+ enabled: true
+ timeoutSeconds: 1
+ initialDelaySeconds: 0
+ periodSeconds: 5
+ failureThreshold: 10
+
+ # As Git-Sync is not service-type object, the usage of this section will
be removed.
+ # By setting dags.gitSync.recommendedProbeSetting to true, you will enable
future behaviour.
readinessProbe: {}
+
+ # The behaviour of the livenessProbe will change with the next release of
Helm Chart.
+ # To enable future behaviour set dags.gitSync.recommendedProbeSetting to
true.
+ # New behaviour uses the recommended liveness configuration by using
Git-Sync built-in
+ # liveness service
livenessProbe: {}
+ # enabled: true
+ # timeoutSeconds: 1
+ # initialDelaySeconds: 0
+ # periodSeconds: 5
+ # failureThreshold: 10
# Mount additional volumes into git-sync. It can be templated like in the
following example:
# extraVolumeMounts:
diff --git a/helm-tests/tests/helm_tests/airflow_aux/test_airflow_common.py
b/helm-tests/tests/helm_tests/airflow_aux/test_airflow_common.py
index c5eac7ce2c7..b3ad40e42ab 100644
--- a/helm-tests/tests/helm_tests/airflow_aux/test_airflow_common.py
+++ b/helm-tests/tests/helm_tests/airflow_aux/test_airflow_common.py
@@ -146,6 +146,24 @@ class TestAirflowCommon:
for doc in docs:
assert expected_mount in
jmespath.search("spec.template.spec.containers[0].volumeMounts", doc)
+ def test_git_sync_http_port(self):
+ docs = render_chart(
+ values={
+ "dags": {"gitSync": {"enabled": True, "httpPort": 10}},
+ },
+ show_only=[
+ "templates/dag-processor/dag-processor-deployment.yaml",
+ "templates/triggerer/triggerer-deployment.yaml",
+ "templates/workers/worker-deployment.yaml",
+ ],
+ )
+
+ assert len(docs) == 3
+ for doc in docs:
+ envs =
jmespath.search("spec.template.spec.containers[?name=='git-sync'] | [0].env",
doc)
+ assert {"name": "GIT_SYNC_HTTP_BIND", "value": ":10"} in envs
+ assert {"name": "GITSYNC_HTTP_BIND", "value": ":10"} in envs
+
@pytest.mark.parametrize(
"workers_values",
[
diff --git a/helm-tests/tests/helm_tests/other/test_git_sync_scheduler.py
b/helm-tests/tests/helm_tests/other/test_git_sync_scheduler.py
index 9c007a3f49c..71b5f69abd0 100644
--- a/helm-tests/tests/helm_tests/other/test_git_sync_scheduler.py
+++ b/helm-tests/tests/helm_tests/other/test_git_sync_scheduler.py
@@ -108,9 +108,18 @@ class TestGitSyncSchedulerTest:
{"name": "GITSYNC_PERIOD", "value": "66s"},
{"name": "GIT_SYNC_MAX_SYNC_FAILURES", "value": "70"},
{"name": "GITSYNC_MAX_FAILURES", "value": "70"},
+ {"name": "GIT_SYNC_HTTP_BIND", "value": ":1234"},
+ {"name": "GITSYNC_HTTP_BIND", "value": ":1234"},
],
"volumeMounts": [{"mountPath": "/git", "name": "dags"}],
"resources": {},
+ "startupProbe": {
+ "failureThreshold": 10,
+ "httpGet": {"path": "/", "port": 1234},
+ "initialDelaySeconds": 0,
+ "periodSeconds": 5,
+ "timeoutSeconds": 1,
+ },
}
def test_validate_the_git_sync_container_spec_if_wait_specified(self):
@@ -172,9 +181,18 @@ class TestGitSyncSchedulerTest:
{"name": "GITSYNC_PERIOD", "value": "66s"},
{"name": "GIT_SYNC_MAX_SYNC_FAILURES", "value": "70"},
{"name": "GITSYNC_MAX_FAILURES", "value": "70"},
+ {"name": "GIT_SYNC_HTTP_BIND", "value": ":1234"},
+ {"name": "GITSYNC_HTTP_BIND", "value": ":1234"},
],
"volumeMounts": [{"mountPath": "/git", "name": "dags"}],
"resources": {},
+ "startupProbe": {
+ "failureThreshold": 10,
+ "httpGet": {"path": "/", "port": 1234},
+ "initialDelaySeconds": 0,
+ "periodSeconds": 5,
+ "timeoutSeconds": 1,
+ },
}
def test_validate_if_ssh_params_are_added(self):
@@ -409,7 +427,7 @@ class TestGitSyncSchedulerTest:
)
assert
jmespath.search("spec.template.spec.containers[1].resources.requests.cpu",
docs[0]) == "300m"
- def test_liveliness_and_readiness_probes_are_configurable(self):
+ def test_liveness_probe_configuration(self):
livenessProbe = {
"failureThreshold": 10,
"exec": {"command": ["/bin/true"]},
@@ -418,6 +436,25 @@ class TestGitSyncSchedulerTest:
"successThreshold": 1,
"timeoutSeconds": 5,
}
+
+ docs = render_chart(
+ values={
+ "airflowVersion": "2.11.0",
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "livenessProbe": livenessProbe,
+ },
+ },
+ },
+ show_only=["templates/scheduler/scheduler-deployment.yaml"],
+ )
+
+ assert livenessProbe == jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].livenessProbe", docs[0]
+ )
+
+ def test_readiness_probe_configuration(self):
readinessProbe = {
"failureThreshold": 10,
"exec": {"command": ["/bin/true"]},
@@ -426,28 +463,141 @@ class TestGitSyncSchedulerTest:
"successThreshold": 1,
"timeoutSeconds": 5,
}
+
docs = render_chart(
values={
"airflowVersion": "2.11.0",
"dags": {
"gitSync": {
"enabled": True,
- "livenessProbe": livenessProbe,
"readinessProbe": readinessProbe,
},
},
},
show_only=["templates/scheduler/scheduler-deployment.yaml"],
)
- container_search_result = jmespath.search(
- "spec.template.spec.containers[?name == 'git-sync']", docs[0]
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].readinessProbe", docs[0]
+ )
+ is None
+ )
+
+ assert (
+ jmespath.search("spec.template.spec.containers[?name=='git-sync']
| [0].readinessProbe", docs[0])
+ == readinessProbe
+ )
+
+ def test_readiness_probe_configuration_recommended(self):
+ readinessProbe = {
+ "failureThreshold": 10,
+ "exec": {"command": ["/bin/true"]},
+ "initialDelaySeconds": 0,
+ "periodSeconds": 1,
+ "successThreshold": 1,
+ "timeoutSeconds": 5,
+ }
+
+ docs = render_chart(
+ values={
+ "airflowVersion": "2.11.0",
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "recommendedProbeSetting": True,
+ "readinessProbe": readinessProbe,
+ },
+ },
+ },
+ show_only=["templates/scheduler/scheduler-deployment.yaml"],
+ )
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].readinessProbe", docs[0]
+ )
+ is None
+ )
+
+ assert (
+ jmespath.search("spec.template.spec.containers[?name=='git-sync']
| [0].readinessProbe", docs[0])
+ is None
+ )
+
+ def test_liveness_probe_configuration_recommended(self):
+ docs = render_chart(
+ values={
+ "airflowVersion": "2.11.0",
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "httpPort": 10,
+ "recommendedProbeSetting": True,
+ "livenessProbe": {
+ "enabled": True,
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ },
+ },
+ },
+ },
+ show_only=["templates/scheduler/scheduler-deployment.yaml"],
+ )
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].livenessProbe", docs[0]
+ )
+ is None
)
- init_container_search_result = jmespath.search(
- "spec.template.spec.initContainers[?name == 'git-sync-init']",
docs[0]
+
+ assert jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].livenessProbe", docs[0]
+ ) == {
+ "httpGet": {"path": "/", "port": 10},
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ }
+
+ def test_startup_probe_configuration(self):
+ docs = render_chart(
+ values={
+ "airflowVersion": "2.11.0",
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "httpPort": 10,
+ "startupProbe": {
+ "enabled": True,
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ },
+ },
+ },
+ },
+ show_only=["templates/scheduler/scheduler-deployment.yaml"],
)
- assert "livenessProbe" in container_search_result[0]
- assert "readinessProbe" in container_search_result[0]
- assert "readinessProbe" not in init_container_search_result[0]
- assert "readinessProbe" not in init_container_search_result[0]
- assert livenessProbe == container_search_result[0]["livenessProbe"]
- assert readinessProbe == container_search_result[0]["readinessProbe"]
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].startupProbe", docs[0]
+ )
+ is None
+ )
+
+ assert jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].startupProbe", docs[0]
+ ) == {
+ "httpGet": {"path": "/", "port": 10},
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ }
diff --git a/helm-tests/tests/helm_tests/other/test_git_sync_triggerer.py
b/helm-tests/tests/helm_tests/other/test_git_sync_triggerer.py
index f074cc1bdd4..15a2a3b49b3 100644
--- a/helm-tests/tests/helm_tests/other/test_git_sync_triggerer.py
+++ b/helm-tests/tests/helm_tests/other/test_git_sync_triggerer.py
@@ -77,7 +77,7 @@ class TestGitSyncTriggerer:
"secret": {"secretName": "release-name-ssh-secret", "defaultMode":
288},
} in jmespath.search("spec.template.spec.volumes", docs[0])
- def test_liveliness_and_readiness_probes_are_configurable(self):
+ def test_liveness_probe_configuration(self):
livenessProbe = {
"failureThreshold": 10,
"exec": {"command": ["/bin/true"]},
@@ -86,6 +86,24 @@ class TestGitSyncTriggerer:
"successThreshold": 1,
"timeoutSeconds": 5,
}
+
+ docs = render_chart(
+ values={
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "livenessProbe": livenessProbe,
+ },
+ }
+ },
+ show_only=["templates/triggerer/triggerer-deployment.yaml"],
+ )
+
+ assert livenessProbe == jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].livenessProbe", docs[0]
+ )
+
+ def test_readiness_probe_configuration(self):
readinessProbe = {
"failureThreshold": 10,
"exec": {"command": ["/bin/true"]},
@@ -94,27 +112,140 @@ class TestGitSyncTriggerer:
"successThreshold": 1,
"timeoutSeconds": 5,
}
+
docs = render_chart(
values={
"dags": {
"gitSync": {
"enabled": True,
- "livenessProbe": livenessProbe,
"readinessProbe": readinessProbe,
},
}
},
show_only=["templates/triggerer/triggerer-deployment.yaml"],
)
- container_search_result = jmespath.search(
- "spec.template.spec.containers[?name == 'git-sync']", docs[0]
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].readinessProbe", docs[0]
+ )
+ is None
)
- init_container_search_result = jmespath.search(
- "spec.template.spec.initContainers[?name == 'git-sync-init']",
docs[0]
+
+ assert readinessProbe == jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].readinessProbe", docs[0]
)
- assert "livenessProbe" in container_search_result[0]
- assert "readinessProbe" in container_search_result[0]
- assert "readinessProbe" not in init_container_search_result[0]
- assert "readinessProbe" not in init_container_search_result[0]
- assert livenessProbe == container_search_result[0]["livenessProbe"]
- assert readinessProbe == container_search_result[0]["readinessProbe"]
+
+ def test_readiness_probe_configuration_recommended(self):
+ readinessProbe = {
+ "failureThreshold": 10,
+ "exec": {"command": ["/bin/true"]},
+ "initialDelaySeconds": 0,
+ "periodSeconds": 1,
+ "successThreshold": 1,
+ "timeoutSeconds": 5,
+ }
+
+ docs = render_chart(
+ values={
+ "airflowVersion": "2.11.0",
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "recommendedProbeSetting": True,
+ "readinessProbe": readinessProbe,
+ },
+ },
+ },
+ show_only=["templates/triggerer/triggerer-deployment.yaml"],
+ )
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].readinessProbe", docs[0]
+ )
+ is None
+ )
+
+ assert (
+ jmespath.search("spec.template.spec.containers[?name=='git-sync']
| [0].readinessProbe", docs[0])
+ is None
+ )
+
+ def test_liveness_probe_configuration_recommended(self):
+ docs = render_chart(
+ values={
+ "airflowVersion": "2.11.0",
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "httpPort": 10,
+ "recommendedProbeSetting": True,
+ "livenessProbe": {
+ "enabled": True,
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ },
+ },
+ },
+ },
+ show_only=["templates/triggerer/triggerer-deployment.yaml"],
+ )
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].livenessProbe", docs[0]
+ )
+ is None
+ )
+
+ assert jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].livenessProbe", docs[0]
+ ) == {
+ "httpGet": {"path": "/", "port": 10},
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ }
+
+ def test_startup_probe_configuration(self):
+ docs = render_chart(
+ values={
+ "airflowVersion": "2.11.0",
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "httpPort": 10,
+ "recommendedProbeSetting": True,
+ "startupProbe": {
+ "enabled": True,
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ },
+ },
+ },
+ },
+ show_only=["templates/triggerer/triggerer-deployment.yaml"],
+ )
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].startupProbe", docs[0]
+ )
+ is None
+ )
+
+ assert jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].startupProbe", docs[0]
+ ) == {
+ "httpGet": {"path": "/", "port": 10},
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ }
diff --git a/helm-tests/tests/helm_tests/other/test_git_sync_worker.py
b/helm-tests/tests/helm_tests/other/test_git_sync_worker.py
index 32fd71e49f2..03fdfc1217c 100644
--- a/helm-tests/tests/helm_tests/other/test_git_sync_worker.py
+++ b/helm-tests/tests/helm_tests/other/test_git_sync_worker.py
@@ -202,7 +202,7 @@ class TestGitSyncWorker:
"preStop": {"exec": {"command": ["/bin/sh", "-c", "echo preStop
handler > /git/message_start"]}},
}
- def test_liveliness_and_readiness_probes_are_configurable(self):
+ def test_liveness_probe_configuration(self):
livenessProbe = {
"failureThreshold": 10,
"exec": {"command": ["/bin/true"]},
@@ -211,6 +211,24 @@ class TestGitSyncWorker:
"successThreshold": 1,
"timeoutSeconds": 5,
}
+
+ docs = render_chart(
+ values={
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "livenessProbe": livenessProbe,
+ },
+ }
+ },
+ show_only=["templates/workers/worker-deployment.yaml"],
+ )
+
+ assert livenessProbe == jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].livenessProbe", docs[0]
+ )
+
+ def test_readiness_probe_configuration(self):
readinessProbe = {
"failureThreshold": 10,
"exec": {"command": ["/bin/true"]},
@@ -219,27 +237,140 @@ class TestGitSyncWorker:
"successThreshold": 1,
"timeoutSeconds": 5,
}
+
docs = render_chart(
values={
"dags": {
"gitSync": {
"enabled": True,
- "livenessProbe": livenessProbe,
"readinessProbe": readinessProbe,
},
}
},
show_only=["templates/workers/worker-deployment.yaml"],
)
- container_search_result = jmespath.search(
- "spec.template.spec.containers[?name == 'git-sync']", docs[0]
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].readinessProbe", docs[0]
+ )
+ is None
+ )
+
+ assert readinessProbe == jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].readinessProbe", docs[0]
)
- init_container_search_result = jmespath.search(
- "spec.template.spec.initContainers[?name == 'git-sync-init']",
docs[0]
+
+ def test_readiness_probe_configuration_recommended(self):
+ readinessProbe = {
+ "failureThreshold": 10,
+ "exec": {"command": ["/bin/true"]},
+ "initialDelaySeconds": 0,
+ "periodSeconds": 1,
+ "successThreshold": 1,
+ "timeoutSeconds": 5,
+ }
+
+ docs = render_chart(
+ values={
+ "airflowVersion": "2.11.0",
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "recommendedProbeSetting": True,
+ "readinessProbe": readinessProbe,
+ },
+ },
+ },
+ show_only=["templates/workers/worker-deployment.yaml"],
)
- assert "livenessProbe" in container_search_result[0]
- assert "readinessProbe" in container_search_result[0]
- assert "readinessProbe" not in init_container_search_result[0]
- assert "readinessProbe" not in init_container_search_result[0]
- assert livenessProbe == container_search_result[0]["livenessProbe"]
- assert readinessProbe == container_search_result[0]["readinessProbe"]
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].readinessProbe", docs[0]
+ )
+ is None
+ )
+
+ assert (
+ jmespath.search("spec.template.spec.containers[?name=='git-sync']
| [0].readinessProbe", docs[0])
+ is None
+ )
+
+ def test_liveness_probe_configuration_recommended(self):
+ docs = render_chart(
+ values={
+ "airflowVersion": "2.11.0",
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "httpPort": 10,
+ "recommendedProbeSetting": True,
+ "livenessProbe": {
+ "enabled": True,
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ },
+ },
+ },
+ },
+ show_only=["templates/workers/worker-deployment.yaml"],
+ )
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].livenessProbe", docs[0]
+ )
+ is None
+ )
+
+ assert jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].livenessProbe", docs[0]
+ ) == {
+ "httpGet": {"path": "/", "port": 10},
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ }
+
+ def test_startup_probe_configuration(self):
+ docs = render_chart(
+ values={
+ "airflowVersion": "2.11.0",
+ "dags": {
+ "gitSync": {
+ "enabled": True,
+ "httpPort": 10,
+ "recommendedProbeSetting": True,
+ "startupProbe": {
+ "enabled": True,
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ },
+ },
+ },
+ },
+ show_only=["templates/workers/worker-deployment.yaml"],
+ )
+
+ assert (
+ jmespath.search(
+ "spec.template.spec.initContainers[?name=='git-sync-init'] |
[0].startupProbe", docs[0]
+ )
+ is None
+ )
+
+ assert jmespath.search(
+ "spec.template.spec.containers[?name=='git-sync'] |
[0].startupProbe", docs[0]
+ ) == {
+ "httpGet": {"path": "/", "port": 10},
+ "timeoutSeconds": 11,
+ "initialDelaySeconds": 12,
+ "periodSeconds": 13,
+ "failureThreshold": 14,
+ }