Commit a755d4ca authored by Thong Kuah's avatar Thong Kuah

Write out RolloutStatus.STATUS_MAP

It's only used internally and is really a copy of the constants in
Gitlab::Kubernetes::Pod
parent 9e6cf99f
...@@ -10,14 +10,6 @@ module Gitlab ...@@ -10,14 +10,6 @@ module Gitlab
class RolloutStatus class RolloutStatus
attr_reader :deployments, :instances, :completion, :status attr_reader :deployments, :instances, :completion, :status
STATUS_MAP = {
running: 'running',
failed: 'failed',
unkonw: 'unknown',
succeeded: 'succeeded',
pending: 'pending'
}.freeze
def complete? def complete?
completion == 100 completion == 100
end end
...@@ -60,7 +52,8 @@ module Gitlab ...@@ -60,7 +52,8 @@ module Gitlab
if @instances.empty? if @instances.empty?
100 100
else else
finished = @instances.select { |instance| instance[:status] == STATUS_MAP[:running] }.count # We downcase the pod status in Gitlab::Kubernetes::Deployment#deployment_instance
finished = @instances.count { |instance| instance[:status] == Gitlab::Kubernetes::Pod::RUNNING.downcase }
(finished / @instances.count.to_f * 100).to_i (finished / @instances.count.to_f * 100).to_i
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment