Allow percentage-based rolling deployments

This commit is contained in:
Kevin McConnell
2023-04-14 11:26:10 +01:00
parent a8726be20e
commit f055766918
7 changed files with 60 additions and 12 deletions

View File

@@ -1,9 +1,19 @@
class Mrsk::Configuration::Boot
attr_reader :group_wait, :group_limit
def initialize(config:)
@options = config.raw_config.boot || {}
@host_count = config.all_hosts.count
end
def initialize(section:)
section = section || {}
@group_limit = section["group_limit"]
@group_wait = section["group_wait"]
def group_limit
limit = @options["group_limit"]
if limit.to_s.end_with?("%")
@host_count * limit.to_i / 100
else
limit
end
end
def group_wait
@options["group_wait"]
end
end