forked from openshift/openshift-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatus.py
More file actions
86 lines (62 loc) · 2.09 KB
/
status.py
File metadata and controls
86 lines (62 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from __future__ import absolute_import
from .model import Missing
def is_route_admitted(apiobj):
return apiobj.model.status.can_match({
'ingress': [
{
'conditions': [
{
'type': 'Admitted',
'status': 'True',
}
]
}
]
})
def is_pod_running(apiobj):
return apiobj.model.status.phase == 'Running'
def is_pod_succeeded(apiobj):
return apiobj.model.status.phase == 'Succeeded'
def is_node_ready(apiobj):
return apiobj.model.status.conditions.can_match({
'type': 'Ready',
'status': 'True',
})
def is_operator_ready(operator_apiobj):
# Operator not reporting conditions yet?
if not operator_apiobj.model.status.conditions:
return False
happy = True
for condition in operator_apiobj.model.status.conditions:
if condition.type == "Progressing" and condition.status == "True":
happy = False
if condition.type == "Failing" and condition.status == "True":
happy = False
# Degraded replaced 'Failing' in 4.1
if condition.type == "Degraded" and condition.status == "True":
happy = False
if condition.type == "Available" and condition.status == "False":
happy = False
return happy
def is_credentialsrequest_provisioned(apiobj):
if apiobj.model.status.provisioned is not Missing:
return apiobj.model.status.provisioned # This is a boolean
return False
def is_pvc_bound(apiobj):
return apiobj.model.status.phase == 'Bound'
def is_imagestream_imported(apiobj):
"""
Returns False if an imagestream reports an issue
importing images. Recommended that you run import-image --all
against the imagestream.
"""
return not apiobj.model.status.tags.can_match(
{
'conditions': [
{
'type': 'ImportSuccess',
'status': 'False'
}
]
}
)