Skip to content

Commit 8e4bfd3

Browse files
Daniel Andrzejewskimajormoses
Daniel Andrzejewski
authored andcommitted
Added requested changes
1 parent 2c80b7b commit 8e4bfd3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This CHANGELOG follows the format listed [here ](https://github.com/sensu-plugin
55

66
## [Unreleased]
77

8-
### Chaned
8+
### Changed
99
- `check-kube-pods-running.rb`: Skip a POD which is in the not ready state for shorter time than the specified time. Otherwise, the check alerts if we get lots of new PODs which are spawned every second and get up or get terminated longer than a minute. (@sys-ops)
1010

1111

bin/check-kube-pods-running.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class AllPodsAreRunning < Sensu::Plugins::Kubernetes::CLI
6464
description: 'Threshold for pods to be in the non ready state',
6565
long: '--time TIME',
6666
proc: proc(&:to_i),
67-
default: 300
67+
default: 0
6868

6969
option :pod_filter,
7070
description: 'Selector filter for pods to be checked',
@@ -118,9 +118,9 @@ def run
118118
next unless pods_list.include?(pod.metadata.name) || pods_list.include?('all')
119119
next unless pod.status.phase != 'Succeeded' && !pod.status.conditions.nil?
120120
pod_stamp = Time.parse(pod.status.startTime)
121-
if (Time.now.utc - pod_stamp.utc).to_i > config[:not_ready_time]
122-
failed_pods << pod.metadata.name unless ready? pod
123-
end
121+
runtime = (Time.now.utc - pod_stamp.utc).to_i
122+
next if runtime < config[:not_ready_time]
123+
failed_pods << pod.metadata.name unless ready? pod
124124
end
125125

126126
if failed_pods.empty?

0 commit comments

Comments
 (0)