Skip to content

Commit

Permalink
inspectors.OCP: Check for CrashLoopBackoff
Browse files Browse the repository at this point in the history
Signed-off-by: Zack Cerza <zack@redhat.com>
  • Loading branch information
zmc committed Nov 30, 2021
1 parent cb4efe8 commit c01bde3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGES
=======

* inspectors.OCP: Check for CrashLoopBackoff

v0.3.3
------

* inspectors.OCP: Check initContainers
* inspectors.OCP: Check for ImagePullBackoff

Expand Down
7 changes: 7 additions & 0 deletions must_triage/inspectors/ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,11 @@ def pod_ready(obj):
result.append(ics['state'])
if reason == 'ImagePullBackOff':
result.append(ws)
if reason == 'CrashLoopBackOff':
result.append(ws)
state = cs['lastState']
if 'terminated' in state:
result.append(dict(
message=state['terminated']['message']
))
return result
27 changes: 27 additions & 0 deletions tests/inspectors/test_ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,33 @@ def test_operator_success(self, obj, expected):
{'waiting': {'reason': 'ImagePullBackOff'}},
]
),
(
dict(
metadata=dict(name='test_pod'),
status=dict(containerStatuses=[
dict(
name='test_container',
ready=False,
state=dict(
waiting=dict(
reason='CrashLoopBackOff',
message="blah",
),
),
lastState=dict(
terminated=dict(
message="msg"
)
),
),
]),
),
[
"Container 'test_container' in pod 'test_pod' is not ready",
dict(reason="CrashLoopBackOff", message="blah"),
dict(message="msg"),
],
),
(
dict(
metadata=dict(name='test_pod'),
Expand Down

0 comments on commit c01bde3

Please sign in to comment.