sensu-plugins-kubernetes 4.0.1 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03c80c0e33e8081efd2633cf67fe12b7edf611c426aab586ce1bfb52a5a6a2a7
4
- data.tar.gz: 016efcdfb1f4299bd86cfcb0bdafdab7150dae7a354541794768a7ee50466658
3
+ metadata.gz: ef84c02513954ee7f594405008c6beee20abcc4a50b47b935f02a1b93729dac9
4
+ data.tar.gz: 9ede4e66a04a1cee8ec1c770ce07a7499ff390055f422747c1efa118c78f32ba
5
5
  SHA512:
6
- metadata.gz: db3651d4f41bbe5df003bdd140ac48f6e1b7067af6d8914964298ed3cb4379ae31a632f311bd1e51a7f10e69ee806d523498547c18dac1fb8983978888aa6887
7
- data.tar.gz: 5dd2eff956c5b0a226080740c9329633b478b9c8f1278b2ba687ccc3da78ed573615a2d4209c7531d797d2c666e17bb6de57268d9d036fcc85395f2a4140e74d
6
+ metadata.gz: 1490ba5f9f146746f9e2d2de94c8d49d8383ae4f2475ab49a4cfe12851dbf0821921f9e625bda3672903ca57a4c66f64b845fefa2a28199bc7455a93b7575073
7
+ data.tar.gz: 8ec87b41a92bff70187ab8d82de911c289b90e4629d8314bc88d484f91c23281603c61563ba8de828474f0a9e51845aa58f2b8e6f33416794874574d34e6df19
@@ -5,6 +5,24 @@ This CHANGELOG follows the format listed [here ](https://github.com/sensu-plugin
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [5.0.1] - 2020-04-27
9
+ ### Changed
10
+ - Fixed travis build
11
+
12
+ ## [5.0.0] - 2020-04-27
13
+ ### Breaking Changes
14
+ - Bump `sensu-plugin` dependency from `~> 2.7` to `~> 4.0`
15
+ - Bump `activesupport` dependancy to '< 7.0.0'
16
+ - Bump `kubeclient` dependency to '>= 2.3', '< 5.0'
17
+
18
+ ### Added
19
+ - Bonsai asset support
20
+
21
+ ### Changed
22
+ - Updated rubocop dependency to '~> 0.81.0'
23
+ - Remediated rubocop issues
24
+ - Updated rake dependency to '~> 13.0'
25
+ - Removed codeclimate-test-reporter
8
26
 
9
27
  ## [4.0.1] - 2020-03-18
10
28
  ### Fixed
@@ -101,7 +119,9 @@ pending pods, the restart count portion has been split into it's own check, `che
101
119
  ### Added
102
120
  - initial release
103
121
 
104
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/4.0.1...HEAD
122
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/5.0.1...HEAD
123
+ [5.0.1]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/5.0.0...5.0.1
124
+ [5.0.0]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/4.0.1...5.0.0
105
125
  [4.0.1]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/4.0.0...4.0.1
106
126
  [4.0.0]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/3.3.0...4.0.0
107
127
  [3.3.0]: https://github.com/sensu-plugins/sensu-plugins-kubernetes/compare/3.2.0...3.3.0
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-kubernetes.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-kubernetes)
4
4
  [![Gem Version](https://badge.fury.io/rb/sensu-plugins-kubernetes.svg)](http://badge.fury.io/rb/sensu-plugins-kubernetes)
5
- [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-kubernetes/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-kubernetes)
6
- [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-kubernetes/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-kubernetes)
7
5
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-kubernetes.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-kubernetes)
8
6
 
9
7
  ## Functionality
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # check-kube-apiserver-available.rb
4
5
  #
5
6
  # DESCRIPTION:
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # check-kube-nodes-ready.rb
4
5
  #
5
6
  # DESCRIPTION:
@@ -64,6 +65,7 @@ class AllNodesAreReady < Sensu::Plugins::Kubernetes::CLI
64
65
  warning "#{node.name} does not have a status"
65
66
  elsif item.status != 'True'
66
67
  next if should_exclude_node(node.metadata.name)
68
+
67
69
  failed_nodes << node.metadata.name unless node.spec.unschedulable
68
70
  end
69
71
  end
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # check-kube-pods-pending
4
5
  #
5
6
  # DESCRIPTION:
@@ -121,6 +122,7 @@ class AllPodsAreReady < Sensu::Plugins::Kubernetes::CLI
121
122
  next unless pods_list.include?(pod.metadata.name) || pods_list.include?('all')
122
123
  # Check for pending state
123
124
  next unless pod.status.phase == 'Pending'
125
+
124
126
  pod_stamp = Time.parse(pod.metadata.creationTimestamp)
125
127
  puts pod.metadata.name
126
128
  if (Time.now.utc - pod_stamp.utc).to_i > config[:pending_timeout]
@@ -137,13 +139,15 @@ class AllPodsAreReady < Sensu::Plugins::Kubernetes::CLI
137
139
  end
138
140
 
139
141
  def parse_list(list)
140
- return list.split(',') if list && list.include?(',')
142
+ return list.split(',') if list&.include?(',')
141
143
  return [list] if list
144
+
142
145
  ['']
143
146
  end
144
147
 
145
148
  def should_exclude_namespace(namespace)
146
149
  return !config[:include_namespace].include?(namespace) unless config[:include_namespace].empty?
150
+
147
151
  config[:exclude_namespace].include?(namespace)
148
152
  end
149
153
  end
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # check-kube-pods-restarting
4
5
  #
5
6
  # DESCRIPTION:
@@ -120,6 +121,7 @@ class PodsRestarting < Sensu::Plugins::Kubernetes::CLI
120
121
  next unless pods_list.include?(pod.metadata.name) || pods_list.include?('all')
121
122
  # Check restarts
122
123
  next if pod.status.containerStatuses.nil?
124
+
123
125
  pod.status.containerStatuses.each do |container|
124
126
  if container.restartCount.to_i > config[:restart_count]
125
127
  restarted_pods << "#{pod.metadata.namespace}.#{container.name}"
@@ -137,13 +139,15 @@ class PodsRestarting < Sensu::Plugins::Kubernetes::CLI
137
139
  end
138
140
 
139
141
  def parse_list(list)
140
- return list.split(',') if list && list.include?(',')
142
+ return list.split(',') if list&.include?(',')
141
143
  return [list] if list
144
+
142
145
  ['']
143
146
  end
144
147
 
145
148
  def should_exclude_namespace(namespace)
146
149
  return !config[:include_namespace].include?(namespace) unless config[:include_namespace].empty?
150
+
147
151
  config[:exclude_namespace].include?(namespace)
148
152
  end
149
153
  end
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # check-kube-pods-running
4
5
  #
5
6
  # DESCRIPTION:
@@ -117,6 +118,7 @@ class AllPodsAreRunning < Sensu::Plugins::Kubernetes::CLI
117
118
  next if should_exclude_node(pod.spec.nodeName)
118
119
  next unless pods_list.include?(pod.metadata.name) || pods_list.include?('all')
119
120
  next unless pod.status.phase != 'Succeeded' && !pod.status.conditions.nil?
121
+
120
122
  pod_stamp = if pod.status.phase == 'Pending'
121
123
  Time.parse(pod.metadata.creationTimestamp)
122
124
  else
@@ -124,6 +126,7 @@ class AllPodsAreRunning < Sensu::Plugins::Kubernetes::CLI
124
126
  end
125
127
  runtime = (Time.now.utc - pod_stamp.utc).to_i
126
128
  next if runtime < config[:not_ready_time]
129
+
127
130
  failed_pods << pod.metadata.name unless ready? pod
128
131
  end
129
132
 
@@ -137,13 +140,15 @@ class AllPodsAreRunning < Sensu::Plugins::Kubernetes::CLI
137
140
  end
138
141
 
139
142
  def parse_list(list)
140
- return list.split(',') if list && list.include?(',')
143
+ return list.split(',') if list&.include?(',')
141
144
  return [list] if list
145
+
142
146
  ['']
143
147
  end
144
148
 
145
149
  def should_exclude_namespace(namespace)
146
150
  return !config[:include_namespace].include?(namespace) unless config[:include_namespace].empty?
151
+
147
152
  config[:exclude_namespace].include?(namespace)
148
153
  end
149
154
 
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # check-kube-pods-runtime
4
5
  #
5
6
  # DESCRIPTION:
@@ -85,6 +86,7 @@ class PodRuntime < Sensu::Plugins::Kubernetes::CLI
85
86
  next unless pods_list.include?(pod.metadata.name) || pods_list.include?('all')
86
87
  # Check for Running state
87
88
  next unless pod.status.phase == 'Running'
89
+
88
90
  pod_stamp = Time.parse(pod.status.startTime)
89
91
  runtime = (Time.now.utc - pod_stamp.utc).to_i
90
92
 
@@ -109,8 +111,9 @@ class PodRuntime < Sensu::Plugins::Kubernetes::CLI
109
111
  end
110
112
 
111
113
  def parse_list(list)
112
- return list.split(',') if list && list.include?(',')
114
+ return list.split(',') if list&.include?(',')
113
115
  return [list] if list
116
+
114
117
  ['']
115
118
  end
116
119
  end
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # check-kube-pods-service-available
4
5
  #
5
6
  # DESCRIPTION:
@@ -63,6 +64,7 @@ class AllServicesUp < Sensu::Plugins::Kubernetes::CLI
63
64
  # TODO: come back and clean me up
64
65
  s.each do |a| # rubocop:disable Metrics/BlockLength
65
66
  next unless services.include?(a.metadata.name)
67
+
66
68
  # Build the selector key so we can fetch the corresponding pod
67
69
  selector_key = []
68
70
  services.delete(a.metadata.name)
@@ -70,6 +72,7 @@ class AllServicesUp < Sensu::Plugins::Kubernetes::CLI
70
72
  selector_key << "#{k}=#{v}"
71
73
  end
72
74
  next if selector_key.empty?
75
+
73
76
  # Get the pod
74
77
  pod = nil
75
78
  begin
@@ -79,11 +82,13 @@ class AllServicesUp < Sensu::Plugins::Kubernetes::CLI
79
82
  end
80
83
  # Make sure our pod is running
81
84
  next if pod.nil?
85
+
82
86
  pod_available = false
83
87
  pod.each do |p|
84
88
  case p.status.phase
85
89
  when 'Pending'
86
90
  next if p.status.startTime.nil?
91
+
87
92
  if (Time.now - Time.parse(p.status.startTime)).to_i < config[:pendingTime]
88
93
  pod_available = true
89
94
  break
@@ -91,6 +96,7 @@ class AllServicesUp < Sensu::Plugins::Kubernetes::CLI
91
96
  when 'Running'
92
97
  p.status.conditions.each do |c|
93
98
  next unless c.type == 'Ready'
99
+
94
100
  if c.status == 'True'
95
101
  pod_available = true
96
102
  break
@@ -116,8 +122,9 @@ class AllServicesUp < Sensu::Plugins::Kubernetes::CLI
116
122
  end
117
123
 
118
124
  def parse_list(list)
119
- return list.split(',') if list && list.include?(',')
125
+ return list.split(',') if list&.include?(',')
120
126
  return [list] if list
127
+
121
128
  ['']
122
129
  end
123
130
  end
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # handler-kube-pod
4
5
  #
5
6
  # DESCRIPTION:
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # pod-metrics
4
5
  #
5
6
  # DESCRIPTION:
@@ -49,6 +50,7 @@ class PodsMetrics < Sensu::Plugin::Metric::CLI::Graphite
49
50
  critical 'API error: ' << e.message
50
51
  end
51
52
  next if pod.nil?
53
+
52
54
  pod.each do
53
55
  count[s.metadata.name] += 1
54
56
  end
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sensu-plugins-kubernetes/version'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sensu-plugin/check/cli'
2
4
  require 'sensu-plugins-kubernetes/client.rb'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'kubeclient'
2
4
  require 'uri'
3
5
 
@@ -10,11 +12,11 @@ module Sensu
10
12
  # The location of the service account provided CA.
11
13
  # (if the cluster is configured to provide it)
12
14
  INCLUSTER_CA_FILE =
13
- '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'.freeze
15
+ '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'
14
16
 
15
17
  # The location of the service account provided authentication token.
16
18
  INCLUSTER_TOKEN_FILE =
17
- '/var/run/secrets/kubernetes.io/serviceaccount/token'.freeze
19
+ '/var/run/secrets/kubernetes.io/serviceaccount/token'
18
20
 
19
21
  # Creates a new Kubeclient::Client instance using the given SSL
20
22
  # and authentication options (if any)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Sensu
2
4
  module Plugins
3
5
  # Namespace for the Kubernetes sensu-plugin.
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SensuPluginsKubernetes
2
4
  module Version
3
- MAJOR = 4
5
+ MAJOR = 5
4
6
  MINOR = 0
5
7
  PATCH = 1
6
8
 
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: 4.0.1
4
+ version: 5.0.1
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: 2020-03-19 00:00:00.000000000 Z
11
+ date: 2020-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -16,42 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.7'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.7'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: 5.0.0
33
+ version: 7.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "<"
39
39
  - !ruby/object:Gem::Version
40
- version: 5.0.0
40
+ version: 7.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: kubeclient
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.3'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '5.0'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
57
  version: '2.3'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '5.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: bundler
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -66,20 +72,6 @@ dependencies:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
74
  version: '2.1'
69
- - !ruby/object:Gem::Dependency
70
- name: codeclimate-test-reporter
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.4'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '0.4'
83
75
  - !ruby/object:Gem::Dependency
84
76
  name: github-markup
85
77
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +106,14 @@ dependencies:
114
106
  requirements:
115
107
  - - "~>"
116
108
  - !ruby/object:Gem::Version
117
- version: '10.5'
109
+ version: '13.0'
118
110
  type: :development
119
111
  prerelease: false
120
112
  version_requirements: !ruby/object:Gem::Requirement
121
113
  requirements:
122
114
  - - "~>"
123
115
  - !ruby/object:Gem::Version
124
- version: '10.5'
116
+ version: '13.0'
125
117
  - !ruby/object:Gem::Dependency
126
118
  name: redcarpet
127
119
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +148,14 @@ dependencies:
156
148
  requirements:
157
149
  - - "~>"
158
150
  - !ruby/object:Gem::Version
159
- version: 0.51.0
151
+ version: 0.81.0
160
152
  type: :development
161
153
  prerelease: false
162
154
  version_requirements: !ruby/object:Gem::Requirement
163
155
  requirements:
164
156
  - - "~>"
165
157
  - !ruby/object:Gem::Version
166
- version: 0.51.0
158
+ version: 0.81.0
167
159
  - !ruby/object:Gem::Dependency
168
160
  name: yard
169
161
  requirement: !ruby/object:Gem::Requirement