cuber 1.10.0 → 1.11.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: 167faf2d74161846ae5e45a2f3bc48d7ac654668e4b8e562bb0d238546ff8a6b
4
+ data.tar.gz: 59997a9f8bd1f1b3504175d29d6b34d744f881e9e43f607281aa2e03d70e4460
5
5
  SHA512:
6
- metadata.gz: 94403e16a1203366e96287f172e75bfe1362c5025e8000b01adf5210330b46ac974dee6ab5c86857660ef4f3db083ba6611faf88af13d737e44c80140817d836
7
- data.tar.gz: ea49d6d4c512e08067b6a466155c417143bc6e2edf1a54f2c68c90be06e924ad665799bec2081b1cef01f70fdda025394d790602ba66d03a96550fc31d31771f
6
+ metadata.gz: eb17bbd6cdc40d91c67acee4e269f756f0d3e8bb1244303b5f7d12d638e5fd01c3e1a1d4b6dc506eba7cd70863ac03ab3c360b117c0fd54a8f6757e83f468326
7
+ data.tar.gz: 9ca18c504850da1bd8511f5268773ed66f8bc4b7a1661a5030d3317ecfc360188bfac4adcce91bb92427f37026d06fda33412d95b0b6a8f01fbe0dc351899e18
@@ -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
@@ -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.11.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.11.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-06-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: