Fixing Armada waits for Evicted pods undefinetly

In the occasion of a pod being evicted due to low resource availability,
armada keeps waiting for the Evicted pod to be ready. This commit
removes that behavior since Kubernetes will spun up a new pod.

Story: 2008645
Task: 41906
Signed-off-by: Thiago Brito <thiago.brito@windriver.com>
Change-Id: I7263eebe357b0952375d538555536dc9f7cceff4
This commit is contained in:
Thiago Brito 2021-02-22 18:10:15 -03:00
parent 598f288f7b
commit 1e5d781fe9
2 changed files with 14 additions and 2 deletions

View File

@ -486,6 +486,9 @@ class PodWait(ResourceWait):
if is_test_pod(pod):
return 'helm test pod'
if pod.status.phase == 'Evicted':
return "pod was evicted"
schema_info = get_schema_info(self.chart_wait.chart['schema'])
# TODO: Remove when v1 doc support is removed.
if schema_info.version < 2:

View File

@ -218,7 +218,7 @@ class PodWaitTestCase(base.ArmadaTestCase):
'helm.sh/hook': 'test-success'
}),
mock_resource({'helm.sh/hook': 'test-failure'}),
mock_resource({'helm.sh/hook': 'test-success,pre-install'})
mock_resource({'helm.sh/hook': 'test-success,pre-install'}),
]
job_pods = [
mock_resource(owner_references=[mock.Mock(kind='Job')]),
@ -233,7 +233,12 @@ class PodWaitTestCase(base.ArmadaTestCase):
mock_resource(owner_references=[]),
mock_resource({'helm.sh/hook': 'pre-install'}),
mock_resource({'key': 'value'}),
mock_resource(owner_references=[mock.Mock(kind='NotAJob')])
mock_resource(owner_references=[mock.Mock(kind='NotAJob')]),
]
evicted_pods = [
mock.Mock(
metadata=mock.Mock(annotations={}, owner_references=None),
status=mock.Mock(phase='Evicted')),
]
unit = self.get_unit({}, version=1)
@ -250,6 +255,10 @@ class PodWaitTestCase(base.ArmadaTestCase):
for pod in included_pods:
self.assertTrue(unit.include_resource(pod))
# Validate evicted pods are excluded
for pod in evicted_pods:
self.assertFalse(unit.include_resource(pod))
class JobWaitTestCase(base.ArmadaTestCase):
def get_unit(self, labels):