Compare commits
No commits in common. "bb7f309b34559fb3eee565b354e5e6cad395c549" and "350582021374db848758a5d76e243c740b862504" have entirely different histories.
bb7f309b34
...
3505820213
44
app.rb
44
app.rb
@ -2,7 +2,6 @@ require "bundler/setup"
|
|||||||
require "sinatra"
|
require "sinatra"
|
||||||
require "sinatra/cookies"
|
require "sinatra/cookies"
|
||||||
require "sinatra/multi_route"
|
require "sinatra/multi_route"
|
||||||
require "sinatra/quiet_logger"
|
|
||||||
require "time"
|
require "time"
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
require "json"
|
require "json"
|
||||||
@ -21,7 +20,7 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + "/lib"
|
|||||||
|
|
||||||
require "config"
|
require "config"
|
||||||
|
|
||||||
VERSION = "0.1.3"
|
VERSION = "0.1.1"
|
||||||
|
|
||||||
CHUNK_SIZE = 1024**2
|
CHUNK_SIZE = 1024**2
|
||||||
SESSION_SECRET_HEX_LENGTH = 64
|
SESSION_SECRET_HEX_LENGTH = 64
|
||||||
@ -53,12 +52,9 @@ DURATION_PARTS = [
|
|||||||
|
|
||||||
config = Config.new
|
config = Config.new
|
||||||
|
|
||||||
set :quiet_logger_prefixes, %w[livez readyz]
|
|
||||||
set :session_secret, config.session_secret.unwrap
|
set :session_secret, config.session_secret.unwrap
|
||||||
set :public_folder, __dir__ + "/static"
|
set :public_folder, __dir__ + "/static"
|
||||||
|
|
||||||
register Sinatra::QuietLogger
|
|
||||||
|
|
||||||
module Sinatra
|
module Sinatra
|
||||||
module RequestHeadersHelper
|
module RequestHeadersHelper
|
||||||
def req_headers
|
def req_headers
|
||||||
@ -168,7 +164,7 @@ class Sleep
|
|||||||
include State
|
include State
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@file = "/dev/shm/sleepy"
|
@file = "/dev/shm/sleep"
|
||||||
end
|
end
|
||||||
|
|
||||||
def asleep?
|
def asleep?
|
||||||
@ -236,7 +232,9 @@ end
|
|||||||
|
|
||||||
enable :sessions
|
enable :sessions
|
||||||
|
|
||||||
|
on_start do
|
||||||
puts "#{NAME} #{VERSION} staring, per aspera ad astra"
|
puts "#{NAME} #{VERSION} staring, per aspera ad astra"
|
||||||
|
end
|
||||||
|
|
||||||
configure do
|
configure do
|
||||||
mime_type :json, "application/json"
|
mime_type :json, "application/json"
|
||||||
@ -311,23 +309,6 @@ get "/headers", provides: "json" do
|
|||||||
jsonify h, pretty:
|
jsonify h, pretty:
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/uptime", provides: "json" do
|
|
||||||
tt = TickTock.new
|
|
||||||
x = {started_at: tt.started_at, seconds: tt.uptime.to_i, human: human_time(tt.uptime.to_i)}
|
|
||||||
|
|
||||||
jsonify x
|
|
||||||
end
|
|
||||||
|
|
||||||
post "/api/livez/toggle" do
|
|
||||||
Health.instance.toggle
|
|
||||||
"ok\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
post "/api/livez/sleep" do
|
|
||||||
Sleep.instance.toggle
|
|
||||||
"ok\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
get "/livez" do
|
get "/livez" do
|
||||||
error 503 unless Health.instance.healthy?
|
error 503 unless Health.instance.healthy?
|
||||||
|
|
||||||
@ -336,6 +317,23 @@ get "/livez" do
|
|||||||
Health.instance.to_s
|
Health.instance.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get "/livez/uptime" do
|
||||||
|
tt = TickTock.new
|
||||||
|
x = {started_at: tt.started_at, seconds: tt.uptime.to_i, human: human_time(tt.uptime.to_i)}
|
||||||
|
|
||||||
|
jsonify x
|
||||||
|
end
|
||||||
|
|
||||||
|
post "/livez/toggle" do
|
||||||
|
Health.instance.toggle
|
||||||
|
"ok\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
post "/livez/sleep" do
|
||||||
|
Sleep.instance.toggle
|
||||||
|
"ok\n"
|
||||||
|
end
|
||||||
|
|
||||||
get "/readyz" do
|
get "/readyz" do
|
||||||
error 503 unless Ready.instance.ready?
|
error 503 unless Ready.instance.ready?
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@ type: application
|
|||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 0.1.3
|
version: 0.1.1
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application. Versions are not expected to
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
# It is recommended to use it with quotes.
|
# It is recommended to use it with quotes.
|
||||||
appVersion: "0.1.3"
|
appVersion: "0.1.1"
|
||||||
|
@ -97,7 +97,7 @@ readinessProbe:
|
|||||||
|
|
||||||
# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
|
# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
|
||||||
autoscaling:
|
autoscaling:
|
||||||
enabled: true
|
enabled: false
|
||||||
minReplicas: 2
|
minReplicas: 2
|
||||||
maxReplicas: 100
|
maxReplicas: 100
|
||||||
targetCPUUtilizationPercentage: 80
|
targetCPUUtilizationPercentage: 80
|
||||||
|
@ -16,7 +16,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: kubernaut
|
- name: kubernaut
|
||||||
image: git.kill0.net/ryanc/kubernaut:0.1.3
|
image: git.kill0.net/ryanc/kubernaut:0.1.1
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
ports:
|
ports:
|
||||||
- name: sinatra-web
|
- name: sinatra-web
|
||||||
|
Loading…
x
Reference in New Issue
Block a user