kubernetes-health 3.10.0 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/config/initializers/enable_rack_on_sidekiq.rb +1 -1
- data/lib/kubernetes/health/config.rb +10 -0
- data/lib/kubernetes/health/rack_on_migrate.rake +1 -1
- data/lib/kubernetes/health/rack_on_migrate.rb +1 -1
- data/lib/kubernetes/health/version.rb +1 -1
- data/lib/puma/kubernetes/app.rb +2 -0
- data/lib/puma/plugin/kubernetes.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 588adb5d1b5a937a87c4c71f9b98902faee308d64b679df40784bbf66a7a8cc1
|
4
|
+
data.tar.gz: ebecbf287f66d584e48b22cbf038dd042cb32bfc7dde3be298c9cc87766ed0fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd730152d639adbf4402234873b77c00573a61c4c56c8d8ccfd2868518bba40fb3fa0fd7245e38543b52bed32c92647ce4d875af16d9af08bd2f93ae2ee92a4a
|
7
|
+
data.tar.gz: 9862d03e7c574cdb148473f47ce872f8a83c072fd28f49e7e0fec1c8e4ccd073edfaf1eb4d0b77077299e79ed2f6a56105c7189cc6fdea1f99543062b5886dc5
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ This gem open a HTTP port for monitoring your rails app while it is running Migr
|
|
16
16
|
Add this line to your application's Gemfile:
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
gem 'kubernetes-health', '~> 3.
|
19
|
+
gem 'kubernetes-health', '~> 3.7'
|
20
20
|
```
|
21
21
|
|
22
22
|
## Enabling puma plugin
|
@@ -62,7 +62,7 @@ or add in your `application.rb`.
|
|
62
62
|
# default: false
|
63
63
|
Kubernetes::Health::Config.enable_rack_on_migrate = true
|
64
64
|
```
|
65
|
-
The defined port at `config/puma.rb` will be used.
|
65
|
+
The defined port at `config/puma.rb` will be used but can be overrided by `KUBERNETES_HEALTH_METRICS_PORT` env var.
|
66
66
|
|
67
67
|
## Enabling monitoring for `sidekiq`
|
68
68
|
|
@@ -74,7 +74,7 @@ or add in your `application.rb`.
|
|
74
74
|
# default: false
|
75
75
|
Kubernetes::Health::Config.enable_rack_on_sidekiq = true
|
76
76
|
```
|
77
|
-
The defined port at `config/puma.rb` will be used.
|
77
|
+
The defined port at `config/puma.rb` will be used but can be overrided by `KUBERNETES_HEALTH_METRICS_PORT` env var.
|
78
78
|
|
79
79
|
### How `rake db:migrate` and `sidekiq` monitoring works
|
80
80
|
It will run a RACK server for `/_readiness`, `/_liveness` and `/_metrics`.
|
@@ -2,6 +2,6 @@ require 'kubernetes/health/rack_on_sidekiq'
|
|
2
2
|
|
3
3
|
if Kubernetes::Health::Config.enable_rack_on_sidekiq && Kubernetes::Health::SidekiqOptionsResolver[:concurrency].positive?
|
4
4
|
Thread.new do
|
5
|
-
Rack::Handler.
|
5
|
+
Rack::Handler::WEBrick.run Kubernetes::Health::RackOnSidekiq.new, { Port: Kubernetes::Health::Config.metrics_port }
|
6
6
|
end
|
7
7
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Kubernetes
|
2
2
|
module Health
|
3
3
|
class Config
|
4
|
+
METRICS_PORT_FROM_PUMA_CONFIG = File.read(File.join(Rails.root, 'config', 'puma.rb')).match(/kubernetes_url\s.+:(?<metrics_port>\d+)/)['metrics_port'] rescue nil
|
4
5
|
@@live_if = lambda { true }
|
5
6
|
@@ready_if = lambda { true }
|
7
|
+
@@metrics_port = ENV['KUBERNETES_HEALTH_METRICS_PORT'] || METRICS_PORT_FROM_PUMA_CONFIG || 9393
|
6
8
|
@@enable_lock_on_migrate = [true, 'true'].include? ENV['KUBERNETES_HEALTH_ENABLE_LOCK_ON_MIGRATE']
|
7
9
|
@@enable_rack_on_migrate = [true, 'true'].include? ENV['KUBERNETES_HEALTH_ENABLE_RACK_ON_MIGRATE']
|
8
10
|
@@enable_rack_on_sidekiq = [true, 'true'].include? ENV['KUBERNETES_HEALTH_ENABLE_RACK_ON_SIDEKIQ']
|
@@ -113,6 +115,14 @@ module Kubernetes
|
|
113
115
|
def self.response_format=(value)
|
114
116
|
@@response_format = value
|
115
117
|
end
|
118
|
+
|
119
|
+
def self.metrics_port
|
120
|
+
@@metrics_port
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.metrics_port=(value)
|
124
|
+
@@metrics_port = value
|
125
|
+
end
|
116
126
|
end
|
117
127
|
end
|
118
128
|
end
|
@@ -4,7 +4,7 @@ require "kubernetes/health/rack_on_migrate"
|
|
4
4
|
namespace :kubernetes_health do
|
5
5
|
task :rack_on_migrate do
|
6
6
|
Thread.new do
|
7
|
-
Rack::Handler.
|
7
|
+
Rack::Handler::WEBrick.run Kubernetes::Health::RackOnMigrate.new, { Port: Kubernetes::Health::Config.metrics_port }
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
data/lib/puma/kubernetes/app.rb
CHANGED
@@ -3,7 +3,7 @@ require 'puma/kubernetes/dsl'
|
|
3
3
|
Puma::Plugin.create do
|
4
4
|
# rubocop:disable Kubernetes/MethodLength, Kubernetes/AbcSize
|
5
5
|
def start(launcher)
|
6
|
-
str = launcher.options[:kubernetes_url] ||
|
6
|
+
str = launcher.options[:kubernetes_url] || "tcp://0.0.0.0:#{Kubernetes::Health::Config.metrics_port}"
|
7
7
|
|
8
8
|
require 'puma/kubernetes/app'
|
9
9
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubernetes-health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wagner Caixeta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
172
|
+
rubygems_version: 3.5.5
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: This gem allows kubernetes monitoring your app while it is running migrates
|