@@ -49,31 +49,37 @@ def fish(self):
49
49
customResource ['plural' ])
50
50
for item in api_response ['items' ]:
51
51
version = item ['status' ]['versions' ]['reconciled' ]
52
+ pending_state = False
52
53
for condition in item ['status' ]['conditions' ]:
54
+ if condition ['type' ] == 'Pending' and condition ['status' ] == "True" :
55
+ pending_state = True
56
+
53
57
if condition ['type' ] == 'Ready' :
54
- if condition ['status' ]:
58
+ if condition ['status' ] == "True" :
55
59
health = 1
56
60
else :
57
61
health = 0
58
- self .trawler .set_gauge (
59
- self .health_prefix ,
60
- "health_status" ,
61
- health ,
62
- labels = {
63
- "component" : "{}_{}" .format (customResource ['plural' ][:- 1 ], item ['metadata' ]['name' ]),
64
- "version" : version ,
65
- ** self .health_label
66
- })
67
62
68
63
self .trawler .set_gauge (
69
64
'apiconnect' ,
70
65
"{}_status" .format (customResource ['plural' ]),
71
- 1 if condition ['status' ] else 0 ,
66
+ 1 if condition ['status' ] == "True" else 0 ,
72
67
labels = {
73
68
"type" : condition ['type' ],
74
69
"name" : item ['metadata' ]['name' ],
75
70
"namespace" : item ['metadata' ]['namespace' ],
76
71
})
72
+ if not pending_state :
73
+ self .trawler .set_gauge (
74
+ self .health_prefix ,
75
+ "health_status" ,
76
+ health ,
77
+ labels = {
78
+ "component" : "{}_{}" .format (customResource ['plural' ][:- 1 ], item ['metadata' ]['name' ]),
79
+ "version" : version ,
80
+ ** self .health_label
81
+ })
82
+
77
83
78
84
# api_response['status']['conditions']
79
85
# {'lastTransitionTime': '2021-09-30T13:33:10Z', 'message': '', 'reason': 'na', 'status': 'False', 'type': 'Warning'}
0 commit comments