Merge pull request #130 from hjacobs/handle-empty-time-string
#129 handle pods in strange error state
This commit is contained in:
@@ -84,11 +84,12 @@ def query_kubernetes_cluster(cluster):
|
|||||||
if obj['phase'] in ('Succeeded', 'Failed'):
|
if obj['phase'] in ('Succeeded', 'Failed'):
|
||||||
last_termination_time = 0
|
last_termination_time = 0
|
||||||
for container in obj['containers']:
|
for container in obj['containers']:
|
||||||
termination_time = container.get('state', {}).get('terminated', {}).get('finishedAt', '')
|
termination_time = container.get('state', {}).get('terminated', {}).get('finishedAt')
|
||||||
termination_time = parse_time(termination_time)
|
if termination_time:
|
||||||
if termination_time > last_termination_time:
|
termination_time = parse_time(termination_time)
|
||||||
last_termination_time = termination_time
|
if termination_time > last_termination_time:
|
||||||
if last_termination_time < now - 3600:
|
last_termination_time = termination_time
|
||||||
|
if last_termination_time and last_termination_time < now - 3600:
|
||||||
# the job/pod finished more than an hour ago
|
# the job/pod finished more than an hour ago
|
||||||
# => filter out
|
# => filter out
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user