cuber 1.6.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cuber/cli.rb +2 -1
- data/lib/cuber/commands/info.rb +1 -1
- data/lib/cuber/cuberfile_parser.rb +5 -0
- data/lib/cuber/cuberfile_validator.rb +11 -5
- data/lib/cuber/templates/deployment.yml.erb +25 -1
- data/lib/cuber/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c28c18ed3acd87a99a88d336b9b729d4089efe1f97224b9bc4d16058a7ace8e
|
4
|
+
data.tar.gz: 36957c9449da91c15284dbd041edef524627c33dbf3252300049baf717f64c5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8498fc1f4c44b8e6fe4ed0939eec0e6229bb44e0dc66da2eb1e504e3304d0e2f74dc5d5ba40a123f884d9550fa584e245400cf0a1e3124beda52c0a078a48628
|
7
|
+
data.tar.gz: 2f76ecbc4462b448069ec251ccfebbc9c4def63ca4be2e2378d37e63b3db8df38ea889830b4a1ef0e73be51a9f2de418fc81bb3f83c5c79eb46080825a2706d8
|
data/lib/cuber/cli.rb
CHANGED
@@ -7,6 +7,7 @@ require 'yaml'
|
|
7
7
|
require 'json'
|
8
8
|
require 'shellwords'
|
9
9
|
require 'time'
|
10
|
+
require 'uri'
|
10
11
|
|
11
12
|
module Cuber
|
12
13
|
class CLI
|
@@ -26,7 +27,7 @@ module Cuber
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def parse_cuberfile
|
29
|
-
abort 'Cuberfile not found in current directory' unless File.
|
30
|
+
abort 'Cuberfile not found in current directory' unless File.exist? 'Cuberfile'
|
30
31
|
content = File.read 'Cuberfile'
|
31
32
|
parser = CuberfileParser.new
|
32
33
|
parser.instance_eval(content)
|
data/lib/cuber/commands/info.rb
CHANGED
@@ -98,7 +98,7 @@ module Cuber::Commands
|
|
98
98
|
schedule = cron['spec']['schedule']
|
99
99
|
command = cron['spec']['jobTemplate']['spec']['template']['spec']['containers'][0]['command'].shelljoin
|
100
100
|
last = cron['status']['lastScheduleTime']
|
101
|
-
puts "#{name}: #{schedule} #{command}
|
101
|
+
puts "#{name}: #{schedule} #{command} #{'(' + time_ago_in_words(last) + ')' if last}"
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -15,6 +15,7 @@ module Cuber
|
|
15
15
|
@cron = {}
|
16
16
|
@secrets = {}
|
17
17
|
@env = {}
|
18
|
+
@health = nil
|
18
19
|
@lb = {}
|
19
20
|
@ingress = nil
|
20
21
|
@ssl = nil
|
@@ -75,6 +76,10 @@ module Cuber
|
|
75
76
|
def env key, value, secret: false
|
76
77
|
secret ? (@secrets[key] = value) : (@env[key] = value)
|
77
78
|
end
|
79
|
+
|
80
|
+
def health url
|
81
|
+
@health = url
|
82
|
+
end
|
78
83
|
|
79
84
|
def lb key, value
|
80
85
|
@lb[key] = value
|
@@ -20,6 +20,7 @@ module Cuber
|
|
20
20
|
validate_procs
|
21
21
|
validate_cron
|
22
22
|
validate_env
|
23
|
+
validate_health
|
23
24
|
validate_lb
|
24
25
|
validate_ingress
|
25
26
|
validate_ssl
|
@@ -49,7 +50,7 @@ module Cuber
|
|
49
50
|
|
50
51
|
def validate_dockerfile
|
51
52
|
return unless @options[:dockerfile]
|
52
|
-
@errors << 'dockerfile must be a file' unless File.
|
53
|
+
@errors << 'dockerfile must be a file' unless File.exist? @options[:dockerfile]
|
53
54
|
end
|
54
55
|
|
55
56
|
def validate_image
|
@@ -63,12 +64,12 @@ module Cuber
|
|
63
64
|
|
64
65
|
def validate_dockerconfig
|
65
66
|
return unless @options[:dockerconfig]
|
66
|
-
@errors << 'dockerconfig must be a file' unless File.
|
67
|
+
@errors << 'dockerconfig must be a file' unless File.exist? @options[:dockerconfig]
|
67
68
|
end
|
68
69
|
|
69
70
|
def validate_kubeconfig
|
70
71
|
@errors << 'kubeconfig must be present' if @options[:kubeconfig].to_s.strip.empty?
|
71
|
-
@errors << 'kubeconfig must be a file' unless File.
|
72
|
+
@errors << 'kubeconfig must be a file' unless File.exist? @options[:kubeconfig]
|
72
73
|
end
|
73
74
|
|
74
75
|
def validate_migrate
|
@@ -103,6 +104,11 @@ module Cuber
|
|
103
104
|
@errors << "env \"#{key}\" name can only include uppercase letters, digits or underscores" if key !~ /\A[A-Z_]+[A-Z0-9_]*\z/
|
104
105
|
end
|
105
106
|
end
|
107
|
+
|
108
|
+
def validate_health
|
109
|
+
return unless @options[:health]
|
110
|
+
@errors << 'health checks must be an http url' unless URI.parse(@options[:health]).kind_of? URI::HTTP
|
111
|
+
end
|
106
112
|
|
107
113
|
def validate_lb
|
108
114
|
@options[:lb].each do |key, value|
|
@@ -117,8 +123,8 @@ module Cuber
|
|
117
123
|
|
118
124
|
def validate_ssl
|
119
125
|
return unless @options[:ssl]
|
120
|
-
@errors << 'ssl crt must be a file' unless File.
|
121
|
-
@errors << 'ssl key must be a file' unless File.
|
126
|
+
@errors << 'ssl crt must be a file' unless File.exist? @options[:ssl][:crt]
|
127
|
+
@errors << 'ssl key must be a file' unless File.exist? @options[:ssl][:key]
|
122
128
|
end
|
123
129
|
|
124
130
|
end
|
@@ -59,6 +59,23 @@ data:
|
|
59
59
|
<%= key %>: <%= value.to_s.to_json %>
|
60
60
|
<%- end -%>
|
61
61
|
|
62
|
+
---
|
63
|
+
apiVersion: policy/v1
|
64
|
+
kind: PodDisruptionBudget
|
65
|
+
metadata:
|
66
|
+
name: web-pdb
|
67
|
+
namespace: <%= @options[:app] %>
|
68
|
+
labels:
|
69
|
+
app.kubernetes.io/name: <%= @options[:app] %>
|
70
|
+
app.kubernetes.io/instance: <%= @options[:instance] %>
|
71
|
+
app.kubernetes.io/version: <%= @options[:release] %>
|
72
|
+
app.kubernetes.io/managed-by: cuber
|
73
|
+
spec:
|
74
|
+
maxUnavailable: "50%"
|
75
|
+
selector:
|
76
|
+
matchLabels:
|
77
|
+
app: web-proc
|
78
|
+
|
62
79
|
<%- if @options[:migrate] -%>
|
63
80
|
---
|
64
81
|
apiVersion: batch/v1
|
@@ -164,10 +181,17 @@ spec:
|
|
164
181
|
value: "8080"
|
165
182
|
ports:
|
166
183
|
- containerPort: 8080
|
184
|
+
<%- end -%>
|
185
|
+
<%- if procname.to_s == 'web' && @options[:health] -%>
|
167
186
|
readinessProbe:
|
168
187
|
httpGet:
|
169
|
-
path: /
|
170
188
|
port: 8080
|
189
|
+
path: <%= URI.parse(@options[:health]).path.to_json %>
|
190
|
+
httpHeaders:
|
191
|
+
- name: Host
|
192
|
+
value: <%= URI.parse(@options[:health]).host.to_json %>
|
193
|
+
- name: X-Forwarded-Proto
|
194
|
+
value: <%= URI.parse(@options[:health]).scheme.to_json %>
|
171
195
|
<%- end -%>
|
172
196
|
<%- if @options[:migrate] && @options[:migrate][:check] -%>
|
173
197
|
initContainers:
|
data/lib/cuber/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cuber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|