Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
#129 handle pods in strange error state
Browse files Browse the repository at this point in the history
  • Loading branch information
hjacobs committed Feb 28, 2017
1 parent d4fdf1a commit 5bdef77
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kube_ops_view/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ def query_kubernetes_cluster(cluster):
if obj['phase'] in ('Succeeded', 'Failed'):
last_termination_time = 0
for container in obj['containers']:
termination_time = container.get('state', {}).get('terminated', {}).get('finishedAt', '')
termination_time = parse_time(termination_time)
if termination_time > last_termination_time:
last_termination_time = termination_time
if last_termination_time < now - 3600:
termination_time = container.get('state', {}).get('terminated', {}).get('finishedAt')
if termination_time:
termination_time = parse_time(termination_time)
if termination_time > last_termination_time:
last_termination_time = termination_time
if last_termination_time and last_termination_time < now - 3600:
# the job/pod finished more than an hour ago
# => filter out
continue
Expand Down

0 comments on commit 5bdef77

Please sign in to comment.