Compare commits
17 Commits
9ce79f2f67
...
develop
Author | SHA1 | Date | |
---|---|---|---|
e570a2e3c8
|
|||
d52786aa44
|
|||
467a8a4b15
|
|||
cbef23df77
|
|||
af77b895e0
|
|||
2417429953
|
|||
4e567a0041
|
|||
9ef84c509d
|
|||
83a6152472
|
|||
ac5f98d865
|
|||
87156eda3d
|
|||
22b9593ab1
|
|||
b6f05b475f
|
|||
b174107b8a
|
|||
de408fc00d
|
|||
f8868939e1
|
|||
730817d059
|
25
app.rb
25
app.rb
@ -2,6 +2,7 @@ require "bundler/setup"
|
|||||||
require "sinatra"
|
require "sinatra"
|
||||||
require "sinatra/json"
|
require "sinatra/json"
|
||||||
require "sinatra/cookies"
|
require "sinatra/cookies"
|
||||||
|
require "sinatra/multi_route"
|
||||||
require "time"
|
require "time"
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
require "json"
|
require "json"
|
||||||
@ -205,6 +206,7 @@ before do
|
|||||||
# content_type 'text/plain'
|
# content_type 'text/plain'
|
||||||
sleep(1) while Sleep.instance.asleep? && request.path_info != "/livez/sleep"
|
sleep(1) while Sleep.instance.asleep? && request.path_info != "/livez/sleep"
|
||||||
content_type :text if request.path_info.start_with? "/_cat"
|
content_type :text if request.path_info.start_with? "/_cat"
|
||||||
|
request.session_options[:skip] = !request.path_info.start_with?("/session")
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/" do
|
get "/" do
|
||||||
@ -347,3 +349,26 @@ get "/_cat/env" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get "/_cat/cookies" do
|
||||||
|
stream do |out|
|
||||||
|
cookies.each do |k, v|
|
||||||
|
out << "#{k}=#{v}\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
route :delete, :get, :patch, :post, :put, "/status/:code" do
|
||||||
|
# hello
|
||||||
|
code = Integer(params[:code])
|
||||||
|
status code if code.between? 100, 599
|
||||||
|
end
|
||||||
|
|
||||||
|
get "/chunked/:delay" do
|
||||||
|
delay = Float(params[:delay])
|
||||||
|
stream do |out|
|
||||||
|
out << "Hello, world!\n"
|
||||||
|
sleep delay
|
||||||
|
out << "Hello, world!\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
11
kustomize/app/configmap.yaml
Normal file
11
kustomize/app/configmap.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: toy-configmap
|
||||||
|
namespace: toy
|
||||||
|
annotations:
|
||||||
|
reloader.stakater.com/match: "true"
|
||||||
|
data:
|
||||||
|
CAT: luna
|
||||||
|
|
@ -3,6 +3,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
|||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
namespace: toy
|
namespace: toy
|
||||||
resources:
|
resources:
|
||||||
- deployment.yaml
|
- secret.yaml
|
||||||
|
- configmap.yaml
|
||||||
|
- rollout.yaml
|
||||||
- services.yaml
|
- services.yaml
|
||||||
- ingress.yaml
|
- ingress.yaml
|
||||||
|
@ -1,13 +1,24 @@
|
|||||||
---
|
---
|
||||||
kind: Deployment
|
apiVersion: argoproj.io/v1alpha1
|
||||||
apiVersion: apps/v1
|
kind: Rollout
|
||||||
metadata:
|
metadata:
|
||||||
name: toy
|
name: toy
|
||||||
labels:
|
annotations:
|
||||||
app: toy
|
reloader.stakater.com/auto: "true"
|
||||||
|
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 5
|
||||||
|
strategy:
|
||||||
|
canary:
|
||||||
|
steps:
|
||||||
|
- setWeight: 20
|
||||||
|
- pause: {}
|
||||||
|
- setWeight: 40
|
||||||
|
- pause: {duration: 10}
|
||||||
|
- setWeight: 60
|
||||||
|
- pause: {duration: 10}
|
||||||
|
- setWeight: 80
|
||||||
|
- pause: {duration: 10}
|
||||||
|
revisionHistoryLimit: 2
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: toy
|
app: toy
|
||||||
@ -19,6 +30,7 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: toy
|
- name: toy
|
||||||
image: git.kill0.net/ryanc/toy:latest
|
image: git.kill0.net/ryanc/toy:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
ports:
|
ports:
|
||||||
- name: web
|
- name: web
|
||||||
containerPort: 4567
|
containerPort: 4567
|
||||||
@ -27,8 +39,11 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: toy-session-secret
|
name: toy-session-secret
|
||||||
key: toy-session-secret
|
key: session_secret
|
||||||
optional: true
|
optional: true
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: toy-configmap
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /livez
|
path: /livez
|
17
kustomize/app/secret.yaml
Normal file
17
kustomize/app/secret.yaml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
apiVersion: bitnami.com/v1alpha1
|
||||||
|
kind: SealedSecret
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
name: toy-session-secret
|
||||||
|
namespace: toy
|
||||||
|
annotations:
|
||||||
|
reloader.stakater.com/match: "true"
|
||||||
|
spec:
|
||||||
|
encryptedData:
|
||||||
|
session_secret: AgBTxKU1zmMUNAUi9zR8bBby/u7voCe9axQgtNP9naE4Jhb8cGORCOuhT7EwUNZUc0gYf8XE56EeZQx9fl/m7IPr34dkC7IK22ZAG391PUBsj7gKYdBRL+s7hqH2s02eY3EIw45lWWjjdEmEizenFmqKpD0zD/UZFps1oRUnJ8Fry/wmfpNsapyb3J5fMC1p/SlJAFAEbGe+BKhjyIxAgHbizL510X1fGvS7LGgUQR4ePnX8Xmi1ubM8PeQOX0tRZwdw+AT8hm1eUd9KSw1PwlcF/xzrGHb7Pw5zTwoa9p1H9+nv80SyNdKxgWvwFj0+GThbOc3wiF1ENVyZmxZo/Y5SyHs7QpATvy23f253aC67nmTz5FU2KkmfqO8hGhdsrxIdQo/iMZq/SVABX4FgbrbKi70dRMe4SWRD1albqp4h/e2asBMPyzS+L27m6zD8BMZ+J9sQGyjAzzkADS5xG9UAF78fXZXJmPbNxCq92FFINHK98np3ucP+VdDBMyfOeKH8ieBR/qfakWRHnVQVsR+hnwdRS0CMixw7wB6RQw/JCAXKiwKVvvmVVXZzpNucuTesFClYNTxRKhPBHtiyXEPDaHpi7PghQB81wDcY0T9u6HYjGl4udA0friiN1CmUGO8e5FtkQ4eiMe+SIB3oCXNGWErMpMkHIRdt4rdP08rZ2m4GG3MKtQlBKM4MHfcKvke4tkLmeAItMTl2qNd283xaeabO0lG9yh0fuYuaNbqvYNt8TCprLWVb+ynrqbHn4E0SeoRT+vjGSR9K9N+iLkv6GCjDhiw+TrQ4QArYHI3CS2SeY4oIOe2HUP3jyjSh4r6jH1+n3elJG/eb+GQ9nlC4xKqXE+wwx+7s850nMifcDuk=
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
name: toy-session-secret
|
||||||
|
namespace: toy
|
Reference in New Issue
Block a user