sensu-plugins-kubernetes 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36157c792a8bec58626218b903748035f536c988
4
- data.tar.gz: 5b423f2c185b3f00527889355469884182d866f1
3
+ metadata.gz: e6e9801561b6f7f63ceea10650267e2b4659c431
4
+ data.tar.gz: 97e11b5bf9920db1c6f190b778f0f58cbaf05711
5
5
  SHA512:
6
- metadata.gz: c350b9c7ab40bfa371b2df8ddacdb56207203e2294252b9c7f34a4e92f7845082bbeab91dcaf9debb794c7b67e1342d5e6f39c8652432eabd7c3a737d7c56af7
7
- data.tar.gz: e025312b7dbcaaf10c85c48ddb5c1d0964ee6a4ce5c5510a5563ad327268c7cdf0affe3f6a91ec4e330b11c0533df8da2b66c9eafe19848b165778845b82a42f
6
+ metadata.gz: e9353e3c892afcb2d17c4dfbb0c718ecb5f819577e3aed14a07e0c7dfdece9b014671a065beb791277a4ba556d150913020b93078c96404f90a503ab9c3edf2a
7
+ data.tar.gz: bbf266b3c306f50b971f388d9f28f8e7fd48575082fdcdff1272973d33af899936f98f9bbde9cd78ef344f5102f091b0ffb1214ff1914fe854bb232dadb2bb63
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.0.0] - 2017-08-28
9
+ ### Added
10
+ - Add option to explicitly include specific namespaces (@simulalex)
11
+
12
+ ### Breaking Change
13
+ - Drops support for Ruby-2.0, now requires Ruby >= 2.1.0 (@simulalex)
14
+
8
15
  ## [1.1.0] - 2017-08-11
9
16
  ### Added
10
17
  - Ruby 2.4.1 testing (@thomasriley)
@@ -54,7 +61,8 @@ pending pods, the restart count portion has been split into it's own check, `che
54
61
  ### Added
55
62
  - initial release
56
63
 
