Skip to content

Commit ad89e5e

Browse files
committed
Add term option to proc (grace period in seconds for shutdown)
1 parent be74114 commit ad89e5e

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

lib/cuber/cuberfile_parser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ def migrate cmd, check: nil
6464
@migrate = { cmd: cmd, check: check }
6565
end
6666

67-
def proc name, cmd, scale: 1, env: {}
68-
@procs[name] = { cmd: cmd, scale: scale, env: env }
67+
def proc name, cmd, scale: 1, term: 60, env: {}
68+
@procs[name] = { cmd: cmd, scale: scale, term: term, env: env }
6969
end
7070

7171
def cron name, schedule, cmd

lib/cuber/cuberfile_validator.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def validate_procs
8181
@errors << "proc \"#{procname}\" name can only include lowercase letters" if procname !~ /\A[a-z]+\z/
8282
@errors << "proc \"#{procname}\" command must be present" if proc[:cmd].to_s.strip.empty?
8383
@errors << "proc \"#{procname}\" scale must be a positive number" unless proc[:scale].is_a?(Integer) && proc[:scale] > 0
84+
@errors << "proc \"#{procname}\" term must be a positive number" unless proc[:term].is_a?(Integer) && proc[:term] > 0
8485
proc[:env].each do |key, value|
8586
@errors << "proc \"#{procname}\" env name can only include uppercase letters, digits or underscores" if key !~ /\A[A-Z_]+[A-Z0-9_]*\z/
8687
end

lib/cuber/templates/deployment.yml.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ spec:
176176
<%- end -%>
177177
imagePullSecrets:
178178
- name: regcred
179+
terminationGracePeriodSeconds: <%= proc[:term] %>
179180
<%- end -%>
180181

181182
<%- @options[:cron].each do |jobname, cron| -%>

lib/cuber/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Cuber
2-
VERSION = '1.3.0'.freeze
2+
VERSION = '1.4.0'.freeze
33
end

0 commit comments

Comments
 (0)