Content-Length: 394260 | pFad | http://github.com/apache/airflow/commit/d9eec6ac447bae707fbf391511805324fa83fefd

22 Fix a bug where Kube config "worker_pod_pending_fatal_container_state… · apache/airflow@d9eec6a · GitHub
Skip to content

Commit d9eec6a

Browse files
authored
Fix a bug where Kube config "worker_pod_pending_fatal_container_state_reasons" is parsed wrongly (#50931)
* Fix a bug where Kube config "worker_pod_pending_fatal_container_state_reasons" is parsed wrongly This results in that one container state reason not handled properly Changes made here: - use the right YAML syntax to break line. This is the only way to ensure there is no unexpected space - fix get_provider_info() - add code to avoid future similar error - Add unit test w. PY
1 parent 3f44d03 commit d9eec6a

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

providers/cncf/kubernetes/provider.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ config:
241241
version_added: 8.1.0
242242
type: string
243243
example: ~
244-
default: 'CreateContainerConfigError,ErrImagePull,CreateContainerError,ImageInspectError,
245-
InvalidImageName'
244+
default: "CreateContainerConfigError,ErrImagePull,CreateContainerError,ImageInspectError,\
245+
InvalidImageName"
246246
worker_pods_creation_batch_size:
247247
description: |
248248
Number of Kubernetes Worker Pod creation calls per scheduler loop.

providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/get_provider_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def get_provider_info():
169169
"version_added": "8.1.0",
170170
"type": "string",
171171
"example": None,
172-
"default": "CreateContainerConfigError,ErrImagePull,CreateContainerError,ImageInspectError, InvalidImageName",
172+
"default": "CreateContainerConfigError,ErrImagePull,CreateContainerError,ImageInspectError,InvalidImageName",
173173
},
174174
"worker_pods_creation_batch_size": {
175175
"description": 'Number of Kubernetes Worker Pod creation calls per scheduler loop.\nNote that the current default of "1" will only launch a single pod\nper-heartbeat. It is HIGHLY recommended that users increase this\nnumber to match the tolerance of their kubernetes cluster for\nbetter performance.\n',

providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/kube_config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ def __init__(self):
4242
)
4343
self.worker_pod_pending_fatal_container_state_reasons = []
4444
if conf.get(self.kubernetes_section, "worker_pod_pending_fatal_container_state_reasons", fallback=""):
45-
self.worker_pod_pending_fatal_container_state_reasons = conf.get(
46-
self.kubernetes_section, "worker_pod_pending_fatal_container_state_reasons"
47-
).split(",")
45+
self.worker_pod_pending_fatal_container_state_reasons = [
46+
r.strip()
47+
for r in conf.get(
48+
self.kubernetes_section, "worker_pod_pending_fatal_container_state_reasons"
49+
).split(",")
50+
]
4851

4952
self.worker_pods_creation_batch_size = conf.getint(
5053
self.kubernetes_section, "worker_pods_creation_batch_size"

providers/cncf/kubernetes/tests/unit/cncf/kubernetes/executors/test_kubernetes_executor.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,3 +1806,24 @@ def effect():
18061806
self.watcher.run()
18071807

18081808
mock_underscore_run.assert_called_once_with(mock.ANY, "0", mock.ANY, mock.ANY)
1809+
1810+
@pytest.mark.parametrize(
1811+
"state_reasons, expected_result",
1812+
[
1813+
pytest.param("e1,e2,e3", ["e1", "e2", "e3"]),
1814+
pytest.param("e1, e2,e3", ["e1", "e2", "e3"]),
1815+
pytest.param(" e1,e2, e3", ["e1", "e2", "e3"]),
1816+
pytest.param("e1", ["e1"]),
1817+
pytest.param("e1 ", ["e1"]),
1818+
],
1819+
)
1820+
def test_kube_config_parse_worker_pod_pending_fatal_container_state_reasons(
1821+
self, state_reasons, expected_result
1822+
):
1823+
config = {
1824+
("kubernetes_executor", "worker_pod_pending_fatal_container_state_reasons"): state_reasons,
1825+
}
1826+
with conf_vars(config):
1827+
executor = KubernetesExecutor()
1828+
1829+
assert executor.kube_config.worker_pod_pending_fatal_container_state_reasons == expected_result

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/apache/airflow/commit/d9eec6ac447bae707fbf391511805324fa83fefd

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy