Filter out "Evicted" pods (#158)

* Update kubernetes.py

* add failed pod phase

- Add mock data for failed pods
- Failed pods do not get a 'ready' or 'state' key in api. ( see issue #157 )
This commit is contained in:
Drew Rapenchuk
2018-03-26 12:36:08 -04:00
committed by Henning Jacobs
parent b724994070
commit 74bf801bc3
2 changed files with 7 additions and 4 deletions

View File

@@ -89,8 +89,8 @@ def query_kubernetes_cluster(cluster):
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
if (last_termination_time and last_termination_time < now - 3600) or (obj['reason'] in 'Evicted'):
# the job/pod finished more than an hour ago or if it is evicted by cgroup limits
# => filter out
continue
pods_by_namespace_name[(obj['namespace'], obj['name'])] = obj