cuber 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cuber/commands/ctl.rb +14 -0
- data/lib/cuber/commands/info.rb +2 -2
- data/lib/cuber/cuberfile_parser.rb +2 -2
- data/lib/cuber/cuberfile_validator.rb +2 -0
- data/lib/cuber/templates/deployment.yml.erb +12 -0
- data/lib/cuber/version.rb +1 -1
- data/lib/cuber.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39f690dbfe51c572573fa0bf59c5f43c1b2806576aed7249afafa94d9184f146
|
4
|
+
data.tar.gz: 03a35ba128901bb1d2a86a95f517cfeb44383da40b5351914ccdda21e8d21315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1800876c72eac1ad1066cf17bdf139ee3ce204c3d32eff529dad6fd031632a0c1c8b912012fb37ce900d912d76f846bdfd9ffdc505cbbc6e54f1fd80ceecff92
|
7
|
+
data.tar.gz: f6a2dc6449e62325d82d988b392b9dd2cea53cc7584701fe7901093c7d6ceef009114f7dda2a95bec25f9426d40fcc56e333bd7240309f3d272341cde8a0a486
|
data/lib/cuber/commands/info.rb
CHANGED
@@ -109,8 +109,8 @@ module Cuber::Commands
|
|
109
109
|
name = pod['metadata']['name']
|
110
110
|
created_at = pod['metadata']['creationTimestamp']
|
111
111
|
pod_status = pod['status']['phase']
|
112
|
-
container_ready = pod
|
113
|
-
container_status = pod
|
112
|
+
container_ready = pod.dig('status', 'containerStatuses', 0, 'ready')
|
113
|
+
container_status = pod.dig('status', 'containerStatuses', 0, 'state')&.values&.first&.[]('reason')
|
114
114
|
if pod_status == 'Succeeded' || (pod_status == 'Running' && container_ready)
|
115
115
|
puts "#{name}: \e[32m#{container_status || pod_status}\e[0m (#{time_ago_in_words created_at})"
|
116
116
|
else
|
@@ -64,8 +64,8 @@ module Cuber
|
|
64
64
|
@migrate = { cmd: cmd, check: check }
|
65
65
|
end
|
66
66
|
|
67
|
-
def proc name, cmd, scale: 1, term: 60, env: {}
|
68
|
-
@procs[name] = { cmd: cmd, scale: scale, term: term, env: env }
|
67
|
+
def proc name, cmd, scale: 1, cpu: nil, ram: nil, term: 60, env: {}
|
68
|
+
@procs[name] = { cmd: cmd, scale: scale, cpu: cpu, ram: ram, term: term, env: env }
|
69
69
|
end
|
70
70
|
|
71
71
|
def cron name, schedule, cmd
|
@@ -81,6 +81,8 @@ module Cuber
|
|
81
81
|
@errors << "proc \"#{procname}\" name can only include lowercase letters" if procname !~ /\A[a-z]+\z/
|
82
82
|
@errors << "proc \"#{procname}\" command must be present" if proc[:cmd].to_s.strip.empty?
|
83
83
|
@errors << "proc \"#{procname}\" scale must be a positive number" unless proc[:scale].is_a?(Integer) && proc[:scale] > 0
|
84
|
+
@errors << "proc \"#{procname}\" cpu must be a positive number" unless proc[:cpu].nil? || proc[:cpu].is_a?(Numeric) && proc[:cpu] > 0
|
85
|
+
@errors << "proc \"#{procname}\" ram must be a positive number" unless proc[:ram].nil? || proc[:ram].is_a?(Numeric) && proc[:ram] > 0
|
84
86
|
@errors << "proc \"#{procname}\" term must be a positive number" unless proc[:term].is_a?(Integer) && proc[:term] > 0
|
85
87
|
proc[:env].each do |key, value|
|
86
88
|
@errors << "proc \"#{procname}\" env name can only include uppercase letters, digits or underscores" if key !~ /\A[A-Z_]+[A-Z0-9_]*\z/
|
@@ -137,6 +137,18 @@ spec:
|
|
137
137
|
<%- else -%>
|
138
138
|
command: <%= proc[:cmd].shellsplit %>
|
139
139
|
<%- end -%>
|
140
|
+
resources:
|
141
|
+
requests:
|
142
|
+
<%- if proc[:cpu] -%>
|
143
|
+
cpu: <%= proc[:cpu] %>
|
144
|
+
<%- end -%>
|
145
|
+
<%- if proc[:ram] -%>
|
146
|
+
memory: <%= proc[:ram] %>Gi
|
147
|
+
<%- end -%>
|
148
|
+
limits:
|
149
|
+
<%- if proc[:ram] -%>
|
150
|
+
memory: <%= proc[:ram] %>Gi
|
151
|
+
<%- end -%>
|
140
152
|
envFrom:
|
141
153
|
- configMapRef:
|
142
154
|
name: env
|
data/lib/cuber/version.rb
CHANGED
data/lib/cuber.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.6.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
|
+
date: 2022-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -23,6 +23,7 @@ files:
|
|
23
23
|
- cuber.gemspec
|
24
24
|
- lib/cuber.rb
|
25
25
|
- lib/cuber/cli.rb
|
26
|
+
- lib/cuber/commands/ctl.rb
|
26
27
|
- lib/cuber/commands/deploy.rb
|
27
28
|
- lib/cuber/commands/info.rb
|
28
29
|
- lib/cuber/commands/logs.rb
|