57
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/1.1.0...HEAD
64
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/2.0.0...HEAD
65
+ [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/1.1.0...2.0.0
58
66
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/1.0.0...1.1.0
59
67
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/0.1.2...1.0.0
60
68
  [0.1.2]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/0.1.1...0.1.2
data/README.md CHANGED
@@ -68,6 +68,8 @@ Usage: check-kube-pods-pending.rb (options)
68
68
  -v, --api-version VERSION API version
69
69
  -n NAMESPACES, Exclude the specified list of namespaces
70
70
  --exclude-namespace
71
+ -i NAMESPACES, Include the specified list of namespaces, an
72
+ --include-namespace empty list includes all namespaces
71
73
  -t, --timeout TIMEOUT Threshold for pods to be in the pending state
72
74
  -f, --filter FILTER Selector filter for pods to be checked
73
75
  -p, --pods PODS List of pods to check
@@ -128,6 +130,8 @@ Usage: ./check-kube-pods-running.rb (options)
128
130
  -v, --api-version VERSION API version
129
131
  -n NAMESPACES, Exclude the specified list of namespaces
130
132
  --exclude-namespace
133
+ -i NAMESPACES, Include the specified list of namespaces, an
134
+ --include-namespace empty list includes all namespaces
131
135
  -f, --filter FILTER Selector filter for pods to be checked
132
136
  -p, --pods PODS List of pods to check
133
137
  --kube-config KUBECONFIG Path to a kube config file
@@ -149,6 +153,8 @@ Usage: ./check-kube-pods-restarting.rb (options)
149
153
  -v, --api-version VERSION API version
150
154
  -n NAMESPACES, Exclude the specified list of namespaces
151
155
  --exclude-namespace
156
+ -i NAMESPACES, Include the specified list of namespaces, an
157
+ --include-namespace empty list includes all namespaces
152
158
  -f, --filter FILTER Selector filter for pods to be checked
153
159
  -p, --pods PODS List of pods to check
154
160
  -r, --restart COUNT Threshold for number of restarts allowed
@@ -28,6 +28,8 @@
28
28
  # --token-file TOKEN-FILE File containing bearer token for authorization
29
29
  # -n NAMESPACES, Exclude the specified list of namespaces
30
30
  # --exclude-namespace
31
+ # -i NAMESPACES, Include the specified list of namespaces, an
32
+ # --include-namespace empty list includes all namespaces
31
33
  # -t, --timeout TIMEOUT Threshold for pods to be in the pending state
32
34
  # -f, --filter FILTER Selector filter for pods to be checked
33
35
  # -p, --pods PODS Optional list of pods to check.
@@ -73,6 +75,13 @@ class AllPodsAreReady < Sensu::Plugins::Kubernetes::CLI
73
75
  proc: proc { |a| a.split(',') },
74
76
  default: ''
75
77
 
78
+ option :include_namespace,
79
+ description: 'Include the specified list of namespaces',
80
+ short: '-i NAMESPACES',
81
+ long: '--include-namespace',
82
+ proc: proc { |a| a.split(',') },
83
+ default: ''
84
+
76
85
  def run
77
86
  pods_list = []
78
87
  failed_pods = []
@@ -89,7 +98,7 @@ class AllPodsAreReady < Sensu::Plugins::Kubernetes::CLI
89
98
  end
90
99
  pods.each do |pod|
91
100
  next if pod.nil?
92
- next if config[:exclude_namespace].include?(pod.metadata.namespace)
101
+ next if should_exclude_namespace(pod.metadata.namespace)
93
102
  next unless pods_list.include?(pod.metadata.name) || pods_list.include?('all')
94
103
  # Check for pending state
95
104
  next unless pod.status.phase == 'Pending'
@@ -113,4 +122,9 @@ class AllPodsAreReady < Sensu::Plugins::Kubernetes::CLI
113
122
  return [list] if list
114
123
  ['']
115
124
  end
125
+
126
+ def should_exclude_namespace(namespace)
127
+ return !config[:include_namespace].include?(namespace) unless config[:include_namespace].empty?
128
+ config[:exclude_namespace].include?(namespace)
129
+ end
116
130
  end
@@ -28,6 +28,8 @@
28
28
  # -v, --api-version VERSION API version
29
29
  # -n NAMESPACES, Exclude the specified list of namespaces
30
30
  # --exclude-namespace
31
+ # -i NAMESPACES, Include the specified list of namespaces, an
32
+ # --include-namespace empty list includes all namespaces
31
33
  # -f, --filter FILTER Selector filter for pods to be checked
32
34
  # -p, --pods PODS List of pods to check
33
35
  # -r, --restart COUNT Threshold for number of restarts allowed
@@ -72,6 +74,13 @@ class PodsRestarting < Sensu::Plugins::Kubernetes::CLI
72
74
  proc: proc { |a| a.split(',') },
73
75
  default: ''
74
76
 
77
+ option :include_namespace,
78
+ description: 'Include the specified list of namespaces',
79
+ short: '-i NAMESPACES',
80
+ long: '--include-namespace',
81
+ proc: proc { |a| a.split(',') },
82
+ default: ''
83
+
75
84
  def run
76
85
  pods_list = []
77
86
  restarted_pods = []
@@ -88,7 +97,7 @@ class PodsRestarting < Sensu::Plugins::Kubernetes::CLI
88
97
  end
89
98
  pods.each do |pod|
90
99
  next if pod.nil?
91
- next if config[:exclude_namespace].include?(pod.metadata.namespace)
100
+ next if should_exclude_namespace(pod.metadata.namespace)
92
101
  next unless pods_list.include?(pod.metadata.name) || pods_list.include?('all')
93
102
  # Check restarts
94
103
  next if pod.status.containerStatuses.nil?
@@ -113,4 +122,9 @@ class PodsRestarting < Sensu::Plugins::Kubernetes::CLI
113
122
  return [list] if list
114
123
  ['']
115
124
  end
125
+
126
+ def should_exclude_namespace(namespace)
127
+ return !config[:include_namespace].include?(namespace) unless config[:include_namespace].empty?
128
+ config[:exclude_namespace].include?(namespace)
129
+ end
116
130
  end
@@ -28,6 +28,8 @@
28
28
  # -v, --api-version VERSION API version
29
29
  # -n NAMESPACES, Exclude the specified list of namespaces
30
30
  # --exclude-namespace
31
+ # -i NAMESPACES, Include the specified list of namespaces, an
32
+ # --include-namespace empty list includes all namespaces
31
33
  # -f, --filter FILTER Selector filter for pods to be checked
32
34
  # -p, --pods PODS List of pods to check
33
35
  # NOTES:
@@ -63,6 +65,13 @@ class AllPodsAreRunning < Sensu::Plugins::Kubernetes::CLI
63
65
  proc: proc { |a| a.split(',') },
64
66
  default: ''
65
67
 
68
+ option :include_namespace,
69
+ description: 'Include the specified list of namespaces',
70
+ short: '-i NAMESPACES',
71
+ long: '--include-namespace',
72
+ proc: proc { |a| a.split(',') },
73
+ default: ''
74
+
66
75
  def run
67
76
  pods_list = []
68
77
  failed_pods = []
@@ -79,7 +88,7 @@ class AllPodsAreRunning < Sensu::Plugins::Kubernetes::CLI
79
88
  end
80
89
  pods.each do |pod|
81
90
  next if pod.nil?
82
- next if config[:exclude_namespace].include?(pod.metadata.namespace)
91
+ next if should_exclude_namespace(pod.metadata.namespace)
83
92
  next unless pods_list.include?(pod.metadata.name) || pods_list.include?('all')
84
93
  next unless pod.status.phase != 'Succeeded' && !pod.status.conditions.nil?
85
94
  if pod.status.conditions[1].status == 'False' # This is the Ready state
@@ -101,4 +110,9 @@ class AllPodsAreRunning < Sensu::Plugins::Kubernetes::CLI
101
110
  return [list] if list
102
111
  ['']
103
112
  end
113
+
114
+ def should_exclude_namespace(namespace)
115
+ return !config[:include_namespace].include?(namespace) unless config[:include_namespace].empty?
116
+ config[:exclude_namespace].include?(namespace)
117
+ end
104
118
  end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsKubernetes
2
2
  module Version
3
- MAJOR = 1
4
- MINOR = 1
3
+ MAJOR = 2
4
+ MINOR = 0
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-kubernetes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-11 00:00:00.000000000 Z
11
+ date: 2017-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -227,7 +227,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
227
227
  requirements:
228
228
  - - ">="
229
229
  - !ruby/object:Gem::Version
230
- version: 2.0.0
230
+ version: 2.1.0
231
231
  required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  requirements:
233
233
  - - ">="