cuber 1.10.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ca7d84411e2b7547a373b76894795cc4897390e05c299c9f0e3a76c23b9d80c
4
- data.tar.gz: bb50003cf609aad7beeadba07ab288650621d84f05c78609df473141605851b5
3
+ metadata.gz: a0c9b8f7f2bce615d31aa27dc8334d17a44773ac958333417fa9dfde62aa7caa
4
+ data.tar.gz: 756795303ae4caa720e2f0b7ef0e3e99d9ab19caaa89bfd8a9ab0af04891cff4
5
5
  SHA512:
6
- metadata.gz: 94403e16a1203366e96287f172e75bfe1362c5025e8000b01adf5210330b46ac974dee6ab5c86857660ef4f3db083ba6611faf88af13d737e44c80140817d836
7
- data.tar.gz: ea49d6d4c512e08067b6a466155c417143bc6e2edf1a54f2c68c90be06e924ad665799bec2081b1cef01f70fdda025394d790602ba66d03a96550fc31d31771f
6
+ metadata.gz: 1e83b63b1f46c070ecba89426f53b0a680e087860b2e1e508e0c3af85485bf95f9a3fd44894dcdab6fb2ed64d89ba60ee7f1d108090ebee340adbf6b752dbca9
7
+ data.tar.gz: 0715516d291c07425bfb0e17c452e2752a8069b9539e380629ea2b2eeaec61c54f55ab5f91d5681583dd44ebfb87ca93b5253180350557182962cb90a94ebf0b
@@ -81,7 +81,7 @@ module Cuber
81
81
  @options[:procs].each do |procname, proc|
82
82
  @errors << "proc \"#{procname}\" name can only include lowercase letters" if procname !~ /\A[a-z]+\z/
83
83
  @errors << "proc \"#{procname}\" command must be present" if proc[:cmd].to_s.strip.empty?
84
- @errors << "proc \"#{procname}\" scale must be a positive number" unless proc[:scale].is_a?(Integer) && proc[:scale] > 0
84
+ @errors << "proc \"#{procname}\" scale must be a positive number or a range" unless (proc[:scale].is_a?(Integer) && proc[:scale] > 0) || (proc[:scale].is_a?(Range) && proc[:scale].minmax.all? { |m| m.is_a?(Integer) && m > 0 })
85
85
  @errors << "proc \"#{procname}\" cpu must be a positive number" unless proc[:cpu].nil? || proc[:cpu].is_a?(Numeric) && proc[:cpu] > 0
86
86
  @errors << "proc \"#{procname}\" ram must be a positive number" unless proc[:ram].nil? || proc[:ram].is_a?(Numeric) && proc[:ram] > 0
87
87
  @errors << "proc \"#{procname}\" term must be a positive number" unless proc[:term].is_a?(Integer) && proc[:term] > 0
@@ -71,7 +71,7 @@ metadata:
71
71
  app.kubernetes.io/version: <%= @options[:release].to_s.to_json %>
72
72
  app.kubernetes.io/managed-by: cuber
73
73
  spec:
74
- maxUnavailable: "50%"
74
+ maxUnavailable: "25%"
75
75
  selector:
76
76
  matchLabels:
77
77
  app: web-proc
@@ -131,7 +131,7 @@ metadata:
131
131
  app.kubernetes.io/managed-by: cuber
132
132
  spec:
133
133
  revisionHistoryLimit: 0
134
- replicas: <%= proc[:scale] %>
134
+ replicas: <%= proc[:scale].is_a?(Range) ? proc[:scale].min : proc[:scale] %>
135
135
  selector:
136
136
  matchLabels:
137
137
  app: <%= procname %>-proc
@@ -225,6 +225,34 @@ spec:
225
225
  terminationGracePeriodSeconds: <%= proc[:term] %>
226
226
  <%- end -%>
227
227
 
228
+ <%- @options[:procs].select { |procname, proc| proc[:scale].is_a?(Range) }.each do |procname, proc| -%>
229
+ ---
230
+ apiVersion: autoscaling/v2
231
+ kind: HorizontalPodAutoscaler
232
+ metadata:
233
+ name: scale-<%= procname %>
234
+ namespace: <%= @options[:app] %>
235
+ labels:
236
+ app.kubernetes.io/name: <%= @options[:app].to_s.to_json %>
237
+ app.kubernetes.io/instance: <%= @options[:instance].to_s.to_json %>
238
+ app.kubernetes.io/version: <%= @options[:release].to_s.to_json %>
239
+ app.kubernetes.io/managed-by: cuber
240
+ spec:
241
+ scaleTargetRef:
242
+ apiVersion: apps/v1
243
+ kind: Deployment
244
+ name: <%= procname %>
245
+ minReplicas: <%= proc[:scale].min %>
246
+ maxReplicas: <%= proc[:scale].max %>
247
+ metrics:
248
+ - type: Resource
249
+ resource:
250
+ name: cpu
251
+ target:
252
+ type: Utilization
253
+ averageUtilization: 60
254
+ <%- end -%>
255
+
228
256
  <%- @options[:cron].each do |jobname, cron| -%>
229
257
  ---
230
258
  apiVersion: batch/v1
data/lib/cuber/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cuber
2
- VERSION = '1.10.0'.freeze
2
+ VERSION = '1.12.0'.freeze
3
3
  end
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.10.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cuber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-07 00:00:00.000000000 Z
11
+ date: 2024-07-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: